Conversation
Extracts logic from feat/rls-filter-parsing-improvement branch to correctly apply RLS clause validations. Addressed issues with running the logic by testing the newly extracted functions via isolated tests in parse_tests.py. Ensures no ad-hoc SQL query failures. Co-authored-by: sha174n <105581038+sha174n@users.noreply.github.com>
|
👋 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. |
This commit addresses a vulnerability where users could inject malicious subqueries through Row-Level Security (RLS) filters. Key changes: - Added validate_rls_clause to superset/models/helpers.py to ensure RLS fragments do not contain subqueries or DML mutations. - Upgraded SQLStatement.has_subquery inside superset/sql/parse.py to explicitly detect nested subqueries and DML statements (UPDATE, DELETE, INSERT, MERGE) via an AST walker. - Integrated the validation explicitly at the execution layer in superset/connectors/sqla/models.py (BaseDatasource.get_sqla_row_level_filters) for both standard and guest RLS rules. - Added API/Command-level validations in CreateRLSRuleCommand and UpdateRLSRuleCommand to ensure bad rules cannot be created in the first place. - Wrote unit tests in tests/unit_tests/sql/parse_tests.py verifying RLS clause parsing. Co-authored-by: sha174n <105581038+sha174n@users.noreply.github.com>
This commit addresses a vulnerability where users could inject malicious subqueries through Row-Level Security (RLS) filters. Key changes: - Added validate_rls_clause to superset/models/helpers.py to ensure RLS fragments do not contain subqueries or DML mutations. - Upgraded SQLStatement.has_subquery inside superset/sql/parse.py to explicitly detect nested subqueries and DML statements (UPDATE, DELETE, INSERT, MERGE) via an AST walker. - Integrated the validation explicitly at the execution layer in superset/connectors/sqla/models.py (BaseDatasource.get_sqla_row_level_filters) for both standard and guest RLS rules. - Added API/Command-level validations in CreateRLSRuleCommand and UpdateRLSRuleCommand to ensure bad rules cannot be created in the first place, and mapped RLSRuleInvalidError in row_level_security/api.py - Wrote unit tests in tests/unit_tests/sql/parse_tests.py verifying RLS clause parsing. Co-authored-by: sha174n <105581038+sha174n@users.noreply.github.com>
This commit fixes a vulnerability where administrators could embed subqueries and DML statements into RLS filters, which could lead to data leakage or manipulation. We enforce this validation using `validate_rls_clause` in the `superset/connectors/sqla/models.py` layer and in the security command/API validations. It also introduces new robust AST-walking checks in `superset/sql/parse.py` for specific AST node mutation types (UPDATE, DELETE, MERGE, INSERT) that `sqlglot` classifies outside of typical `SELECT` or `COMMAND` structures. Includes targeted unit tests ensuring RLS blocks subqueries correctly. Co-authored-by: sha174n <105581038+sha174n@users.noreply.github.com>
This commit fixes a vulnerability where administrators could embed subqueries and DML statements into RLS filters, which could lead to data leakage or manipulation. We enforce this validation using `validate_rls_clause` in the `superset/connectors/sqla/models.py` layer and in the security command/API validations. It also introduces new robust AST-walking checks in `superset/sql/parse.py` for specific AST node mutation types (UPDATE, DELETE, MERGE, INSERT) that `sqlglot` classifies outside of typical `SELECT` or `COMMAND` structures. Includes targeted unit tests ensuring RLS blocks subqueries correctly. Co-authored-by: sha174n <105581038+sha174n@users.noreply.github.com>
This commit addresses the reported vulnerability where users could inject malicious subqueries through Row-Level Security (RLS) filters.
Key changes:
validate_rls_clausetosuperset/models/helpers.pyto ensure RLS fragments do not contain subqueries or DML mutations.SQLStatement.has_subqueryinsidesuperset/sql/parse.pyto explicitly detect nested subqueries and DML statements (UPDATE,DELETE,INSERT,MERGE) via an AST walker.superset/connectors/sqla/models.py(BaseDatasource.get_sqla_row_level_filters) for both standard and guest RLS rules.CreateRLSRuleCommandandUpdateRLSRuleCommandto ensure bad rules cannot be created in the first place.tests/unit_tests/sql/parse_tests.pyverifying RLS clause parsing, to avoid flaky SQLite/Flask-integration tests.PR created automatically by Jules for task 9444043596758737189 started by @sha174n