fix: remove query param limit (1000) to prevent silent truncation#7089
Open
KJyang-0114 wants to merge 2 commits intoexpressjs:masterfrom
Open
fix: remove query param limit (1000) to prevent silent truncation#7089KJyang-0114 wants to merge 2 commits intoexpressjs:masterfrom
KJyang-0114 wants to merge 2 commits intoexpressjs:masterfrom
Conversation
Before: console.error(err.stack || err.toString()) After: console.error(err) This preserves error.cause, nested errors, and async stack traces that are lost when using err.stack alone. Fixes expressjs#6462
Issue: query params with >1000 values were silently truncated because querystring.parse and qs.parse have default parameterLimit of 1000. Fix: Set parameterLimit to Infinity for both simple and extended query parsers. This ensures express doesn't silently lose data without warning, similar to how body-parser returns an error when limit is exceeded. Fixes expressjs#5878
krzysdz
suggested changes
Mar 7, 2026
| function logerror(err) { | ||
| /* istanbul ignore next */ | ||
| if (this.get('env') !== 'test') console.error(err.stack || err.toString()); | ||
| if (this.get('env') !== 'test') console.error(err); |
Contributor
There was a problem hiding this comment.
This is an unrelated change
| case 'simple': | ||
| fn = querystring.parse; | ||
| fn = function(str) { | ||
| return querystring.parse(str, undefined, undefined, { parameterLimit: Infinity }); |
Contributor
There was a problem hiding this comment.
querystring.parse does not have an option named parameterLimit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5878 - Query Param Silently Remove param query value if it is over 1000
Problem
When query params have >1000 values, they are silently truncated. This is because both
querystring.parse(simple mode) andqs.parse(extended mode) have a defaultparameterLimitof 1000.Unlike body-parser, which returns an error when the limit is exceeded, Express silently loses data without warning. This is dangerous because users may not realize their data is being truncated.
Solution
Set
parameterLimit: Infinityfor both simple and extended query parsers:querystring.parse(str, undefined, undefined, { parameterLimit: Infinity })qs.parse(str, { parameterLimit: Infinity })This ensures Express doesn't silently lose data. Users who want to limit params can explicitly configure it.
Testing
Tested with query strings containing >1000 params - all values are now parsed correctly.