its-amann commented on code in PR #76746:
URL: https://github.com/apache/airflow/pull/76746#discussion_r4525057367
##########
providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -2559,6 +2559,9 @@ def auth_user_remote_user(self, username) -> User | None:
email=username + "@email.notfound",
role=self.find_role(self.auth_user_registration_role),
)
+ if user is None:
+ log.error("Error creating a new REMOTE_USER user %s", username)
+ return None
Review Comment:
if two requests for a brand new REMOTE_USER land together (the UI fires a
bunch on first load), the second one hits the unique username error and now
gets denied even though the user exists by then. looking it up again covers
that:
```suggestion
if user is None:
# a parallel first request for the same REMOTE_USER can win
the insert
user = self.find_user(username=username)
if user is None or not user.is_active:
log.error("Error creating a new REMOTE_USER user %s",
username)
return None
```
already fixed this with a test in this commit, you can just cherry pick it
instead of redoing it:
https://github.com/its-amann/airflow/commit/08e3015b0430cdad6e78f0c6facc36aa5767a55e
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]