ChickenBenny commented on code in PR #76746:
URL: https://github.com/apache/airflow/pull/76746#discussion_r4534683555


##########
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:
   Thanks for catching this! I cherry-picked your commit.
   
   I also checked why the second lookup works. add_user already calls 
`session.rollback()` when the insert fails, so the next `find_user` autobegins 
a new transaction. It gets a fresh snapshot and sees the row the other request 
committed, even on MySQL's default REPEATABLE READ.
   
   I also parametrized the test to cover an inactive user, which should still 
be denied.



-- 
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]

Reply via email to