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
feat: add option to customize the depth with a default value of 32
- Update documentation to reflect the new features and errors
- Update the changelog
- Upgrade to `[email protected]`
- Add the `depth` option to define the depth of parsing while parsing the query string
- Enable the `strictDepth` option by default in `qs.parse`
- Add a 400 status code when the depth of the query string exceeds the limit defined by the `depth` option
- Reduce the default depth limit to 32
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,10 @@ Whether to decode numeric entities such as `☺` when parsing an iso-8859-1
290
290
form. Defaults to `false`.
291
291
292
292
293
+
#### depth
294
+
295
+
The `depth` option is used to configure the maximum depth of the `qs` library when `extended` is `true`. This allows you to limit the amount of keys that are parsed and can be useful to prevent certain types of abuse. Defaults to `32`. It is recommended to keep this value as low as possible.
296
+
293
297
## Errors
294
298
295
299
The middlewares provided by this module create errors using the
@@ -386,6 +390,10 @@ as well as in the `encoding` property. The `status` property is set to `415`,
386
390
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
387
391
property is set to the encoding that is unsupported.
388
392
393
+
### The input exceeded the depth
394
+
395
+
This error occurs when using `bodyParser.urlencoded` with the `extended` property set to `true` and the input exceeds the configured `depth` option. The `status` property is set to `400`. It is recommended to review the `depth` option and evaluate if it requires a higher value. When the `depth` option is set to `32` (default value), the error will not be thrown.
0 commit comments