Skip to content

fix(jinja): apply consistent escaping to url_param values from request args#40633

Merged
rusackas merged 2 commits into
masterfrom
fix/jinja-url-param-consistent-escaping
Jun 3, 2026
Merged

fix(jinja): apply consistent escaping to url_param values from request args#40633
rusackas merged 2 commits into
masterfrom
fix/jinja-url-param-consistent-escaping

Conversation

@rusackas
Copy link
Copy Markdown
Member

@rusackas rusackas commented Jun 1, 2026

SUMMARY

ExtraCache.url_param() escapes values that come from form_data["url_params"] using the dialect's literal processor, but values read from the request query string took an early return that skipped that escaping. Both sources are interpolated into the rendered SQL, so this routes them through the same escaping path (still honoring escape_result=False for callers that opt out). It also means request-args values now consistently participate in the cache key.

BEFORE / AFTER

url_param('foo') with ?foo=O'Brien on a dialect that doubles quotes:

  • Before: O'Brien (raw, from the request-args early return)
  • After: O''Brien (escaped, same as the form-data path)

TESTING INSTRUCTIONS

pytest tests/unit_tests/jinja_context_test.py -k url_param

Adds test_url_param_escaped_request_args and test_url_param_unescaped_request_args (12/12 url_param tests pass).

ADDITIONAL INFORMATION

  • Has associated issue: n/a
  • Changes UI: No
  • Includes DB Migration: No
  • Introduces new feature or API: No
  • Removes existing feature or API: No

🤖 Generated with Claude Code

@rusackas rusackas requested review from dpgaspar and hainenber June 1, 2026 23:50
@dosubot dosubot Bot added the global:jinja Related to Jinja templating label Jun 1, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Jun 1, 2026

Code Review Agent Run #2d9e16

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 1ba4113..1ba4113
    • superset/jinja_context.py
    • tests/unit_tests/jinja_context_test.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 0af6515
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a1f6d253666b3000732ee18
😎 Deploy Preview https://deploy-preview-40633--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.05%. Comparing base (3bbb35e) to head (0f88c54).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #40633   +/-   ##
=======================================
  Coverage   64.05%   64.05%           
=======================================
  Files        2662     2662           
  Lines      143254   143254           
  Branches    32941    32941           
=======================================
+ Hits        91764    91766    +2     
+ Misses      49903    49902    -1     
+ Partials     1587     1586    -1     
Flag Coverage Δ
hive 39.80% <0.00%> (ø)
mysql 58.48% <100.00%> (+<0.01%) ⬆️
postgres 58.55% <100.00%> (+<0.01%) ⬆️
presto 41.40% <0.00%> (ø)
python 60.03% <100.00%> (+<0.01%) ⬆️
sqlite 58.17% <100.00%> (+<0.01%) ⬆️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes inconsistent escaping in ExtraCache.url_param(): previously values from request query string took an early return that bypassed dialect-specific literal escaping applied to form-data values. Now both sources flow through the same escaping path, honoring escape_result=False.

Changes:

  • Removed early-return in url_param() so request-args values pass through the shared escaping block.
  • Added two unit tests covering escaped and unescaped request-args cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
superset/jinja_context.py Refactor url_param so request-args and form-data values share the same escaping logic.
tests/unit_tests/jinja_context_test.py New tests verifying escape behavior for request-args values.

@rusackas rusackas requested a review from sha174n June 2, 2026 00:01
@sha174n sha174n added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Jun 2, 2026
…t args

`url_param()` escaped values sourced from `form_data["url_params"]` using
the dialect's literal processor, but returned values read from the request
query string unescaped via an early return. Both sources are interpolated
into the rendered SQL, so route them through the same escaping (still
honoring `escape_result=False`). Adds tests covering the request-args path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas rusackas force-pushed the fix/jinja-url-param-consistent-escaping branch from 0af6515 to 754759b Compare June 3, 2026 00:32
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas rusackas moved this from Needs Review to Approved and/or Merged in Superset Review Help Wanted Jun 3, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Jun 3, 2026

Code Review Agent Run #96528c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 754759b..0f88c54
    • superset/jinja_context.py
    • tests/unit_tests/jinja_context_test.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas merged commit 12bef03 into master Jun 3, 2026
59 checks passed
@rusackas rusackas deleted the fix/jinja-url-param-consistent-escaping branch June 3, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

global:jinja Related to Jinja templating merge-if-green If approved and tests are green, please go ahead and merge it for me size/M

Projects

Status: Approved and/or Merged

Development

Successfully merging this pull request may close these issues.

4 participants