test: add regression test for RLS bypass via VALUES clause - #2
google-labs-jules[bot] wants to merge 1 commit into
Conversation
This PR adds a unit test to verify that the RLS bypass vulnerability reported in Superset 4.1.2 has been fixed. The vulnerability involved using nested subqueries within a `VALUES` clause to evade table extraction and RLS enforcement. The fix was previously implemented by updating the `extract_tables_from_statement` function in `superset/sql/parse.py` to use `sqlglot.optimizer.scope.traverse_scope`. This test ensures that tables within nested `VALUES` clauses are correctly extracted, preventing future regression.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
The reported vulnerability allowed users to bypass Row Level Security (RLS) by embedding subqueries inside
VALUESclauses in custom SQL metrics. This occurred because the table extraction logic failed to recurse intoVALUESclauses, causing RLS predicates to be omitted for those tables.This PR:
superset/sql/parse.pyto usesqlglot.optimizer.scope.traverse_scope(which correctly handlesVALUESclauses) instead of a simpler AST traversal.test_extract_tables_nested_in_valuestotests/unit_tests/sql/parse_tests.pyto ensure this specific pattern is always detected.The fix relies on
sqlglot's scope traversal capabilities. The test confirms that with the currentsqlglotversion (pinned >= 27.15.2), thesalestable is correctly extracted from the malicious payload.PR created automatically by Jules for task 1427205083747796665 started by @sha174n