Skip to content

test: add regression test for RLS bypass via VALUES clause - #2

Draft
google-labs-jules[bot] wants to merge 1 commit into
masterfrom
verify-rls-bypass-fix-1427205083747796665
Draft

google-labs-jules[bot] wants to merge 1 commit into
masterfrom
verify-rls-bypass-fix-1427205083747796665

Conversation

@google-labs-jules

Copy link
Copy Markdown

The reported vulnerability allowed users to bypass Row Level Security (RLS) by embedding subqueries inside VALUES clauses in custom SQL metrics. This occurred because the table extraction logic failed to recurse into VALUES clauses, causing RLS predicates to be omitted for those tables.

This PR:

  1. Confirms the vulnerability is fixed in the current codebase.
  2. Identifies that the fix was achieved by switching the table extraction logic in superset/sql/parse.py to use sqlglot.optimizer.scope.traverse_scope (which correctly handles VALUES clauses) instead of a simpler AST traversal.
  3. Adds a regression test test_extract_tables_nested_in_values to tests/unit_tests/sql/parse_tests.py to ensure this specific pattern is always detected.

The fix relies on sqlglot's scope traversal capabilities. The test confirms that with the current sqlglot version (pinned >= 27.15.2), the sales table is correctly extracted from the malicious payload.


PR created automatically by Jules for task 1427205083747796665 started by @sha174n

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.
@google-labs-jules

Copy link
Copy Markdown
Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants