Skip to content

fix(schemas): tighten guest dataset fields, external_url protocols, ssh creds, prophet bounds - #40640

Merged
rusackas merged 6 commits into
masterfrom
fix/schema-output-and-input-hardening
Jun 10, 2026
Merged

rusackas merged 6 commits into
masterfrom
fix/schema-output-and-input-hardening

Conversation

@rusackas

@rusackas rusackas commented Jun 2, 2026

Copy link
Copy Markdown
Member

SUMMARY

This PR applies four small, independent schema-hardening fixes:

  1. Guest dataset field filtering (superset/dashboards/schemas.py):
    DashboardDatasetSchema.post_dump previously removed only owners and
    database for guest users. It now also removes sql, select_star,
    perm, edit_url, fetch_values_predicate and template_params, so
    guest tokens never receive internal connection or query details. Removal
    is guarded with pop(..., None) for absent keys.

  2. External URL protocol validation (superset/charts/schemas.py,
    superset/dashboards/schemas.py): the external_url field accepted any
    string. A reusable validate_external_url validator (in
    superset/utils/schema.py) now restricts accepted values to http/https
    schemes, rejecting javascript:, data:, vbscript:, etc. Empty/None
    values remain allowed since the field is optional. external_url on these
    externally-managed objects is always an absolute URL, so requiring an
    http(s) scheme is safe.

  3. SSH tunnel credential output-safety (superset/databases/schemas.py):
    password, private_key and private_key_password on DatabaseSSHTunnel
    are now load_only=True — accepted on input but never serialized in
    responses. Verified that every response path which surfaces these to the
    client does so via explicit masking (SSHTunnel.data and
    mask_password_info in superset/databases/api.py), which overwrites or
    bypasses the schema's own dump. The masked-placeholder UX is therefore
    unaffected; load_only only prevents the schema from ever emitting raw
    values on its own.

  4. Prophet periods bound (superset/charts/schemas.py):
    ChartDataProphetOptionsSchema.periods lacked an upper bound. It now
    validates 1 <= periods <= MAX_PROPHET_PERIODS, where the max is read from
    a new MAX_PROPHET_PERIODS config (default 10000, added to
    superset/config.py). confidence_interval already had a bound.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — backend schema changes only.

TESTING INSTRUCTIONS

Run the schema unit tests:

python -m pytest tests/unit_tests/charts/test_schemas.py \
  tests/unit_tests/dashboards/schema_tests.py \
  tests/unit_tests/databases/schema_tests.py -q

New tests cover: guest filtering removes the new fields (and non-guests keep
them); external_url rejects javascript:/data:/vbscript: and accepts
https; prophet periods over max and below min raise ValidationError while
valid values pass; SSH tunnel credential fields load but never dump.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

🤖 Generated with Claude Code

@bito-code-review

bito-code-review Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #fcbf24

Actionable Suggestions - 0
Additional Suggestions - 2
  • tests/unit_tests/databases/schema_tests.py - 1
    • Incomplete test assertions · Line 383-411
      Test only verifies `server_address` in dumped output but omits assertions for `server_port` and `username`. Per BITO.md rule [6262], tests should verify the complete behavior they claim to test. Missing assertions for these non-credential fields could allow a regression (e.g., accidentally making them `load_only`) to go undetected.
  • tests/unit_tests/dashboards/schema_tests.py - 1
    • Incomplete URL scheme coverage · Line 75-84
      The test `test_dashboard_external_url_accepts_https` only validates HTTPS but does not test HTTP, which is also an allowed scheme per `validate_external_url` (lines 74-75 in `superset/utils/schema.py`). Add `test_dashboard_external_url_accepts_http` that asserts `schema.load({"dashboard_title": "test", "external_url": "http://example.com/managed"})` succeeds and preserves the URL.
Review Details
  • Files reviewed - 8 · Commit Range: f2be49e..f2be49e
    • superset/charts/schemas.py
    • superset/config.py
    • superset/dashboards/schemas.py
    • superset/databases/schemas.py
    • superset/utils/schema.py
    • tests/unit_tests/charts/test_schemas.py
    • tests/unit_tests/dashboards/schema_tests.py
    • tests/unit_tests/databases/schema_tests.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

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

Comment thread superset/charts/schemas.py Resolved
Comment thread superset/utils/schema.py Resolved
@codecov

codecov Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.12%. Comparing base (9105adc) to head (744701f).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
superset/charts/schemas.py 35.29% 11 Missing ⚠️
superset/utils/schema.py 33.33% 8 Missing ⚠️
superset/dashboards/schemas.py 72.72% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40640      +/-   ##
==========================================
+ Coverage   64.07%   64.12%   +0.05%     
==========================================
  Files        2653     2653              
  Lines      143602   143646      +44     
  Branches    33132    33140       +8     
==========================================
+ Hits        92008    92115     +107     
+ Misses      49979    49913      -66     
- Partials     1615     1618       +3     
Flag Coverage Δ
hive 39.50% <43.63%> (-0.01%) ⬇️
mysql 58.23% <54.54%> (-0.02%) ⬇️
postgres 58.29% <54.54%> (?)
presto 41.09% <43.63%> (-0.01%) ⬇️
python 59.77% <54.54%> (+0.11%) ⬆️
sqlite 57.92% <54.54%> (-0.02%) ⬇️
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 hardens several backend Marshmallow schemas to reduce accidental exposure of sensitive fields and to enforce safer/bounded inputs for externally managed objects and Prophet post-processing options.

Changes:

  • Strip additional dataset fields from guest-user dashboard dataset responses to avoid leaking internal query/connection details.
  • Add a reusable external_url validator to restrict schemes to http/https and apply it to chart/dashboard schemas.
  • Prevent SSH tunnel credentials from ever being serialized by schemas (load_only=True) and bound Prophet periods with a configurable maximum.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit_tests/databases/schema_tests.py Adds coverage ensuring SSH tunnel credential fields load but never dump.
tests/unit_tests/dashboards/schema_tests.py Adds coverage for guest dataset field stripping and external_url scheme validation.
tests/unit_tests/charts/test_schemas.py Adds coverage for Prophet periods bounds and chart external_url scheme validation.
superset/utils/schema.py Introduces validate_external_url restricting schemes to http/https.
superset/databases/schemas.py Marks SSH tunnel credential fields as load_only to prevent serialization.
superset/dashboards/schemas.py Expands guest-user dataset field removal and validates external_url.
superset/config.py Adds MAX_PROPHET_PERIODS configuration default.
superset/charts/schemas.py Adds bounded validation for Prophet periods and validates external_url.

Comment thread superset/charts/schemas.py Resolved
@bito-code-review

bito-code-review Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #4d43a1

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/dashboards/schemas.py - 1
    • Missing test coverage for DashboardCopySchema · Line 481-485
      `DashboardCopySchema` at line 481 applies `validate=validate_css` but the test suite does not cover it. The `DashboardCopySchema` has no corresponding test like `test_dashboard_copy_css_rejects_dangerous_constructs`, leaving a gap in test coverage that could allow regressions.
      Code suggestion
      --- a/tests/unit_tests/dashboards/schema_tests.py
      +++ b/tests/unit_tests/dashboards/schema_tests.py
       @@ -143,3 +143,12 @@ def test_dashboard_put_css_rejects_dangerous_constructs() -> None:
            with pytest.raises(ValidationError) as exc_info:
                schema.load({"css": "div { width: expression(alert(1)); }"})
            assert "css" in exc_info.value.messages
      +
      +
      +def test_dashboard_copy_css_rejects_dangerous_constructs() -> None:
      +    """The copy schema applies the same CSS hardening."""
      +    from superset.dashboards.schemas import DashboardCopySchema
      +
      +    schema = DashboardCopySchema()
      +    with pytest.raises(ValidationError) as exc_info:
      +        schema.load({"css": "div { width: expression(alert(1)); }"})
      +    assert "css" in exc_info.value.messages
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/dashboards/schemas.py - 1
Review Details
  • Files reviewed - 2 · Commit Range: f2be49e..9a35374
    • tests/unit_tests/dashboards/schema_tests.py
    • superset/dashboards/schemas.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas force-pushed the fix/schema-output-and-input-hardening branch from 9a35374 to ce27878 Compare June 3, 2026 09:34
