Commit 8ed796a
fix(ca-trust): see a malformed BEGIN line instead of skipping it
Codex review against the real merge base, P1 and the only finding.
The marker pattern described a WELL-FORMED opener, so an over-dashed one
(`-----BEGIN CERTIFICATE-------`) matched nothing at all and the block became
invisible to the guard: nothing was checked, and our CA later in the file
carried the verdict. openssl does not skip it — it consumes the line as an
opener and then fails the ENTIRE extras load on the END it cannot match.
Measured, node v24.11.1: guard=accept, loader=0 CAs, `bad end line`.
A trailing `.*` makes the line match, which is all the fix needs: the block is
then seen and the existing per-block check rejects it as an undecodable
CERTIFICATE. Being SEEN is what a guard needs; skipping is what lets a bad
block through.
This is the same defect already fixed on the END side, in its mirror position.
The lesson: a shape fixed at one marker is a shape to go and check at the other.
Two rows: the malformed opener rejects, and a BEGIN wearing one trailing space
still ACCEPTS, so the fix cannot drift into the over-strict guard this PR set
out to remove.
Mutation-checked: reverting to the strict pattern fails the new row.
An earlier attempt added a separate pre-scan loop and an `undefined` label
branch. The branch was dead — `(?!-----)` still captures `CERTIFICATE` from an
over-dashed line — and the mutation SURVIVED, which is what exposed it. Removed
rather than kept as defence for a case that cannot happen.
Suite 1505/1507, the 2 being the inotify EMFILE that fails identically at the
merge base.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent ee31cb3 commit 8ed796a
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
75 | 88 | | |
76 | 89 | | |
77 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
437 | 449 | | |
438 | 450 | | |
439 | 451 | | |
| |||
0 commit comments