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
Main Changes:
- 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
* chore: reduce the default depth limit to 32
Main Changes:
- Breaking Change: Set default depth limit to 32
- Update documentation
- Update the HISTORY
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
@@ -278,6 +278,10 @@ The `verify` option, if supplied, is called as `verify(req, res, buf, encoding)`
278
278
where `buf` is a `Buffer` of the raw request body and `encoding` is the
279
279
encoding of the request. The parsing can be aborted by throwing an error.
280
280
281
+
#### depth
282
+
283
+
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.
284
+
281
285
## Errors
282
286
283
287
The middlewares provided by this module create errors using the
@@ -374,6 +378,10 @@ as well as in the `encoding` property. The `status` property is set to `415`,
374
378
the `type` property is set to `'encoding.unsupported'`, and the `encoding`
375
379
property is set to the encoding that is unsupported.
376
380
381
+
### The input exceeded the depth
382
+
383
+
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