@bito-code-review

bito-code-review Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #7a1143

Actionable Suggestions - 0
Additional Suggestions - 3
  • superset/charts/schemas.py - 2
    • Missing test coverage for URL validation · Line 283-283
      ChartPutSchema's `external_url` field now validates URLs but has no dedicated test coverage. Existing tests only cover ChartPostSchema. Add parametrized tests for ChartPutSchema similar to test_chart_external_url_accepts_https and test_chart_external_url_rejects_non_http to ensure consistent behavior across all schemas using this field.
    • Missing test coverage for ImportV1ChartSchema · Line 1713-1713
      ImportV1ChartSchema's `external_url` field now validates URLs but lacks dedicated test coverage. Add tests to verify the same behavior as ChartPostSchema tests: accepts http/https URLs and rejects javascript:/data:/vbscript: schemes and hostless URLs.
  • superset/utils/schema.py - 1
    • Missing tests for URL validator · Line 59-85
      The new `validate_external_url` validator lacks unit tests. Adaptive rule [11730] requires comprehensive unit tests for new features covering success paths, error scenarios, validation failures, and edge cases. The analogous `validate_json` validator has tests in `tests/integration_tests/utils_tests.py:test_schema_validate_json`; follow that pattern. Without tests, edge cases like malformed URLs may go undetected.
Review Details
  • Files reviewed - 8 · Commit Range: 9b4b290..a5b8577
    • superset/charts/schemas.py
    • superset/config.py
    • superset/dashboards/schemas.py
    • superset/databases/schemas.py
    • superset/utils/schema.py
    • tests/unit_tests/charts/test_schemas.py
    • tests/unit_tests/dashboards/schema_tests.py
    • tests/unit_tests/databases/schema_tests.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas
rusackas requested a review from aminghadersohi June 8, 2026 16:29
@rusackas rusackas added the maintain Tracked for ongoing maintenance — keep open label Jun 8, 2026

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR #40640 — fix(schemas): tighten guest dataset fields, external_url protocols, ssh creds, prophet bounds
HEAD SHA: a5b8577

Scan Coverage — 19 scans run on all changed Python

Files: superset/utils/schema.py (+33), superset/charts/schemas.py (+43),
superset/dashboards/schemas.py (+67), superset/databases/schemas.py (+6),
superset/config.py (+4), plus all three new test files

Scan 1 (inline imports): 0 violations
Scan 2 (config.get with defaults): 1 match — get_max_prophet_periods uses
.config.get() with explicit fallback for
an optional config key; intentional, NIT only
Scan 3 (f-string logging): 0 violations
Scan 4 (broad exception handling): 0 violations — RuntimeError and
(TypeError, ValueError) are specific
Scan 5 (sensitive info in errors): 0 violations
Scan 6 (mutable module globals): 1 match — ALLOWED_URL_SCHEMES is a
mutable set; NIT only
Scan 7 (print statements): 0 violations
Scan 8 (db.session.commit in DAOs): 0 violations
Scan 9 (JWT without verification): 0 violations
Scan 10 (hardcoded values): 0 violations
Scan 11 (missing test type hints): 0 violations — all test functions -> None
Scan 12 (Any type usage): 0 violations in new code
Scan 13 (module-level app context): 0 violations — all current_app access
wrapped in try/except RuntimeError
Scan 14 (SQL injection / RLS bypass): 0 violations
Scan 15 (private symbol imports): 0 violations
Scan 16 (or-default collapsing falsy): 0 violations
Scan 17 (compound boolean sans parens): 0 violations
Scan 18 (migration boolean-filter risk): 0 violations — no migrations
Scan 19 (async HTTP without timeout): 0 violations


Security walk-through

validate_external_url — allowlist-based ({"http","https"}), fails closed on all
other schemes. urlparse normalises scheme to lowercase before the explicit .lower()
call; both checks are redundant but harmless. Correctly rejects javascript:,
data:, vbscript:, file:, scheme-relative //evil.com (empty scheme), and
host-less https:foo (netloc check). ✓

