Skip to content

Conversation

@jonathan-fulton
Copy link

Summary

The qs library used by Express has a default parameterLimit of 1000, which silently truncates query parameters beyond this limit. This can lead to subtle data loss bugs that are extremely difficult to diagnose, as there's no warning when parameters are dropped.

Solution

Set parameterLimit: Infinity in the extended query string parser. Users who need a limit for security reasons can provide a custom query parser.

This aligns with the principle of least surprise - it's better to process all parameters by default and let users explicitly opt into limits, rather than silently dropping data.

Before:
Query string with 1500 parameters silently returns only 1000.

After:
All 1500 parameters are parsed correctly.

Changes

  • Modified lib/utils.js to set parameterLimit: Infinity
  • Added JSDoc explaining the rationale
  • Added test verifying 1500+ parameters are not truncated

Fixes #5878

Set parameterLimit to Infinity in the extended query parser to prevent
silent truncation of query parameters when exceeding the qs library's
default limit of 1000.

Previously, query strings with more than 1000 parameters would be
silently truncated, potentially causing data loss and hard-to-debug
issues. Now all parameters are parsed by default. Users who need a
limit for security can provide a custom query parser function.

Fixes expressjs#5878
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.

Query Param Silently Remove param query value if it is over 1000

1 participant