← Back to Pull requests

url: keep the next '=' across pairs in parseParams #67653

Closed
unknown closed this pull request without merging on Nov 22, 2026 13:24 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 13:13 UTC
Author

parseParams searched for = from the start of every pair. In a run of pairs with no = after them, each search scanned to the end of the string, so new URLSearchParams('a&'.repeat(n)) took quadratic time. Request#formData() reaches the same loop with an urlencoded body, so a client can block the event loop with one body: a 21 MB body of a& held a server's CPU for over 4 minutes before it was stopped.

This keeps the position of the next = across pairs and searches again only once the parser has passed it.

Timings of the loop copied into a script, median of 5, v26.13.1 arm64:

| pairs of a& | before | after |
| ---: | ---: | ---: |
| 65,536 | 94 ms | 1.7 ms |
| 262,144 | 1476 ms | 8.3 ms |

The copied loop with and without the change returned the same output for 300,000 random strings over a b = & ? + %2 0. The new test covers pairs with no = before and after pairs that have one, empty keys and values, a leading ?, and encoded input. The new test checks that output; it passes before and after the change, since it guards the parse result rather than its speed. The speed is in a new benchmark, benchmark/url/url-searchparams-parse-no-equals.js. On v26.13.1, without the change, pairs=1e5 runs 4.6 ops/s for a against 306 ops/s for a=b.

I have not built Node locally, so I haven't run the full suite or the benchmark against the change; Node's ESLint config (tools/eslint) passes on the three files.

Fixes: https://github.com/nodejs/node/issues/67652
Refs: https://github.com/nodejs/node/pull/65363

---

Disclosure: I found and fixed this with a coding agent, which also opened this PR and #67652 from my account. I checked the fix against the source, compared the old and new loop on 300,000 random inputs, ran Node's ESLint, and timed the new benchmark on v26.13.1. I'll answer review comments myself.

Diff: 231 lines (+173 / -58) across 2 files Reviewer: panva Review duration: 2891m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 231 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.326
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #67653"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37% (MEDIUM) · Higher = larger blast radius
37%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.6% · Safe to merge
14.6%
Repository