validate_prophet_periods — calls get_max_prophet_periods() at request time, not
import time, so the configurable ceiling applies even if the config is set after
module load. Range(min=1) blocks zero and negative periods. Confidence-interval
bound is (0, 1) exclusive, which is mathematically correct. ✓

SSH load_only=True — idiomatic Marshmallow pattern; prevents raw credential
values appearing in any schema dump path. PR description confirms the masked-
placeholder UI goes through SSHTunnel.data / mask_password_info directly, not
through schema dump. ✓

Guest dataset field stripping — six new sensitive fields (sql, select_star,
perm, edit_url, fetch_values_predicate, template_params) stripped via safe
.pop(key, None). ✓

validate_css — four patterns (expression(), script-scheme URI, @import,
url(+script-scheme)), case-insensitive, no ReDoS risk (no nested quantifiers). ✓


BLOCKER

None.

HIGH

None.

MEDIUM

[superset/dashboards/schemas.py:141] validate_css matches raw strings without CSS
escape expansion. url(\6a avascript:alert(1)) (CSS hex-encode of 'j') passes the
regex but a CSS parser expands the escape. Modern browsers do not execute JavaScript
via CSS url() background properties, so this is not an immediately exploitable
vector, and the docstring correctly labels this "lightweight input hardening". A
one-line note would prevent future maintainers from treating the validator as
comprehensive and removing other defences.
Suggestion: add to the docstring body: "CSS escape sequences (e.g. \\6a avascript:) are not expanded before matching; this validator is a first-line
filter, not a complete XSS sanitiser."

[superset/dashboards/schemas.py:360–361] Pre-existing (not introduced by this PR):
del serialized["owners"] / del serialized["database"] raise KeyError for a
dataset object whose database or owners attribute is absent from the Marshmallow
dump (Marshmallow omits Nested/List keys when the attribute is absent and no
dump_default is set). The six new fields in this same PR correctly use .pop(key, None), so there is a visible inconsistency in the same function body.
Suggestion: serialized.pop("owners", None) / serialized.pop("database", None)
to match the pattern used immediately below.

NIT

[superset/utils/schema.py:24] ALLOWED_URL_SCHEMES = {"http", "https"} — using
frozenset would signal immutability and prevent accidental mutation.

[tests/unit_tests/charts/test_schemas.py] test_chart_external_url_rejects_non_absolute
covers "https://" (empty host) but not "//evil.com" (scheme-relative, scheme="").
The code rejects it correctly but no test confirms this specific attack vector.

[tests/unit_tests/dashboards/schema_tests.py] validate_css is wired to
DashboardCopySchema (schemas.py:445) but only DashboardPostSchema and
DashboardPutSchema have CSS-rejection tests. DashboardCopySchema is untested.


0 BLOCKER · 0 HIGH · 2 MEDIUM · 3 NIT
CI: 22 success, 0 failures, 6 skipped, 2 neutral
mergeable=true, mergeable_state=blocked (needs approval only)
Labels: size/L, maintain — no hold label

claude and others added 4 commits June 9, 2026 09:19
…sh creds, prophet bounds

Several schema-hardening improvements:

- DashboardDatasetSchema: guest users no longer receive sql, select_star,
  perm, edit_url, fetch_values_predicate or template_params in addition to
  the previously removed owners/database.
- external_url fields on chart and dashboard schemas now reject any scheme
  other than http/https via a reusable validate_external_url validator.
- DatabaseSSHTunnel credential fields (password, private_key,
  private_key_password) are marked load_only so they are accepted on input
  but never serialized in responses; masked response paths are unaffected.
- ChartDataProphetOptionsSchema.periods now has an upper bound read from the
  new MAX_PROPHET_PERIODS config (default 10000).

Adds unit tests covering each behavior.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add `from typing import Any` and use `dict[str, Any]` return type on
`_dataset_payload()` to satisfy the `type-arg` mypy rule.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The dashboard `css` field is user-supplied and persisted verbatim, then
re-served into the dashboard page. Add a lightweight marshmallow validator
that rejects known-dangerous CSS constructs (expression(), script-scheme
URIs, @import, and url() pointing at a script scheme) while leaving ordinary
styling -- including image/relative/data: url() references -- untouched.

