You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "bito-code-review[bot] (via GitHub)" <gi...@apache.org> on 2026/09/01 17:41:42 UTC
Re: [PR] fix(sql): catch sqlglot ParseError when parsing RLS predicates [superset]
bito-code-review[bot] commented on PR #43651:
URL: https://github.com/apache/superset/pull/43651#issuecomment-5497967461
<!-- Bito Reply -->
The observation regarding the change in exception handling is accurate. By wrapping `sqlglot.parse_one` in a `try-except` block that catches `sqlglot.errors.ParseError` and `sqlglot.errors.SqlglotError` and raises `SupersetParseError`, the behavior for unparseable RLS predicates has indeed shifted from raising a raw `sqlglot` exception to raising a `SupersetParseError`.
As noted, if downstream code (such as `validate_stored_expression_at_query_time`) catches `SupersetParseError` and treats it as a signal to skip the expression rather than failing, this will result in a fail-open behavior for malformed RLS predicates. Given that this is an admin-gated feature and `ALLOW_ADHOC_SUBQUERY` is off by default, the risk is contained, but it does diverge from the fail-closed pattern used elsewhere for RLS injection failures. Adding a comment in `superset/models/helpers.py` to clarify that a malformed RLS predicate is now treated as an unparseable expression would be a helpful documentation improvement.
**superset/sql/parse.py**
```
try:
return sqlglot.parse_one(predicate, dialect=self._dialect)
except sqlglot.errors.ParseError as ex:
# ... (exception handling logic)
raise SupersetParseError(predicate, self.engine, **kwargs) from ex
except sqlglot.errors.SqlglotError as ex:
raise SupersetParseError(
predicate,
self.engine,
message="Unable to parse predicate",
) from ex
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org