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

   ### SUMMARY
   
   The identity template macros `current_username()` and `current_user_email()` 
returned their value verbatim, while the other viewer-controlled macros run 
theirs through `_escape_value` for dialect-specific literal rendering: 
`url_param` 
([jinja_context.py](https://github.com/apache/superset/blob/master/superset/jinja_context.py)),
 `get_guest_user_attribute`, and `get_filters`' `escaped_val`. The documented 
templating pattern interpolates these identity values into a single-quoted SQL 
literal, so leaving them unescaped was inconsistent with their siblings.
   
   This applies `_escape_value` to both identity macros, keeping them 
consistent with the rest of the family. An `escape_result=True` parameter 
mirrors `url_param` so callers can opt out, and when no dialect is configured 
the value is returned unchanged, preserving prior behavior (ordinary values 
without special characters are unaffected).
   
   ### TESTING INSTRUCTIONS
   
   `pytest tests/unit_tests/jinja_context_test.py -k current_username`
   
   Adds `test_current_username_email_escaped`, 
`test_current_username_email_unescaped_opt_out`, and 
`test_current_username_email_unchanged_without_dialect`.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [x] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [ ] 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