-
Notifications
You must be signed in to change notification settings - Fork 15.4k
feat(security): add guest user attributes and get_guest_user_attribute() macro #33924
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
base: master
Are you sure you want to change the base?
feat(security): add guest user attributes and get_guest_user_attribute() macro #33924
Conversation
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.
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.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Status |
---|---|---|
SQL Injection Vulnerability in Guest User Attributes ▹ view | 🧠 Incorrect |
Files scanned
File Path | Reviewed |
---|---|
superset/security/guest_token.py | ✅ |
superset/security/api.py | ✅ |
docs/docs/configuration/sql-templating.mdx | ✅ |
superset/jinja_context.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Check out our docs on how you can make Korbit work best for you and your team.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #33924 +/- ##
===========================================
+ Coverage 0 72.87% +72.87%
===========================================
Files 0 559 +559
Lines 0 40471 +40471
Branches 0 4256 +4256
===========================================
+ Hits 0 29492 +29492
- Misses 0 9875 +9875
- Partials 0 1104 +1104
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@Yash2412 thanks for opening a SIP for this. Here are the instruction for the SIP process before this PR can be merged: #5602. If @mistercrunch or @michael-s-molina does not think this requires a SIP, we can go through our regular PR process to get this merged. |
8516495
to
110aaa0
Compare
110aaa0
to
eff9b17
Compare
SUMMARY
Add support for user attributes in guest tokens and a corresponding Jinja macro
get_guest_user_attribute()
to enable dynamic user-specific data filtering in embedded dashboards.Changes include:
attributes
field toGuestTokenUser
TypedDict andGuestUser
classget_guest_user_attribute(attribute_name, default=None)
Jinja macroThis enables embedded dashboard use cases like multi-tenant data filtering, role-based access control, and regional data restrictions by allowing applications to pass user-specific attributes when creating guest tokens.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Test Guest Token Creation with Attributes:
Test Jinja Macro in SQL Lab:
Test with Guest Token:
Test Backward Compatibility:
Run Test Suite:
ADDITIONAL INFORMATION
Files Modified:
superset/security/guest_token.py
- Add attributes field to GuestTokenUser and GuestUsersuperset/security/api.py
- Update UserSchema validationsuperset/jinja_context.py
- Add get_guest_user_attribute() macrotests/integration_tests/security_tests.py
- Guest token teststests/unit_tests/jinja_context_test.py
- Jinja macro testsBackward Compatibility: Fully backward compatible - attributes field is optional with graceful fallbacks.