Repository navigation
Commit 2bbfed7
fix(mcp): cap glob-to-regex wildcard segments to prevent ReDoS
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]>1 parent dce1b0a commit 2bbfed7
2 files changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
166 | 171 | | |
167 | 172 | | |
168 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
318 | 320 | | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
323 | 328 | | |
324 | 329 | | |
325 | 330 | | |
| |||
0 commit comments