From fe2436ce6b89a8e8273632b713350e5f6a600edf Mon Sep 17 00:00:00 2001 From: Alexander Song Date: Tue, 3 Sep 2024 12:47:51 -0700 Subject: [PATCH] fix(auth): prevent first admin password salt from being reset on every start --- src/phoenix/db/facilitator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/phoenix/db/facilitator.py b/src/phoenix/db/facilitator.py index 6f0d497823..d53db83c68 100644 --- a/src/phoenix/db/facilitator.py +++ b/src/phoenix/db/facilitator.py @@ -113,6 +113,7 @@ async def _ensure_admin_password(session: AsyncSession) -> None: loop = asyncio.get_running_loop() hash_ = await loop.run_in_executor(None, compute) password_hash = coalesce(models.User.password_hash, hash_) + password_salt = coalesce(models.User.password_salt, salt) first_local_admin = ( select(func.min(models.User.id)) .join(models.UserRole) @@ -125,7 +126,7 @@ async def _ensure_admin_password(session: AsyncSession) -> None: .where(models.User.id == first_local_admin) .values( password_hash=password_hash, - password_salt=salt, + password_salt=password_salt, ) ) await session.execute(stmt)