-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
chore(rls): Remove passing global username #20344
chore(rls): Remove passing global username #20344
Conversation
cdf6c06
to
29f4512
Compare
Codecov Report
@@ Coverage Diff @@
## master #20344 +/- ##
==========================================
+ Coverage 66.64% 66.70% +0.06%
==========================================
Files 1738 1754 +16
Lines 65060 65593 +533
Branches 6885 6938 +53
==========================================
+ Hits 43360 43756 +396
- Misses 19953 20079 +126
- Partials 1747 1758 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
ping @betodealmeida |
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.
LGTM
* chore(rls): Remove passing global username * Update manager.py * Update manager.py * Update manager.py * Update manager.py Co-authored-by: John Bodley <john.bodley@airbnb.com> (cherry picked from commit ad308fb)
* chore(rls): Remove passing global username * Update manager.py * Update manager.py * Update manager.py * Update manager.py Co-authored-by: John Bodley <john.bodley@airbnb.com>
SUMMARY
I'm not well versed in the row level security logic, but it seems there's functionality of the form,
to obtain the user associated with the RLS check. The issue is the optional
username
—which is used to set the user if no current user exists—was only specified once viaget_username()
which makes the the above logic behave like,which can be then refactored as,
which makes the
elif
clause unnecessarily as it's captured in theif
clause. Furthermore thatg.user
andself.find_user(...)
can returnNone
and so theelse
should also replaced with the short circuit logic in essence returning if and only if there is isn't a user defined.Said logic was added in #19999 but was likely made obsolete by #19914.
This PR removes the optional
username
argument throughout the RLS code path.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
CI.
ADDITIONAL INFORMATION