Commit e28abd0
fix(guard): require the END marker to end its own line
A review pass died mid-response, but its last line named the gap: the
guard never validated what followed the END marker. Measured, and it was
two more false accepts.
`indexOf("\n-----END <label>-----")` matches a prefix, so it treated
`-----END CERTIFICATE-----garbage` and `-----END CERTIFICATE-------` as
terminators. Both make openssl reject the block: guard=accept while node
loaded zero extra CAs, on a bundle whose remaining entries were healthy.
Only whitespace may follow — 13/13 agreement with a real handshake on
what a tail may contain (space, tab, nothing: loads; any other character,
including a further dash run: does not). The END search now skips
candidates whose line does not end there, rather than taking the first
textual match.
Three rows added, including the positive one: a trailing space must keep
being ACCEPTED, or the fix trades two false accepts for a false reject.
Mutation-verified — reverting to the bare indexOf fails exactly one test.
Re-measured across all four sweeps at 164 shapes: 0 false accepts, no
regression in either direction.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 2c0ea06 commit e28abd0
2 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
406 | 413 | | |
407 | 414 | | |
408 | 415 | | |
| |||
0 commit comments