Repository navigation
Conversation
sha174n
marked this pull request as ready for review
October 6, 2026 09:59
sha174n
requested review from
geido,
michael-s-molina,
msyavuz,
rusackas,
sadpandajoe and
villebro
as code owners
October 6, 2026 09:59
sha174n
marked this pull request as draft
October 6, 2026 09:59
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
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:
|
Contributor
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
sha174n
marked this pull request as ready for review
November 10, 2026 15:11
sha174n
force-pushed
the
feat/configurable-db-dialect-allowlist
branch
from
November 10, 2026 16:27
106e685 to
10ae81e
Compare
…er deployment check_sqlalchemy_uri() blocks a fixed set of SQLAlchemy dialects (sqlite, shillelagh, duckdb) because they can resolve local filesystem paths at query time. Today the only way to relax that is to turn the whole check off via PREVENT_UNSAFE_DB_CONNECTIONS=False, which is all-or-nothing. Add ALLOWED_UNSAFE_DB_DIALECTS, a config set of base dialect names (the part before any "+driver") an operator opts into for their deployment. A listed dialect is accepted; every other entry in the blocklist still applies. Defaults to an empty set, so behaviour is unchanged unless an operator explicitly opts in. No effect when PREVENT_UNSAFE_DB_CONNECTIONS is False, since the check is skipped entirely in that case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The allowlist must not relax the feature-flag-gated superset meta-database block; intersect operator entries with the allowlistable filesystem dialects.
…t allowlist Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sha174n
force-pushed
the
feat/configurable-db-dialect-allowlist
branch
from
November 11, 2026 11:39
d89da14 to
c8fbd6b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
check_sqlalchemy_uri()blocks a fixed set of SQLAlchemy dialects (sqlite,shillelagh,duckdb) because they can resolve local filesystem paths at query time. Today the only lever an operator has to relax that isPREVENT_UNSAFE_DB_CONNECTIONS=False, which disables the whole check. That is all-or-nothing: an operator who deliberately runs duckdb/MotherDuck has to drop the guard for every other dialect too.This PR adds per-dialect granularity. A new config setting lets an operator opt a specific dialect back in while the rest of the blocklist keeps applying.
Mechanism
ALLOWED_UNSAFE_DB_DIALECTS: set[str] = set()(next toPREVENT_UNSAFE_DB_CONNECTIONS). It holds base dialect names, the part of the drivername before any+driver.check_sqlalchemy_uri(), when a blocklist entry matches, the base dialect is compared against the allowlist; if the operator listed it, that one dialect is permitted and the loop moves on. Everything else (thesuperset/ENABLE_SUPERSET_META_DBhandling, the raised error) is unchanged.+driversuffix and surrounding whitespace stripped, soduckdb,DuckDBandduckdb+duckdb_engineall opt in theduckdbdialect (and the MotherDuck cloud URI, which rides the same dialect). ANone/unset value is treated as no allowlist. This mirrors how the blocklist regexes already treat+driversuffixes.sqlite,shillelagh,duckdb, viaALLOWLISTABLE_DIALECTS). The feature-flag-gatedsupersetmeta-database block is deliberately excluded, so this setting cannot be used to bypassENABLE_SUPERSET_META_DB, and a future blocklist entry is not allowlistable unless added on purpose.Backward compatibility
Defaults to an empty set, so behaviour is identical to today unless an operator explicitly opts a dialect in. No effect when
PREVENT_UNSAFE_DB_CONNECTIONSisFalse(the check is skipped entirely in that case). This complements the existing all-or-nothing flag rather than replacing it.TESTING INSTRUCTIONS
tests/integration_tests/security/analytics_db_safety_tests.pyadds coverage through the realcheck_sqlalchemy_uri(no mocking of the check):ALLOWED_UNSAFE_DB_DIALECTSis accepted, including the MotherDuck URI and the+duckdb_enginedriver;ADDITIONAL INFORMATION