fix(agents): prevent ReDoS in background-session name derivation#91233
Conversation
tokenizeCommand split commands with an ambiguous quoted-span regex where a backslash matched both the escape alternative and the negated class, so an unterminated quote followed by a run of backslashes caused catastrophic backtracking. deriveSessionName runs this on agent-controlled session.command when background sessions are listed/labeled, so a crafted command could hang the event loop. Exclude the backslash from the negated classes to make matching linear, matching the sibling tokenizers that already use the safe form.
|
Codex review: passed. Reviewed June 7, 2026, 4:30 PM ET / 20:30 UTC. Summary PR surface: Source 0, Tests +26. Total +26 across 2 files. Reproducibility: yes. with high confidence from source inspection and supplied terminal proof: current Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the narrow shared-tokenizer fix after exact-head CI/automerge gates, preserving the source contributor credit from the linked source PR. Do we have a high-confidence way to reproduce the issue? Yes, with high confidence from source inspection and supplied terminal proof: current Is this the best way to solve the issue? Yes: fixing the single shared tokenizer is the narrowest maintainable layer, avoids patching every process caller, and the tests cover both preserved behavior and the malicious backslash-run case. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 0c33f4e0786e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +26. Total +26 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
🦞✅ Source: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
…nclaw#91233) Summary: - The PR updates background-session command tokenization to avoid catastrophic regex backtracking and adds `deriveSessionName` regression tests for quoted and backslash-heavy commands. - PR surface: Source 0, Tests +26. Total +26 across 2 files. - Reproducibility: yes. with high confidence from source inspection and supplied terminal proof: current `main ... shows before/after timing for the production helper. I did not run tests because this review is read-only. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(agents): treat backslash as literal inside single-quoted session … - PR branch already contained follow-up commit before automerge: fix(agents): prevent ReDoS in background-session name derivation Validation: - ClawSweeper review passed for head 0a38952. - Required merge gates passed before the squash merge. Prepared head SHA: 0a38952 Review: openclaw#91233 (comment) Co-authored-by: yetval <yetvald@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
…nclaw#91233) Summary: - The PR updates background-session command tokenization to avoid catastrophic regex backtracking and adds `deriveSessionName` regression tests for quoted and backslash-heavy commands. - PR surface: Source 0, Tests +26. Total +26 across 2 files. - Reproducibility: yes. with high confidence from source inspection and supplied terminal proof: current `main ... shows before/after timing for the production helper. I did not run tests because this review is read-only. Automerge notes: - PR branch already contained follow-up commit before automerge: fix(agents): treat backslash as literal inside single-quoted session … - PR branch already contained follow-up commit before automerge: fix(agents): prevent ReDoS in background-session name derivation Validation: - ClawSweeper review passed for head 0a38952. - Required merge gates passed before the squash merge. Prepared head SHA: 0a38952 Review: openclaw#91233 (comment) Co-authored-by: yetval <yetvald@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
Makes #90976 merge-ready for the ClawSweeper automerge loop.
The edit pass should inspect the live PR diff, review comments, and failing checks; rebase if needed; keep the contributor branch credited; and stop only when validation is green or an external blocker is proven.
ClawSweeper 🐠 replacement reef notes:
Co-author credit kept:
fish notes: model gpt-5.5, reasoning high; reviewed against 0a38952.