rusackas opened a new pull request, #42938: URL: https://github.com/apache/superset/pull/42938
### SUMMARY Two unrelated identity/cache-key robustness fixes: - `sync_database_permissions_task` resolved its acting identity from a username string at execution time. Since that resolution happens after the Celery enqueue/execute boundary, a username change in between (a rename, or reassignment of a freed-up name) could change which user's account the async sync runs under — including for OAuth2 token lookup and `impersonate_user` connections, both of which key off the bound `g.user`. The user id is now resolved once at enqueue time and carried across the Celery boundary instead, matching the convention already used by other identity-carrying tasks in this codebase (e.g. `export_dashboard_excel`). - `collect_rls_predicates_for_sql` feeds `SqlaTable.get_extra_cache_keys` for virtual datasets, folding each user's RLS predicates into the dataset's cache key so users with different RLS scopes get different cache entries. On a SQL-parse failure it fell back to an empty list — a fixed contribution regardless of who's asking, collapsing what should be distinct cache-key contributions for differently-scoped users into one. It now returns a marker derived from the current user's id instead, so a parse failure still varies the cache key per user. This only touches the cache-key helper; RLS predicate enforcement on the actual query goes through a separate, untouched path (`get_sqla_row_level_filters`). ### TESTING INSTRUCTIONS ```bash pytest tests/unit_tests/commands/databases/sync_permissions_identity_test.py pytest tests/unit_tests/commands/databases/ pytest tests/unit_tests/utils/rls_test.py ``` ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
