fix(tools): trim command before matchCommand to close leading-whitespace bypass (#904)#910
Conversation
…ace bypass [alexi-bot]
1825340 to
90f1775
Compare
Security Review - PR #910
Scan performed by the Security vertical of the Alexi T-shape agent factory. SummaryThis PR narrows a real gap in the permission allowlist: Verdict: safe to merge from a security standpoint. Change is a Findings below are context on the broader repo audit; none block this Critical (block)None for this PR. High (warn)Pre-existing, not introduced by this PR. Logged here so they are not lost:
Info
Recommendations
Posted by role-security via agent-factory. Advisory only - the agent |
Coverage Report
Coverage Details
|
Architecture Review -- PR #910 (2026-07-03)
SummaryVerdict on the PR itself: architecturally clean, merge unblocked. The Verdict on the repository state the PR lands into: still degrading. The PR under review actually depends on No new ADR in this run. F15 violates ADR 001's existing rule about FindingsPR-scopedPR-F1 --
|
Review - role-quality
CorrectnessFix addresses the exact SecurityPositive security fix — closes a permission-allowlist bypass on the read-only bash rail. No new risks introduced; trimming is a strict narrowing of what the regex sees. Tests
Performance
Style
Changes made: none (gate is green, no fix-ups required). Verdict: Approved |
Summary
Follow-up to #909, which layered exec-flag escapes on the read-only bash allowlist. That fix used the full command string as the regex target, but did not trim it first — so a stray leading whitespace character (
find . -exec ...,\tfind ...) would silently defeat the anchored^find.*-exec.*$pattern and re-open the escape.This PR trims the command before both first-token extraction and full-command regex matching, and adds a regression test covering leading spaces, trailing spaces, and a leading tab. All prior tests remain green.
Diff scope
src/permission/wildcard.ts:matchCommandnow trims the incoming command and uses the trimmed value for bothcmdNameand the full-command regex test.tests/permission/wildcard.test.ts: adds a leading/trailing whitespace regression case.Rebased on top of current
master; the earlier duplicate of #909 is dropped.Checks
Closes #904