Repository navigation
fix: tighten object-level and destination checks across four unrelated endpoints - #44036
Conversation
Code Review Agent Run #5aa31aActionable Suggestions - 0Additional Suggestions - 5
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #44036 +/- ##
========================================
Coverage 80.65% 80.65%
========================================
Files 2942 2942
Lines 175692 175803 +111
Branches 40788 40805 +17
========================================
+ Hits 141705 141800 +95
- Misses 31325 31336 +11
- Partials 2662 2667 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4ec3612 to
309ecaf
Compare
Code Review Agent Run #91b652Actionable Suggestions - 0Additional Suggestions - 4
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #91b652Actionable Suggestions - 0Additional Suggestions - 3
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review Agent Run #a24a1d
Actionable Suggestions - 1
-
superset/security/api.py - 1
- response_403 rejects message kwarg · Line 269-275
Review Details
-
Files reviewed - 4 · Commit Range:
309ecaf..9de81a7- superset/commands/semantic_layer/update.py
- superset/security/api.py
- tests/integration_tests/security/api_tests.py
- tests/unit_tests/commands/semantic_layer/update_test.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- 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
Code Review Agent Run #413136Actionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
…d endpoints Four independent fixes, bundled together for review efficiency (each touches a different subsystem, no shared root cause): - superset/db_engine_specs/base.py, gsheets.py, snowflake.py, config.py: a database's own encrypted_extra.oauth2_client_info sets authorization_request_uri/token_request_uri with no host validation. The token endpoint is POSTed to directly by the server, carrying the connection's client_secret in the body. Validate both endpoint hosts (is_safe_host, matching the existing pattern in db_engine_specs/impala.py's cancel_query and reports/notifications/webhook.py) before use, with an opt-out config flag for legitimately internal identity providers. - superset/security/manager.py: validate_guest_token_resources only checked that a dashboard exists and is embedded, never that the principal minting the token has access to it. A narrower can_grant_guest_token grant (a realistic non-Admin "embedding backend service" role) could mint a valid guest token scoped to any embedded dashboard in the instance. - superset/commands/semantic_layer/update.py: masked configuration fields were restored from the stored value unconditionally, without checking whether other submitted fields also changed. An editor could reveal a masked secret while changing an unrelated field in the same request, persisting the secret against changed configuration. - superset/views/utils.py: get_dashboard_extra_filters resolved a dashboard by id with only a chart-membership check, no access check. Chart reuse across dashboards means chart access doesn't imply dashboard access. Regression tests added for all four; each verified to fail without its corresponding fix and pass with it. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ing gap; tighten semantic layer secret-reveal check The OAuth2 endpoint host check validated the hostname up front but the actual POST could still be redirected to an internal target by the remote server, or reach a different address than validated via DNS rebinding. Route token requests through a peer-validating requester and stop following redirects. Also make the scheme check unconditional (previously skippable via DATABASE_OAUTH2_ALLOW_INTERNAL_HOSTS) and guard urlparse against a bare ValueError on malformed input. Separately, the semantic layer secret-reveal guard used dict.get(key) to detect unchanged fields, which can't distinguish a key that's absent from one explicitly stored as None -- a new None-valued key could slip through as "unchanged" alongside a revealed secret.
…ig changes in semantic layer unmask Review follow-ups (sadpandajoe): - security/api.py: validate_guest_token_resources now raises EmbeddedDashboardAccessDeniedError (a ForbiddenError), but the guest_token endpoint only translated not-found and validation errors, so @safe turned an expected denial into a logged 500. Translate it to 403. - semantic_layer/update.py: the masked-secret guard iterated only submitted keys, so reusing the mask while dropping a stored key slipped through even though the update replaces the stored dictionary wholesale. Removed keys now count as a configuration change too. - Tests for both (unit for the unmask helper, API-level for the 403). Co-Authored-By: Claude Fable 5.1 <[email protected]>
… proxy hardening - security/api.py: FAB 5.x response_403() takes no message, so the 403 mapping raised TypeError and still produced a 500 (caught by the integration test); build the 403 with self.response(403, ...). Also pass the datasets claim into resource validation. - security/manager.py: validate_guest_token_resources now requires the minting principal to be entitled to every datasource the token will grant (or the datasets allowlist), not just to the dashboard: raise_for_access(dashboard=...) is satisfied on a non-RBAC dashboard by access to any one member datasource. Admin/editor/RBAC-viewer callers are covered by the dashboard entitlement itself. Unit tests for all three paths. - commands/database: changing the OAuth2 endpoint URIs inside masked_encrypted_extra while reusing the masked client secret is now refused like any other destination rebind (oauth2_endpoint_rebind_unsafe); tests added, error message extended. - utils/network.py: the protected session ignores environment proxies (trust_env=False): a proxied request bypasses the peer-validating pools, and the peer would be the proxy anyway. Deployments needing a proxy use the documented allow_unsafe_hosts opt-in. Co-Authored-By: Claude Fable 5.1 <[email protected]>
9c7d15b to
6e2fe30
Compare
There was a problem hiding this comment.
Code Review Agent Run #1bb6d0
Actionable Suggestions - 1
-
superset/commands/database/utils.py - 1
- Over-broad endpoint rebind check · Line 141-141
Additional Suggestions - 7
-
superset/utils/network.py - 1
-
Proxy/CA support disabled · Line 155-155`session.trust_env = False` disables HTTP(S)_PROXY/NO_PROXY and REQUESTS_CA_BUNDLE/CURL_CA_BUNDLE for the OAuth2 token requests. The previous `requests.post` honored these, so deployments behind a mandatory proxy or using a private CA for their IdP will now fail the token exchange; the only opt-out (`allow_unsafe_hosts=True`) disables SSRF protection entirely. This is documented, but it is a behavioral regression for proxy/private-CA deployments worth surfacing.
-
-
tests/unit_tests/db_engine_specs/test_base.py - 3
-
Discarded requester mock · Line 1082-1082`_mock_requester(mocker)` is consumed inline as `_mock_requester(mocker).return_value.post`, so the `MagicMock` from `mocker.patch` is only reachable through `mock_post`. These tests therefore cannot assert requester-level behavior (e.g. `assert_called_once_with(allow_unsafe_hosts=False)` as the new redirect tests do). Bind the patch mock to a variable first, then take `.return_value.post`.
-
Helper return type Any · Line 1348-1348`_mock_requester` returns the `MagicMock` produced by `mocker.patch`, but is annotated `-> Any`, discarding type information for all callers; repo rules require explicit return type annotations on helper functions in test files. Annotate it `-> MagicMock` (importing from `unittest.mock`).
-
Untyped mock variables · Line 1453-1453The new tests bind mock variables without type annotations (`is_safe_host` at 1429/1453/1482/1502, `mock_get_requester`/`mock_post` at 1378/1454-1455 and siblings); repo rules require explicit annotations such as `is_safe_host: MagicMock = mocker.patch(...)` on all mock variables in test files.
-
-
superset/views/utils.py - 1
-
Silent access-denial swallow · Line 514-517The new `SupersetSecurityException` guard returns `[]` silently. The deny itself is intentional and unit-tested, but without a log record an operator debugging why warm-up skips dashboard filters for a given user has no trace. `logger` already exists in this module and `security_manager` logs access decisions elsewhere; consider a `logger.warning` with `dashboard.id`/`slice_id` before returning.
-
-
tests/unit_tests/db_engine_specs/test_gsheets.py - 1
-
Unit tests hit real DNS · Line 706-709These tests mock `get_ssrf_safe_requester` but not `is_safe_host`. The new `_validate_oauth2_endpoint_host` call in `get_oauth2_token`/`get_oauth2_fresh_token` invokes `is_safe_host('oauth2.googleapis.com')`, which does a real `socket.getaddrinfo` lookup. That makes the unit tests depend on external DNS and fail in offline/restricted CI or if DNS returns a non-public IP. Patch `is_safe_host` (or `_validate_oauth2_endpoint_host`) to keep them hermetic.
-
-
superset/commands/database/utils.py - 1
-
Duplicated endpoint field list · Line 138-142`OAUTH2_ENDPOINT_FIELDS` duplicates the endpoint names already enumerated in `_handle_oauth2` (update.py:154-155: `authorization_request_uri`, `token_request_uri`). Two copies of the endpoint field set must be kept in sync; adding an endpoint to one without the other silently changes purge vs. rebind behavior. Consider a single shared constant.
-
Filtered by Review Rules
Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
-
superset/config.py - 1
- CWE-918: SSRF Opt-Out Flag Bypass · Line 2783-2790
Review Details
-
Files reviewed - 24 · Commit Range:
ae5d127..6e2fe30- superset/commands/database/exceptions.py
- superset/commands/database/update.py
- superset/commands/database/utils.py
- superset/commands/semantic_layer/update.py
- superset/config.py
- superset/db_engine_specs/base.py
- superset/db_engine_specs/gsheets.py
- superset/db_engine_specs/snowflake.py
- superset/security/api.py
- superset/security/manager.py
- superset/utils/network.py
- superset/views/utils.py
- tests/integration_tests/security/api_tests.py
- tests/unit_tests/commands/databases/utils_test.py
- tests/unit_tests/commands/semantic_layer/update_test.py
- tests/unit_tests/db_engine_specs/test_base.py
- tests/unit_tests/db_engine_specs/test_databricks.py
- tests/unit_tests/db_engine_specs/test_databricks_multi_cloud.py
- tests/unit_tests/db_engine_specs/test_gsheets.py
- tests/unit_tests/db_engine_specs/test_snowflake.py
- tests/unit_tests/db_engine_specs/test_trino.py
- tests/unit_tests/security/manager_test.py
- tests/unit_tests/utils/test_network.py
- tests/unit_tests/views/test_utils.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- 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
…d endpoints (#44036) Co-authored-by: Claude Sonnet 5 <[email protected]> (cherry picked from commit 7dd70ea)
Picks up the parameterized annotation-chart error message and the reworded connection-move message from #44036.
`babel_update.sh` output was stale on this branch in two ways: this PR's own geographic strings were added to messages.pot by hand, unwrapped and never propagated into the per-language catalogs, and merging master brought in a source string (apache#44036) whose changed text had not been re-extracted. Regenerating fixes both, so `check_pot_drift.py` passes. Co-Authored-By: Claude Opus 5 <[email protected]>
SUMMARY
Four independent fixes, bundled into one PR for review efficiency (each touches a different subsystem, no shared root cause):
superset/db_engine_specs/base.py,gsheets.py,snowflake.py,config.py— a database's ownencrypted_extra.oauth2_client_infosetsauthorization_request_uri/token_request_uriwith no host validation. The token endpoint is POSTed to directly by the server, carrying the connection'sclient_secretin the body. Validates both endpoint hosts (is_safe_host, matching the existing pattern indb_engine_specs/impala.py'scancel_queryandreports/notifications/webhook.py) before use, with an opt-out config flag (DATABASE_OAUTH2_ALLOW_INTERNAL_HOSTS) for legitimately internal identity providers.superset/security/manager.py—validate_guest_token_resourcesonly checked that a dashboard exists and is embedded, never that the principal minting the token actually has access to it. Adds araise_for_access(dashboard=...)check.superset/commands/semantic_layer/update.py— masked configuration fields were restored from the stored value unconditionally, without checking whether other submitted fields also changed in the same request. Refuses to reveal a masked field when anything else in the payload differs from what's stored.superset/views/utils.py—get_dashboard_extra_filtersresolved a dashboard by id with only a chart-membership check, no access check. Chart reuse across dashboards means chart access doesn't imply dashboard access. Adds araise_for_access(dashboard=...)check, failing closed to an empty filter list.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend-only changes, no UI impact.
TESTING INSTRUCTIONS
Regression tests added for all four; each was verified to fail without its corresponding fix and pass with it.
2718 passed, 1 skipped.
ADDITIONAL INFORMATION