Skip to content

fix(deck.gl): strip all JS-executed form_data keys when JavaScript controls are disabled#40602

Merged
rusackas merged 1 commit into
masterfrom
fix/deckgl-js-control-form-data-stripping
Jun 4, 2026
Merged

fix(deck.gl): strip all JS-executed form_data keys when JavaScript controls are disabled#40602
rusackas merged 1 commit into
masterfrom
fix/deckgl-js-control-form-data-stripping

Conversation

@rusackas
Copy link
Copy Markdown
Member

@rusackas rusackas commented Jun 1, 2026

SUMMARY

The deck.gl chart plugins execute several form_data fields as JavaScript at render time through the frontend sandboxedEval helper. To keep this behavior gated behind the ENABLE_JAVASCRIPT_CONTROLS feature flag (which defaults to off), the backend strips those keys from form_data in get_form_data when the flag is disabled.

The strip list (REJECTED_FORM_DATA_KEYS in superset/views/utils.py) only covered three of the keys:

["js_tooltip", "js_onclick_href", "js_data_mutator"]

However, the Geojson layer also evaluates two more fields via sandboxedEval:

  • label_javascript_config_generator
  • icon_javascript_config_generator

(see plugins/preset-chart-deckgl/src/layers/Geojson/Geojson.tsx and the legacy legacy-preset-chart-deckgl equivalent). Because these two were not in the strip list, they were retained in form_data and executed client-side even when ENABLE_JAVASCRIPT_CONTROLS is disabled — bypassing the intended gate for those fields.

This change:

  • Adds the two missing keys to the strip list.
  • Centralizes the full set of JS-executed keys in a named JS_CONTROL_FORM_DATA_KEYS constant, with a comment noting it must stay in sync with the sandboxedEval(fd.<key>) call sites in the deck.gl plugins.
  • Adds unit tests asserting that every JS-executed key is rejected when the flag is off, which also guards against future call sites being added without updating the list.

No behavior change when ENABLE_JAVASCRIPT_CONTROLS is enabled.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — backend form_data handling.

TESTING INSTRUCTIONS

pytest tests/unit_tests/views/test_utils.py
  • test_rejected_form_data_keys_cover_all_js_control_keys — every JS-executed key is in the strip list when the flag is off.
  • test_get_form_data_strips_js_control_keysget_form_data drops all of them and preserves non-JS keys.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Jun 1, 2026

Code Review Agent Run #498998

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: c7178f7..c7178f7
    • superset/views/utils.py
    • tests/unit_tests/views/test_utils.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

@dosubot dosubot Bot added change:backend Requires changing the backend viz:charts:deck.gl Related to deck.gl charts labels Jun 1, 2026
@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.03%. Comparing base (8dcc7e7) to head (7761ab2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #40602   +/-   ##
=======================================
  Coverage   64.03%   64.03%           
=======================================
  Files        2663     2663           
  Lines      143619   143620    +1     
  Branches    33030    33030           
=======================================
+ Hits        91973    91974    +1     
  Misses      50044    50044           
  Partials     1602     1602           
Flag Coverage Δ
hive 39.67% <100.00%> (+<0.01%) ⬆️
mysql 58.39% <100.00%> (+<0.01%) ⬆️
postgres 58.46% <100.00%> (+<0.01%) ⬆️
presto 41.26% <100.00%> (+<0.01%) ⬆️
python 59.94% <100.00%> (+<0.01%) ⬆️
sqlite 58.09% <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 Harness.
📢 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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 7761ab2
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a21ad4103a47200084a6421
😎 Deploy Preview https://deploy-preview-40602--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.

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

This PR fixes a feature-flag gating gap for deck.gl chart plugins by ensuring all form_data fields that are executed via sandboxedEval are stripped server-side when ENABLE_JAVASCRIPT_CONTROLS is disabled (the default), preventing unintended client-side execution.

Changes:

  • Introduces JS_CONTROL_FORM_DATA_KEYS in superset/views/utils.py and uses it to populate REJECTED_FORM_DATA_KEYS when JavaScript controls are disabled.
  • Expands the rejected/stripped key set to include Geojson layer’s label_javascript_config_generator and icon_javascript_config_generator.
  • Adds unit tests verifying (a) the rejected list covers all JS-executed keys and (b) get_form_data strips them while preserving non-JS keys.

Reviewed changes

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

File Description
superset/views/utils.py Centralizes the set of JS-evaluated form_data keys and strips them when ENABLE_JAVASCRIPT_CONTROLS is off.
tests/unit_tests/views/test_utils.py Adds regression tests to ensure all JS-executed keys are rejected/stripped under the default (disabled) feature flag.

@sha174n sha174n added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Jun 4, 2026
…re off

The deck.gl charts execute several form_data fields as JavaScript at render
time via the frontend sandboxedEval helper. The backend strips these keys from
form_data when ENABLE_JAVASCRIPT_CONTROLS is disabled (the default), but the
strip list only covered js_tooltip, js_onclick_href and js_data_mutator.

The Geojson layer also evaluates label_javascript_config_generator and
icon_javascript_config_generator, which were not in the strip list, so those
two fields were preserved in form_data even with the flag disabled.

Add both keys to the strip list and centralize the JS-executed keys in a named
constant kept in sync with the sandboxedEval call sites. Add unit tests
asserting every JS-executed key is rejected when the flag is off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas rusackas force-pushed the fix/deckgl-js-control-form-data-stripping branch from c7178f7 to 7761ab2 Compare June 4, 2026 16:52
@rusackas rusackas merged commit 23d1874 into master Jun 4, 2026
65 checks passed
@rusackas rusackas deleted the fix/deckgl-js-control-form-data-stripping branch June 4, 2026 17:14
@github-project-automation github-project-automation Bot moved this from Needs Review to Approved and/or Merged in Superset Review Help Wanted Jun 4, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:backend Requires changing the backend merge-if-green If approved and tests are green, please go ahead and merge it for me size/M viz:charts:deck.gl Related to deck.gl charts

Projects

Status: Approved and/or Merged

Development

Successfully merging this pull request may close these issues.

4 participants