Skip to content

Lower the schema pattern input bound to 128 characters; changeset and notes for 0.4.6 - #372

Merged
jimhoyd merged 1 commit into
mainfrom
fix/pattern-input-cap-128
Sep 21, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
fix/pattern-input-cap-128

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

The 0.4.5 release stopped at the CI gate: on windows-latest / Node 22, accepted patterns stay fast on adversarial input at the length cap (ReDoS bound) failed twice (^\w+\w+\w+$ took 577 ms, then 539 ms, against a 500 ms bound); it passes on every other leg. Nothing was tagged or published; npm is at 0.4.2.

The guard allows up to three unbounded quantifiers, which are polynomial (cubic) on the input cap. Lowering maxPatternInputLength from 256 to 128 (the maintainer chose this option) makes the worst accepted patterns about 7 times cheaper: about 25 ms to about 3.7 ms locally, so roughly 75 ms on that runner. The test bound stays at 500 ms. A schema that sets pattern now needs maxLength of at most 128; this is an unreleased feature. Updated: pattern-guard, tests, docs/HTTP.md, the body-validation example.

Also adds the 0.4.6 changeset (0.4.3 to 0.4.5 were never published) and marks the 0.4.3, 0.4.4 and 0.4.5 release notes accordingly. npm run verify passes.

🤖 Generated with Claude Code

… notes for 0.4.6

The 0.4.5 CI gate failed on Windows / Node 22: a pattern the guard accepts took
about 550 ms against a 500 ms bound. At 128 characters the worst accepted
patterns cost about 7 times less. Nothing was published for 0.4.3 to 0.4.5.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd merged commit 806f3a9 into main Sep 21, 2026
20 checks passed
@jimhoyd
jimhoyd deleted the fix/pattern-input-cap-128 branch September 21, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant