Files
clean-architecture-frontend…/tests/unit
DongHyeonkaandClaude Opus 5.5 5e62b7e1e5 fix(auth): validate credential header values as control-free ByteStrings (R-3.4)
The shared credential admission (V2 and V3) only rejected CR/LF. A token
with NUL, a non-Latin-1 character or another control character passed,
then Fetch rejected it after V3 had marked the attempt dispatched: a query
burned its retry budget and a command ended MAYBE_APPLIED with
NETWORK_FAILURE. The external session adapter also merged header names
that differ only in case, silently keeping the last value.

- admitCredentialHeaders: the value must match [\x20-\x7E\xA0-\xFF]+ (a
  ByteString without C0/C1 controls); the size limit is now the string
  length, which is the wire byte count for a ByteString. Failure stays
  CREDENTIAL_HEADER_VALUE_INVALID, i.e. AUTH_INTEGRATION_FAILURE before
  dispatch.
- checkFinalInvariants: builds `new Headers(headers)` first; any value
  Fetch would reject fails as HEADER_VALUE_INVALID (new additive member of
  FinalInvariantFailure) with zero fetch calls.
- validateCredentialPatch: rejects case-only duplicate header names.

RED before fix: http-execution-v3-live-authority.test.ts "rejects a NUL /
non-Latin-1 credential value before dispatch" (got TRANSPORT_FAILURE, fetch
called), http-contract-bridge.test.ts "rejects a NUL/non-Latin-1/tab/DEL/C1
control value ..." and "fails before dispatch when Fetch would reject a
header value", auth-session-adapter.test.ts "rejects credential headers
that differ only in case instead of merging them". Pinned: "admits an
ordinary bearer token", CR/LF rejection, existing "Bearer ok"/"Bearer
token" integration paths.
Gates: check:architecture, check:types:app, check:types:test, lint,
test:component, test:integration, test:contract, test:platform,
test:reference-feature pass. test:unit passes except removal-fixture.test.ts
(needs generated artifacts/ release evidence absent in a fresh worktree;
unrelated).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:25:01 +09:00
..