Repository navigation
feat: add an opt-in fieldArrayIndexLimit - #1438
Merged
UlisesGascon merged 5 commits intoAug 28, 2026
Merged
Conversation
append-field turns a bracket group whose contents are all digits into an array index, so a[3] produces an array of length 4. The index is not bounded by fieldNestingDepth, which counts bracket groups rather than what is inside them, so a single field name such as a[4294967294] can materialize a sparse array with a multi-billion length. Creating it costs append-field almost nothing. The cost lands on the application when it later iterates or serializes req.body, which is why this is a missing knob rather than resource consumption inside multer. Until now there was no limit to opt into. This adds one, in the spirit of the arrayLimit option in qs. It defaults to unbounded, so existing behaviour is unchanged and the change is semver-safe on the 2.x line. Only bracket groups that are entirely digits are considered, so object keys are unaffected. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
UlisesGascon
requested review from
LinusU,
UlisesGascon,
bjohansebas and
jonchurch
July 30, 2026 17:09
UlisesGascon
approved these changes
Aug 28, 2026
UlisesGascon
left a comment
Member
There was a problem hiding this comment.
Thanks @arpitjain099! I added some minor changes that I had locally for this 👍
This was referenced Aug 28, 2026
Merged
YasharF
added a commit
to sahat/hackathon-starter
that referenced
this pull request
Aug 28, 2026
config/morgan.js: colors moved out of the token and into the format string, where morgan doesn't touch them Dependency Release Notes: Multer v2.3.0 - Fix [CVE-2026-77078](https://www.cve.org/CVERecord?id=CVE-2026-77078) ([GHSA-wc9g-mqfw-jrwm](GHSA-wc9g-mqfw-jrwm)) - Fix [CVE-2026-77037](https://www.cve.org/CVERecord?id=CVE-2026-77037) ([GHSA-qfvm-cv95-jqjf](GHSA-qfvm-cv95-jqjf)) - Fix [CVE-2026-77063](https://www.cve.org/CVERecord?id=CVE-2026-77063) ([GHSA-qvfw-j98x-7q72](GHSA-qvfw-j98x-7q72)) - Fix [CVE-2026-82333](https://www.cve.org/CVERecord?id=CVE-2026-82333) ([GHSA-535w-7cp7-47q4](GHSA-535w-7cp7-47q4)) - Add `MulterError` codes `INVALID_FIELD_NAME` and `STREAM_DESTROYED` - Add opt-in `limits.fieldArrayIndexLimit` to bound numeric array indexes in field names ([#1438](expressjs/multer#1438)) - Accept files whose size is exactly `limits.fileSize` ([#1407](expressjs/multer#1407)) - Preserve the caller's async context (`AsyncLocalStorage`) when calling `next()` ([#1124](expressjs/multer#1124)) - Decode WHATWG-escaped characters (`%0A`, `%0D`, `%22`) in `file.originalname` ([#1421](expressjs/multer#1421)) - Do not crash when `fileFilter` invokes its callback more than once ([#1427](expressjs/multer#1427)) - Use a fallback message for `MulterError` codes without a mapping ([#1448](expressjs/multer#1448)) - Docs: clarify `preservePath` and `parts`, use `crypto.randomBytes` in the `DiskStorage` example ([#1414](expressjs/multer#1414), [#1430](expressjs/multer#1430), [#1436](expressjs/multer#1436)) - Docs: add Indonesian, Japanese and Tamil translations and refresh all translations from the current README ([#1431](expressjs/multer#1431), [#1354](expressjs/multer#1354), [#1462](expressjs/multer#1462)) - Internal: run the test suite on Windows ([#1334](expressjs/multer#1334)) Morgan 1.12.0 - Security fix for [CVE-2026-15603](https://www.cve.org/CVERecord?id=CVE-2026-15603)([GHSA-jxfw-x594-9x9m](https://github.com/expressjs/morgan/security/advisories/GHSA-jxfw-x594-9x9m)) - Allow format functions to return objects for streams in `objectMode` - Respect the `NO_COLOR` environment variable in the `dev` format
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.
Adds an opt-in
limits.fieldArrayIndexLimitthat bounds the numeric index allowed inside a bracket field name, complementing the existingfieldNestingDepthlimit.fieldNestingDepthcounts bracket groups, not the number inside them, soa[1000000]is one level and passes.append-fieldreads an all-digit bracket group as an array index, and the resulting array carries that length. Applications that want to bound this can now opt in.The change
A new
limits.fieldArrayIndexLimitchecked next to the existingfieldNestingDepthcheck, plus aLIMIT_FIELD_ARRAY_INDEXerror code. Only bracket groups that are entirely digits count, soa[99999999x]stays an object key and is untouched. It is opt-in and defaults to unbounded, so with the limit unset behavior is unchanged (there is a test asserting that).Tests
test/array-index-limit.jscovers rejection above the limit, rejection nested behind object keys, acceptance exactly at the limit, a numeric key bounded at a limit of zero, object keys left alone, field names stored as literal keys, and unbounded when unset.Notes
The name
fieldArrayIndexLimitfollows multer'sfield*convention. Whether a future major enforces a default, and what value, is a separate call.