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
* protect: input-handling robustness pass across the engine and runtime
A batch of defensive hardening so matching stays correct on inputs that don't
take the obvious shape. No public API changes.
- Host/IP classification (internal_host) now canonicalizes before deciding:
every IPv4 spelling inet_aton accepts, and expanded / IPv4-mapped IPv6 forms,
are recognized (previously a string/prefix compare); adds 100.64.0.0/10.
- Origin/redirect comparisons resolve against the request origin and normalize
default ports (off_origin handles protocol-relative / backslash locations;
cross_origin distinguishes an absent header from a present opaque one;
cors_reflected covers ACAO: null + credentials).
- Scalar matchers fan out over the leaves of a structured (nested / array-of-
object) value instead of stringifying it; bounded + iterative so a
pathological value can't fail a rule open.
- Regex safety: the ReDoS detector catches nested quantified subgroups, and a
rejected pattern now warns (the rule is unenforced) instead of failing silent.
- Request body handling: permissive content-type parsing (+json / text/plain /
no content-type still populate post.<field>); body inspection is no longer
skipped on a declared Content-Length; `all` folds in the verbatim body.
- Request normalization no longer deletes line-comment spans from the value it
inspects (that hid payloads from parameter-scoped rules).
- Response screening: exact content-type matching for live streams, a binary
sniff so a textual octet-stream export is screened; a redactor whose rule
decodes the body before matching now fails closed rather than serving a no-op
mask; whitelist misconfig (no rule_id / unimplemented keys) warns.
Adds tests/protect/security-hardening.test.ts plus updates to the normalizer /
response-guards suites. 703 tests green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* protect: bound normalizeObject recursion; fix Node-version-fragile depth test
The request normalizer recursed into nested objects unbounded, so a
pathologically deep value could overflow the stack before matching ran — the
per-rule catch would swallow that into a fail-open. Cap the walk (values below
the bound are left un-normalized, still matched, never crashing).
The regression test built its deep value via a JSON string, which overflowed
JSON.parse/stringify on Node 18/20/22 (but not 25) — a test artifact, not the
engine. Rebuild it in memory and assert it still matches past the normalize cap
(a fail-open crash would return blocked:false). Verified on Node 20 and 22.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* ci: also validate on Node 24 (the version we publish/release on)
The CI matrix tested 18/20/22, but publish.yml and release.yml build on Node
24 — so releases ran on a version CI never exercised. Add 24.x to close that gap.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments