Repository navigation
fix(python): re gate follow-ups: budget before parse, parser pinned with Monty - #2834
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 1e01fcd | Commit Preview URL Branch Preview URL |
Nov 05 2026, 05:03 AM |
There was a problem hiding this comment.
Follow-up fixes verified in part, but the exec/eval pin does not actually pin (P1), and the gate's completeness comment is now stale (P2). Budget-before-parse and Dependabot pinning check out. Details inline.
Comments outside the diff
crates/bashkit/src/builtins/python.rs line 355: [P2] This completeness claim is now stale: the new test (lines 1919–1920) acknowledges that exec/eval/compile would run imports the outer AST never shows, but the gate's own comment still lists only __import__/importlib as the reason import/from statements are the only loaders. If someone reads this comment to audit the gate, they will miss the exact bypass class the test pins. Fix: extend the comment to name exec/eval/compile as also-absent (with a pointer to test_re_module_dynamic_import_is_unavailable as the tripwire), so the design record stays next to the code it justifies.
Review verdict (head
|
…ith Monty Review follow-ups for the AST-based `re` import gate: - charge source to the execution budget before the gate parses it - Dependabot-ignore ruff_python_parser/ast so they only move with monty - pin that Monty has no exec/eval/compile, which could hide an import
fe9d8fb to
d8f5763
Compare
…pears Payloads used re/__import__, which are also absent, so adding exec or eval alone left the test green. Use supported code instead, and name the full set in the gate's design comment.
# Conflicts: # knowledge/log.md
Requested by Михайло · project thread
What changed
Addresses the three review findings on #2831 (merged before they were handled):
regate parses it, so a multi-MB script is accounted for before any work is done on it.ruff_python_parser/ruff_python_astare Dependabot-ignored, likemonty, so the gate can't drift to a grammar the executor doesn't share (code the gate fails to parse is passed through).exec/eval/compilepinned absent: a test assertsexec('import re'),eval(...)andcompile(...)fail with no output. Monty 0.0.19 has none of them; if an upgrade adds one, the test fails instead of silently reopening the gate.Why
Review of #2831 by bashkit-pr-reviewer (P1 exec path unpinned, P2 parse-before-budget, P2 Dependabot skew).
Before / After
No behavior change for valid programs. Verified on main:
exec("import re")→RuntimeError: no external function handler configured(name not defined), exit 1; now pinned bytest_re_module_dynamic_import_is_unavailable.Risk
Checklist
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.