You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ca-trust): reject the whitespace node rejects, and never publish an unparseable CA
Two false-accept paths found by Codex review, both reproduced here before
being agreed with.
STRIP ASCII WHITESPACE ONLY. isBase64Body stripped with /\s+/, which is the
Unicode whitespace set. Node's PEM reader accepts space, tab, CR and LF and
nothing else. Measured one character at a time against a real
NODE_EXTRA_CA_CERTS load: those four load 1, while U+00A0 U+2003 U+2028 U+2029
U+FEFF U+1680 U+205F U+3000 and ASCII VTAB and FORMFEED each load 0 with
`bad base64 decode`. All ten are stripped by \s, so a body damaged by any of
them read as clean and the guard accepted a bundle that costs the session every
extra root. A NBSP is what a paste through a rich-text field leaves behind.
PARSE BEFORE PUBLISHING. The copy into ca-trust.d/ccf.pem happened before the
X509 parse, so a corrupt ca.pem was handed to every OTHER component. Our own
session degrades fine (it falls back to node's built-in store), but the builder
concatenates sort(*.pem) and "ccf" sorts first — the same fatal leading
position the torn-write guard already protects, reached by a different cause.
Atomicity guarantees whole bytes, never loadable ones. Now the parse throws
into the existing catch, which warns and leaves any previous good ccf.pem for
siblings to keep trusting.
Both TDD: each test fails on the pre-fix code and passes after. Both
mutation-checked: reverting [ \t\r\n] to \s fails proxy-forward-ca, removing
the pre-publish parse fails proxy-wrapper.
Suite 1505/1507. The 2 failures are the inotify EMFILE (max_user_instances=128
on this host) and fail identically at the merge base.
Four of the six review findings were against upstream code outside this PR's
diff — session-budget-breaker and tier-advisor — and are not touched here.
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments