Form files: a dropped, stalled or endless upload is aborted and frees its slot, attempt key and buffers

Security review of 1.16.0 (blocking): a request body that errored mid-file never
resolved, leaking the concurrency slot and the attempt key. Also: idle and request
timeouts (submit.idleTimeoutMs / timeoutMs), ImmutableId preference on every Graph
draft call, the remaining total in the too-large message, files sent to a form
without a File field are refused and logged.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-13 17:02:10 +01:00
co-authored by Claude Fable 5.2
parent cd74d7decb
commit e24c918d4b
13 changed files with 311 additions and 30 deletions
+10 -2
View File
@@ -366,9 +366,17 @@ export async function submitForm(args: SubmitFormArgs): Promise<SubmitFormResult
const hasFiles = Object.values(files ?? {}).some((list) => list.length > 0)
const attachments = getFormAttachments(payload)
if (!attachments || (!hasFiles && validation.fileFields.length === 0)) {
if (!attachments || validation.fileFields.length === 0) {
// A file without the feature (or without a File field) is an unknown field.
if (hasFiles) {return { kind: 'unknown_fields', reason: 'validation', success: false }}
if (hasFiles) {
// Never dropped silently: the caller sent files this site (or this form) does not take.
payload.logger.warn(
attachments
? `[ipal] submitForm: files were sent to form ${formId}, which has no File field — refused.`
: '[ipal] submitForm: files were sent, but forms.attachments is off — refused. Turn it on in ipalKit({ forms: { attachments: true } }).',
)
return { kind: 'unknown_fields', reason: 'validation', success: false }
}
return storeSubmission({ attemptKey, formId, locale, payload, validation })
}