Applied to the Post, Put, and Copy dashboard schemas. Covered by unit tests
that assert legitimate CSS passes and dangerous constructs are rejected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…_url

Address review feedback:
- get_max_prophet_periods now coerces the config value to int (handling
  string overrides such as os.getenv) and falls back to the default for
  invalid or non-positive values, avoiding a TypeError in Range.
- validate_prophet_periods captures the configured max once.
- validate_external_url now requires a non-empty netloc so hostless values
  like 'https:foo' are rejected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rusackas
rusackas force-pushed the fix/schema-output-and-input-hardening branch from a5b8577 to dca4967 Compare June 9, 2026 16:19
@rusackas rusackas added the merge-if-green If approved and tests are green, please go ahead and merge it for me label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Translation Regression Detected

A source change in this PR renamed or reworded strings, invalidating existing translations (they are now #, fuzzy) in ar, ca, cs, de, fi, fr, ja, lv, mi, nl, ru, sk, sl, th, uk. Please resolve the affected .po files before merging.

Note: intentionally deleting a translatable string is not a regression and is not flagged here — only translations invalidated by a renamed/reworded source string are.

Language Fuzzy before Fuzzy after New
ar 1139 1140 +1
ca 818 819 +1
cs 790 791 +1
de 1000 1001 +1
fi 4826 4827 +1
fr 1017 1018 +1
ja 325 326 +1
lv 298 299 +1
mi 810 811 +1
nl 1146 1147 +1
ru 296 297 +1
sk 777 778 +1
sl 966 967 +1
th 4826 4827 +1
uk 296 297 +1

How to fix

1. Install dependencies (if not already set up):

pip install -r superset/translations/requirements.txt
sudo apt-get install gettext   # or: brew install gettext

2. Re-extract strings and sync .po files:

./scripts/translations/babel_update.sh

This rewrites superset/translations/messages.pot from the current source files and merges the changes into every .po file. Strings whose msgid changed will be marked #, fuzzy.

3. Resolve the fuzzy entries in the affected language files (ar, ca, cs, de, fi, fr, ja, lv, mi, nl, ru, sk, sl, th, uk):

grep -n '#, fuzzy' superset/translations/<lang>/LC_MESSAGES/messages.po

For each fuzzy entry, either rewrite the msgstr to match the new string and remove the #, fuzzy line, or clear the msgstr to "" if you cannot provide a translation.

4. Commit your changes to the .po files.

The new Prophet `periods` validation message is close enough to existing
translated strings that pybabel fuzzy-matches it onto them, which the
translation-regression check flags as an invalidated translation. Add the
new msgid to the .pot and per-locale catalogs as an untranslated entry so
pybabel finds an exact match and no longer marks an existing translation
fuzzy.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@rusackas
rusackas requested a review from sfirke as a code owner June 9, 2026 16:39
@github-actions github-actions Bot added i18n:chinese Translation related to Chinese language i18n:japanese Translation related to Japanese language i18n:russian Translation related to Russian language i18n:korean Translation related to Korean language i18n:dutch i18n:slovak i18n:ukrainian i18n:portuguese i18n:brazilian i18n:traditional-chinese i18n:persian i18n:czech i18n:latvian labels Jun 9, 2026

@bito-code-review bito-code-review Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review Agent Run #a0dd3d

Actionable Suggestions - 5
  • superset/translations/ru/LC_MESSAGES/messages.po - 1
  • superset/translations/es/LC_MESSAGES/messages.po - 1
  • superset/translations/fr/LC_MESSAGES/messages.po - 1
  • superset/translations/ja/LC_MESSAGES/messages.po - 1
  • superset/translations/mi/LC_MESSAGES/messages.po - 1
Additional Suggestions - 11
  • superset/utils/schema.py - 1
    • Missing unit tests for validator · Line 59-85
      The `validate_external_url` function lacks direct unit tests. Existing tests in `test_schemas.py` exercise the validator indirectly through schema loading, but don't test the validator function in isolation. Per BITO.md rule [11730], new tools/validators should have dedicated unit tests covering success paths, error scenarios, and edge cases.
  • superset/translations/de/LC_MESSAGES/messages.po - 1
    • Missing German translation · Line 17799-17800
      The German `msgstr` is empty. German users will see the untranslated English error message "`periods` must be between 1 and %(max)s" when Prophet validation fails. Provide a German translation maintaining the `%(max)s` format placeholder.
      Code suggestion
      --- a/superset/translations/de/LC_MESSAGES/messages.po
      +++ b/superset/translations/de/LC_MESSAGES/messages.po
       @@ -17797,6 +17797,7 @@ msgstr "'operation'-Eigenschaft des Nachbearbeitungsobjekts undefiniert"
       
        #, python-format
        msgid "`periods` must be between 1 and %(max)s"
      -msgstr ""
      +msgstr "Der Wert für \`periods\` muss zwischen 1 und %(max)s liegen"
       
        msgid "`prophet` package not installed"
  • superset/translations/lv/LC_MESSAGES/messages.po - 1
    • Missing translation string · Line 17007-17007
      The `msgstr` is empty, leaving Latvian users with untranslated English text. Provide the Latvian translation while preserving the `%(max)s` format variable as indicated by the `# python-format` comment.
      Code suggestion
       @@ -17005,3 +17005,3 @@
        #, python-format
        msgid "`periods` must be between 1 and %(max)s"
      -msgstr ""
      +msgstr "`periods` jābūt starp 1 un %(max)s"
  • superset/translations/th/LC_MESSAGES/messages.po - 1
    • Empty Thai translation entry · Line 30105-30105
      The Thai translation for "`periods` must be between 1 and %(max)s" is empty (line 30105). Thai users will see raw English error text instead of a localized message. Similar messages in this file (e.g., confidence_interval on line 30081) have Thai translations. This empty `msgstr` defeats the purpose of i18n for the period validation error in Prophet charts.
  • superset/translations/pl/LC_MESSAGES/messages.po - 1
    • Missing Polish translation · Line 18192-18192
      The `msgstr` is empty for this validation error message. Polish users will see the untranslated English text when this error is triggered. Compare with similar range validation messages in the same file (e.g., "Przedział ufności musi...") for translation style consistency.
  • superset/translations/zh_TW/LC_MESSAGES/messages.po - 1
    • Missing zh_TW translation · Line 17214-17214
      The `msgstr` field is empty, so users with zh_TW locale will see the untranslated English message "`periods` must be between 1 and %(max)s" instead of Chinese. This affects the user experience for Prophet chart validation errors. Compare with similar validation messages in the same file that have proper translations.
  • superset/translations/zh/LC_MESSAGES/messages.po - 1
    • Missing Chinese translation · Line 17199-17201
      Please add a Chinese translation for the new `msgid "`periods` must be between 1 and %(max)s"` entry’s `msgstr`, for example:

      msgstr "预测期数(periods)必须在 1 到 %(max)s 之间"

  • superset/translations/sl/LC_MESSAGES/messages.po - 1
    • Missing translation for error message · Line 17400-17402
      The translation for "`periods` must be between 1 and %(max)s" is empty. Slovenian-speaking users will see the untranslated English text. When providing the translation, ensure the `%(max)s` placeholder is preserved so the dynamic value is injected correctly at runtime.
  • superset/translations/ko/LC_MESSAGES/messages.po - 1
    • Missing Korean translation · Line 16858-16858
      The `msgstr` is empty, so Korean users will see the untranslated English error message "`periods` must be between 1 and %(max)s" when validation fails. Add a Korean translation to properly localize this user-facing error message.
  • superset/translations/ca/LC_MESSAGES/messages.po - 1
    • Missing Catalan translation · Line 17424-17425
      The `msgstr` is empty, so Catalan users will see the untranslated English error message. Consider adding a Catalan translation following the pattern of other translated messages in this file.
  • superset/translations/ar/LC_MESSAGES/messages.po - 1
    • Missing Arabic translation · Line 17415-17417
      The `msgstr` is empty, so Arabic users will see the English error message '`periods` must be between 1 and %(max)s' instead of a localized message. Consider adding an Arabic translation to complete the internationalization.
Review Details
  • Files reviewed - 35 · Commit Range: a1645af..744701f
    • superset/charts/schemas.py
    • superset/config.py
    • superset/dashboards/schemas.py
    • superset/databases/schemas.py
    • superset/translations/ar/LC_MESSAGES/messages.po
    • superset/translations/ca/LC_MESSAGES/messages.po
    • superset/translations/cs/LC_MESSAGES/messages.po
    • superset/translations/de/LC_MESSAGES/messages.po
    • superset/translations/en/LC_MESSAGES/messages.po
    • superset/translations/es/LC_MESSAGES/messages.po
    • superset/translations/fa/LC_MESSAGES/messages.po
    • superset/translations/fi/LC_MESSAGES/messages.po
    • superset/translations/fr/LC_MESSAGES/messages.po
    • superset/translations/it/LC_MESSAGES/messages.po
    • superset/translations/ja/LC_MESSAGES/messages.po
    • superset/translations/ko/LC_MESSAGES/messages.po
    • superset/translations/lv/LC_MESSAGES/messages.po
    • superset/translations/messages.pot
    • superset/translations/mi/LC_MESSAGES/messages.po
    • superset/translations/nl/LC_MESSAGES/messages.po
    • superset/translations/pl/LC_MESSAGES/messages.po
    • superset/translations/pt/LC_MESSAGES/messages.po
    • superset/translations/pt_BR/LC_MESSAGES/messages.po
    • superset/translations/ru/LC_MESSAGES/messages.po
    • superset/translations/sk/LC_MESSAGES/messages.po
    • superset/translations/sl/LC_MESSAGES/messages.po
    • superset/translations/th/LC_MESSAGES/messages.po
    • superset/translations/tr/LC_MESSAGES/messages.po
    • superset/translations/uk/LC_MESSAGES/messages.po
    • superset/translations/zh/LC_MESSAGES/messages.po
    • superset/translations/zh_TW/LC_MESSAGES/messages.po
    • superset/utils/schema.py
    • tests/unit_tests/charts/test_schemas.py
    • tests/unit_tests/dashboards/schema_tests.py
    • tests/unit_tests/databases/schema_tests.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas

Copy link
Copy Markdown
Member Author

Oh, @rebenitez1802 you might not need to look at this, but it couldn't hurt! Just need a codeowner stamp from @sfirke on this one.

@sfirke sfirke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@sfirke

sfirke commented Jun 10, 2026

Copy link
Copy Markdown
Member

@rusackas this is good to merge. Any reason why this was one omnibus PR instead of 4 smaller ones? It wasn't a problem but these problems don't seem intrinsically related.

@rusackas

Copy link
Copy Markdown
Member Author

@sfirke when the PR list grew north of 100 open ones, some "just combine small things" may have occurred for a moment ;) But now the dust is finally settling.

