Repository navigation
Commit 23818e8
fix(ssh): check agent signing failures in one pass per line
CodeQL alert 153 flagged the agent-signing-failure regex, added upstream
since v0.1.4-nightly.20261027.3796. The regex restarts at every occurrence
of "sign_and_send_pubkey: signing failed for " and scans to the end of the
line each time, so a line that repeats the prefix is quadratic. V8's linear
fallback engine does not cover this pattern: 328 KB took 4.3 s and 820 KB
took 27.8 s. The message is SSH client output for a host the user chose, so
a hostile host could stall the server while classifying a failed login.
Match the two literal agent errors with includes, and scan each line once
from the first "for" prefix for " from agent:". 400,000 random token
strings classify the same as the old regex, 31,869 of them positive. The new
test, a 1.6 MB line of repeated prefixes, timed out at 60 s on the pinned
source and now passes with the other 16 SSH auth and tunnel tests.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 9ed051f commit 23818e8
3 files changed
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
707 | 717 | | |
708 | 718 | | |
709 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
66 | 74 | | |
67 | 75 | | |
68 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
250 | 252 | | |
251 | 253 | | |
252 | 254 | | |
253 | | - | |
254 | | - | |
255 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
256 | 269 | | |
0 commit comments