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
{{ message }}
Repository navigation
settings API: reject an out-of-range array index instead of filling the gap #1251
From the 2026-11-01 scan: F-003 (low, denial of service, CWE-789), src/utils/settings-config.ts. Reachability was not established by the scan.
Current code (main 49f51378): setByPath() parses a path such as dvm.workers[2000000000] into index tokens and calls ensureArrayLength(current, token.index), which is while (target.length <= minimumLength) target.push(undefined). A single authenticated PATCH /admin/settings therefore performs two billion pushes inside the request, before any value validation can reject the setting. The index arrives as a number in the path, so it is fully caller-controlled.
Fix shape
Reject an index that is not a safe integer, and reject one beyond a hard maximum array length.
Refuse to grow an array by more than a small constant in one set; updates should target an existing index or append one element at the end.
Keep the error a validation issue on the path, not a thrown exception that surfaces as a 500.
Acceptance
A settings patch with a huge index is refused in bounded time with heap usage unchanged.
A normal append (arr[<length>]) and an update of an existing index both still succeed.
Hi, I'd like to work on this. My plan: reject an index that isn't a safe integer or is above a hard maximum, and in setByPath allow an index only up to the array's current length (update an existing item or append one at the end), so nothing grows before the check. The PATCH route will report this as a validation issue on the path rather than a 500. I'll add unit tests for a huge index, a normal append and an update, and open the PR from my fork as CONTRIBUTING describes.
learnerabhinavdwivedi-droid commented on Nov 28, 2026
The fix is ready in my fork: learnerabhinavdwivedi-droid#1 (one commit, f5f9184, changeset included, CI green). It caps an array index at 10,000 in the path check, lets setByPath only update an existing index or append at the end, and returns a 400 validation issue instead of a 500. Could you cherry-pick it? Thanks!
learnerabhinavdwivedi-droid commented on Nov 29, 2026
A follow-up to my earlier comment: an automated review on my fork PR pointed out that with no override in settings.yaml, an indexed write into a default array lost the rest of that array. For example, the guided field payments.feeSchedules.admission[0].enabled saved only { enabled: true }, without the default amount. That part was already happening before my fix. limits.event.content[1].maxLength was refused after my fix. Both are fixed in f63d813 (learnerabhinavdwivedi-droid#2, changeset included, CI green). Could you cherry-pick both commits, f5f9184 and then f63d813? Thanks!
Activity
learnerabhinavdwivedi-droid commentedon Nov 28, 2026
Hi, I'd like to work on this. My plan: reject an index that isn't a safe integer or is above a hard maximum, and in
setByPathallow an index only up to the array's current length (update an existing item or append one at the end), so nothing grows before the check. The PATCH route will report this as a validation issue on the path rather than a 500. I'll add unit tests for a huge index, a normal append and an update, and open the PR from my fork as CONTRIBUTING describes.learnerabhinavdwivedi-droid commentedon Nov 28, 2026
The fix is ready in my fork: learnerabhinavdwivedi-droid#1 (one commit,
f5f9184, changeset included, CI green). It caps an array index at 10,000 in the path check, letssetByPathonly update an existing index or append at the end, and returns a 400 validation issue instead of a 500. Could you cherry-pick it? Thanks!learnerabhinavdwivedi-droid commentedon Nov 29, 2026
A follow-up to my earlier comment: an automated review on my fork PR pointed out that with no override in
settings.yaml, an indexed write into a default array lost the rest of that array. For example, the guided fieldpayments.feeSchedules.admission[0].enabledsaved only{ enabled: true }, without the defaultamount. That part was already happening before my fix.limits.event.content[1].maxLengthwas refused after my fix. Both are fixed inf63d813(learnerabhinavdwivedi-droid#2, changeset included, CI green). Could you cherry-pick both commits,f5f9184and thenf63d813? Thanks!fix(settings): reject an out-of-range array index instead of filling …
fix(settings): keep the rest of a default array when one of its field…