The GitHub Actions job "Build Burr" on burr.git/feature/condition-safe-expr has 
failed.
Run started by GitHub user elijahbenizzy (triggered by elijahbenizzy).

Head commit for run:
0bde0eab592538a8faf1a9622f5fe9c0333557b7 / Elijah Ben Izzy 
<[email protected]>
feat: add Condition.safe_expr for opt-in restricted AST evaluation (#817)

Introduce Condition.safe_expr() as the opt-in safe sibling of Condition.expr().
Where expr() uses eval() (acceptable for developer-authored strings, unsafe
for less-trusted input), safe_expr() parses the expression, validates every
AST node against a tight allowlist at call time, and then interprets the
validated tree directly. eval()/compile() are never invoked on the parsed
tree -- the safety argument depends on this.

Allowed grammar: constants, Name lookup (resolved against state), Attribute
access (dunder names rejected -- closes __class__.__bases__.__subclasses__()),
Subscript, Compare, BoolOp, UnaryOp, arithmetic BinOp, literal containers,
and Call only to a whitelist of safe builtins (len/abs/min/max/sum/all/any/
str/int/float/bool). Everything else -- lambdas, comprehensions, IfExp,
walrus, f-strings, bitwise ops, arbitrary calls, bytes/Ellipsis constants --
raises ValueError at safe_expr() call time, before the Condition is built.

Backward compatible: Condition.expr is unchanged. safe_expr is exported as
burr.core.safe_expr alongside expr. expr's docstring now cross-references
safe_expr for the untrusted-input use case.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

Report URL: https://github.com/apache/burr/actions/runs/27978291270

With regards,
GitHub Actions via GitBox

Reply via email to