BinhPhamQuang opened a new pull request, #37984:
URL: https://github.com/apache/superset/pull/37984

   
   ### SUMMARY
   StarRocks implements user impersonation via get_prequeries (EXECUTE AS) 
rather than impersonate_user. It calls database.get_effective_user() directly, 
which bypasses the IMPERSONATE_WITH_EMAIL_PREFIX feature flag transformation. 
When the flag is enabled, Trino/Presto/Drill/Hive use the email prefix (e.g., 
alice from [email protected]), but StarRocks still used the raw username.
   
   This change centralizes the IMPERSONATE_WITH_EMAIL_PREFIX logic inside 
get_effective_user so all impersonation paths (including StarRocks 
get_prequeries) receive the correct transformed identity.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   ### TESTING INSTRUCTIONS
   1. Enable IMPERSONATE_WITH_EMAIL_PREFIX in config.
   2. Create a StarRocks database with "Impersonate logged in user" enabled.
   3. Create a user with email [email protected] and username alice.
   4. Run a query as that user; verify the executed query uses alice(email 
prefix) in the EXECUTE AS clause, not alice.
   5. Run unit tests: pytest tests/unit_tests/models/core_test.py 
tests/unit_tests/db_engine_specs/test_starrocks.py
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [x] Required feature flags: IMPERSONATE_WITH_EMAIL_PREFIX
   - [ ] Changes UI
   - [ ] Includes DB Migration
     - [ ] 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]

Reply via email to