Repository navigation
Conversation
Add MAX_GLOB_WILDCARD_SEGMENTS (32) guard to globMatches() in agent-bundle-mcp-runtime.ts and agent-bundle-mcp-materialize.ts. A malicious MCP tool filter glob with excessive wildcards can produce a regex with catastrophic backtracking. The cap rejects patterns with more than 32 segments before regex construction. Normal patterns (1-3 wildcards) are unaffected. Co-Authored-By: Claude <[email protected]> Signed-off-by: 廖石荣 0668000909 <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed July 2, 2026, 11:21 PM ET / 03:21 UTC. Summary PR surface: Source +10. Total +10 across 2 files. Reproducibility: yes. Source inspection shows both MCP filter paths compile configured Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Replace the duplicated regex conversion with a shared linear Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows both MCP filter paths compile configured Is this the best way to solve the issue? No. The cap is a plausible mitigation, but it leaves the regex backtracking mechanism reachable at the allowed boundary; a linear segment matcher is the safer maintainable fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b415072a2e6a. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +10. Total +10 across 2 files. View PR surface stats
Security concerns:
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
|
|
Closing: ClawSweeper identified that the 32-wildcard cap still permits backtracking. Fix requires linear matcher rewrite — will revisit with complete solution. |
What Problem This Solves
The
globMatches()helper in bothagent-bundle-mcp-runtime.tsandagent-bundle-mcp-materialize.tsconverts user-configured MCP tool filter glob patterns into regular expressions usingnew RegExp(...). A malicious glob pattern with excessive*wildcards (e.g.a*a*a*...x32+) produces a regex vulnerable to catastrophic backtracking (ReDoS) when tested against crafted tool names.This is not IPC-related — the fix is a pure input validation guard.
Why This Change Was Made
Add
MAX_GLOB_WILDCARD_SEGMENTS = 32guard that rejects patterns with more than 32 segments before regex construction. Normal tool filter patterns (typically 1-3 wildcards) are unaffected.Changes
src/agents/agent-bundle-mcp-runtime.ts— addMAX_GLOB_WILDCARD_SEGMENTSconstant + guard inglobMatches()src/agents/agent-bundle-mcp-materialize.ts— apply the same guard in the duplicateglobMatches()implementationEvidence
Reproducibility: yes. Source inspection confirms both locations construct regex from unsanitized user-controlled glob patterns without a wildcard limit.
Direct behavior probe (ReDoS PoC):
Related
N/A (self-contained security hardening)
🤖 Generated with Claude Code