-
Notifications
You must be signed in to change notification settings - Fork 16.4k
AIP-56: Change FAB username identifier #34051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AIP-56: Change FAB username identifier #34051
Conversation
845fafb to
6010016
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work, I think
| if user.username: | |
| return user.username | |
| elif user.email: | |
| return user.email | |
| else: | |
| return self.get_user_id() | |
| return user.username or user.email or self.get_user_id() |
vincbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that introducing 2 APIs instead of one make sense. They serve 2 different purpose. Thanks for doing it
6010016 to
b181f97
Compare
uranusjr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending CI
|
Some tests are failing |
b181f97 to
75973c2
Compare
airflow/www/decorators.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it’s a good idea to introduce None (a different type) here; either an empty string or "Anonymous" would be easier for consuming processes to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, good catch. get_user_display_name returns an empty string when inputs are empty so this should do the same.
75973c2 to
db6fd8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this field ever NULL? Can we make the default an empty string instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, set this to be serverside "" and rebased.
db6fd8a to
68efd6a
Compare
|
Looks like I messed up the rebase 😢 will fix |
68efd6a to
81ae019
Compare
|
Autogenerated migration elements should be fixed, but I'm a little clueless when it comes to debugging the specifics of why the MSSQL downgrade test is failing. Any advice @uranusjr ?
|
|
MSSQL really doesn’t like a. Use |
|
@uranusjr After some review, testing, and thinking on it, I think it may be a bad idea to set a default value here on The Second, the If we wanted to consider a more substantive rewrite of the As such I think the current state of the PR is the desired state (assuming tests pass). Let me know your thoughts. |
CC: @vincbeck as owner of AIP-56
#32217 implemented the base and FAB user management interfaces. As a part of that PR,
get_user_namewas set to beFirstName LastNamefor FAB.This is a poor choice. A username should be both invariant and unique; FirstName and LastName are self-configurable by all user roles by default (aside from
Public) in the Airflow UI, and for users who configure a dirsync SSO to FAB and do not give permission to Edit My Profile, the user's display name is commonly self-configurable in those systems as well. Further, any sufficiently large system will eventually encounter a name clash between two concurrent users, essentially leaving a username (identifier) clash. As a result, in today's version of the code:get_user_nameis implemented (for example the Audit Log), the Audit Log cannot be used to establish an event chain if a user decides to change their name (which they can do by default without the aid of an administrator)However, the user's display name is still an important and useful tool to provide a better UX. As a result, we fix this by performing the following changes:
auth_manager.get_user_display_nameto augment the original API as proposed in AIP-56get_user_nameto have fallback values available for backwards compatibility, but choose values that are sufficiently unique and invariant (email is not a perfect choice but it is better than display name)get_user_display_nameas the originalFirstName LastNameand migrate UI elements to use this new method instead ofget_user_name.friendly_owneris added to theLogtable which stores the user's Display Name for easier human-based audits of actions. (NOTE: This may be something to split out into a separate PR, which can be bundled with a minor version update. This is included in a separate commit to aid in this.)This has a few implications:
ownerfield is also single-valued, which makes for easier queries and cross-analysis with other log sources.get_auth_manager.get_user_namewill make its way into actual security code eventually. If it does, this type of clash leads into a simple and very dangerous privilege escalation.Additional ref: https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-56+Extensible+user+management
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.