Repository navigation
fix(test): make the python regex DoS wall-clock bounds hang detectors, not budgets - #2883
Conversation
…, not budgets Coverage on main went red at 38d2c4c: regex_redos_patterns_are_bounded failed with "lookbehind: took 4.021935831s" against an `elapsed < 4s` assertion, while the same test configured `max_duration(5s)` and `exit_code` correctly showed no timeout. The two bounds contradicted each other — any run finishing between 4s and 5s failed a test whose own limit permitted it. The VM's `max_duration` is what these tests exercise; the wall clock is only there to catch a run that escaped it entirely, so it has to sit above that limit. `hang_bound(limit) = limit * 3` now derives it, which is the shape regex_loop_is_stopped_by_time_limit already used (6s over a 2s limit). regex_huge_pattern_is_rejected_or_bounded had the same inversion (4s against a 5s limit) and is fixed with it, before it could fail the same way. Not a performance regression: all seven ReDoS cases together take ~0.8s in a normal build. Tarpaulin instrumentation is what multiplies it — the whole integration suite takes ~240s there — and fancy-regex 0.20's reworked lookbehind path was enough to cross a bound that already had no margin. The security assertions are untouched: each case must still not hit the VM time limit (124), and the loop case must still be stopped by it. Claude-Session: https://claude.ai/code/session_01Wy7MByvAMwapenBYpmq9HN
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 6837de8 | Commit Preview URL Branch Preview URL |
Nov 07 2026, 02:16 PM |
Review summary — #2883Verdict: Sound test-only fix, safe to merge once CI is green. No blocking findings; no review submitted (nothing to inline). What the change does: Findings: None by severity (no P0/P1/P2 on the diff). Verified the three hunks in Context read: full diff (not truncated); checkout succeeded; test module Could not review: nothing — single-file diff fully visible; no build/test run per reviewer sandbox (reasoned from code). Non-blocking note: the PR body contains a |
site-npm group. The Generate Rust Coverage failure on this PR was not its own: it was red on main too (regex_redos_patterns_are_bounded hitting a wall-clock bound tighter than the limit it tested), fixed in #2883, and a site-only npm bump cannot reach Rust coverage. Green after one re-run.
What changed
Three wall-clock assertions in
blackbox_dosnow derive their bound from the VM time limit the test configures, viahang_bound(limit) = limit * 3, instead of hard-coding a number below it.Coverage on
mainis currently red and this fixes it.Why
Generate Rust Coveragefailed at38d2c4cwith:The test configured
max_duration(5s)and then assertedelapsed < 4s. Those contradict: a run the VM's own limit permits fails the wall-clock check anyway, whileexit_codecorrectly reports no timeout. Anything landing between 4s and 5s was always going to fail, with nothing wrong.regex_huge_pattern_is_rejected_or_boundedhad the identical inversion (4s against a 5s limit) and would have failed the same way; it's fixed here too rather than left to surface later.regex_loop_is_stopped_by_time_limitalready had it right — 6s over a 2s limit — so this makes that existing shape the rule rather than inventing one.Before / After
This is not a performance regression. All seven ReDoS cases together run in ~0.8s in a normal build (~0.12s each). Tarpaulin instrumentation is the multiplier — the whole integration suite takes ~240s there against ~36s uninstrumented — and fancy-regex 0.20's reworked lookbehind path (from #2876) was enough to cross a bound that had no margin to begin with. I measured this before changing the assertion, precisely to avoid filing a timing fix over a real slowdown.
Risk
exit_code != 124), and the loop case must still be stopped by it (== 124).limit * 3still catches. It is not a weaker version of the old check; the old check was measuring the wrong thing against an impossible target.Checklist
<a href="
https://backend.blacksmith.sh/track/enable-autofix?expires=1796652952&installation_model_id=447267&pr_number=2883&ref=codesmith_pr_footer&repository=everruns%2Fbashkit&return_to=https%3A%2F%2Fgithub.com%2Feverruns%2Fbashkit%2Fpull%2F2883&signature=1a8538efb78589da2fe1621f7df440ce1e31445ca28c1c9b70de9ff897f7dea3"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28">Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Generated by Claude Code