@rusackas
rusackas merged commit 0a1e51f into master Jun 10, 2026
58 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Approved and/or Merged in Superset Review Help Wanted Jun 10, 2026
@rusackas
rusackas deleted the fix/schema-output-and-input-hardening branch June 10, 2026 01:30
rusackas added a commit to rusackas/superset that referenced this pull request Sep 5, 2026
validate_css (added in apache#40640) blocked expression(), script-scheme
URIs, and @import on dashboard create/update, but two gaps let it
through:

- ImportV1DashboardSchema.css had no validator at all, so a YAML/ZIP
  dashboard import bypassed the check entirely while the create/update
  API paths enforced it. Custom CSS is injected into the page
  unsanitised (injectCustomCss.ts sets style.innerHTML directly), so
  an imported @import genuinely executes at render.
- DashboardPutSchema.css re-validated on every PUT, and a dashboard
  save resends the full object (renaming, moving a chart, editing a
  filter all go through the same PUT). A dashboard whose existing css
  already contained @import -- whether from before this check existed,
  or via the import bypass above -- became uneditable for any change,
  not just a change to css.

This adds validate_css to the import schema to close the bypass, and
moves PUT-path enforcement from the schema to UpdateDashboardCommand,
which only validates css when the incoming value actually differs
from what's stored. New css, or css changed to a different dangerous
value, is still rejected exactly as before.
rusackas added a commit to rusackas/superset that referenced this pull request Sep 11, 2026
validate_css (added in apache#40640) blocked expression(), script-scheme
URIs, and @import on dashboard create/update, but two gaps let it
through:

- ImportV1DashboardSchema.css had no validator at all, so a YAML/ZIP
  dashboard import bypassed the check entirely while the create/update
  API paths enforced it. Custom CSS is injected into the page
  unsanitised (injectCustomCss.ts sets style.innerHTML directly), so
  an imported @import genuinely executes at render.
- DashboardPutSchema.css re-validated on every PUT, and a dashboard
  save resends the full object (renaming, moving a chart, editing a
  filter all go through the same PUT). A dashboard whose existing css
  already contained @import -- whether from before this check existed,
  or via the import bypass above -- became uneditable for any change,
  not just a change to css.

This adds validate_css to the import schema to close the bypass, and
moves PUT-path enforcement from the schema to UpdateDashboardCommand,
which only validates css when the incoming value actually differs
from what's stored. New css, or css changed to a different dangerous
value, is still rejected exactly as before.
rusackas added a commit to rusackas/superset that referenced this pull request Sep 16, 2026
validate_css (added in apache#40640) blocked expression(), script-scheme
URIs, and @import on dashboard create/update, but two gaps let it
through:

- ImportV1DashboardSchema.css had no validator at all, so a YAML/ZIP
  dashboard import bypassed the check entirely while the create/update
  API paths enforced it. Custom CSS is injected into the page
  unsanitised (injectCustomCss.ts sets style.innerHTML directly), so
  an imported @import genuinely executes at render.
- DashboardPutSchema.css re-validated on every PUT, and a dashboard
  save resends the full object (renaming, moving a chart, editing a
  filter all go through the same PUT). A dashboard whose existing css
  already contained @import -- whether from before this check existed,
  or via the import bypass above -- became uneditable for any change,
  not just a change to css.

This adds validate_css to the import schema to close the bypass, and
moves PUT-path enforcement from the schema to UpdateDashboardCommand,
which only validates css when the incoming value actually differs
from what's stored. New css, or css changed to a different dangerous
value, is still rejected exactly as before.
rusackas added a commit to rusackas/superset that referenced this pull request Sep 23, 2026
validate_css (added in apache#40640) blocked expression(), script-scheme
URIs, and @import on dashboard create/update, but two gaps let it
through:

- ImportV1DashboardSchema.css had no validator at all, so a YAML/ZIP
  dashboard import bypassed the check entirely while the create/update
  API paths enforced it. Custom CSS is injected into the page
  unsanitised (injectCustomCss.ts sets style.innerHTML directly), so
  an imported @import genuinely executes at render.
- DashboardPutSchema.css re-validated on every PUT, and a dashboard
  save resends the full object (renaming, moving a chart, editing a
  filter all go through the same PUT). A dashboard whose existing css
  already contained @import -- whether from before this check existed,
  or via the import bypass above -- became uneditable for any change,
  not just a change to css.

This adds validate_css to the import schema to close the bypass, and
moves PUT-path enforcement from the schema to UpdateDashboardCommand,
which only validates css when the incoming value actually differs
from what's stored. New css, or css changed to a different dangerous
value, is still rejected exactly as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i18n:brazilian i18n:chinese Translation related to Chinese language i18n:czech i18n:dutch i18n:french Translation related to French language i18n:italian Translation related to Italian language i18n:japanese Translation related to Japanese language i18n:korean Translation related to Korean language i18n:latvian i18n:persian i18n:portuguese i18n:russian Translation related to Russian language i18n:slovak i18n:spanish Translation related to Spanish language i18n:traditional-chinese i18n:ukrainian i18n Namespace | Anything related to localization maintain Tracked for ongoing maintenance — keep open merge-if-green If approved and tests are green, please go ahead and merge it for me size/XL

Projects

No open projects
Status: Approved and/or Merged

Development

Successfully merging this pull request may close these issues.

5 participants