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
+4 -1
View File
@@ -216,7 +216,10 @@ describe('attachments', () => {
])
// The draft is addressed and labelled like any message, and asks for an id that survives the move to Sent Items.
expect(graph.calls[0].body).toMatchObject({ subject: 'Application', toRecipients: [{ emailAddress: { address: '[email protected]' } }] })
expect(graph.calls[0].headers.Prefer).toBe('IdType="ImmutableId"')
// every call on the draft carries the immutable-id preference (the pre-authenticated upload URL takes no headers of ours)
const onGraph = graph.calls.filter((c) => c.url.startsWith('https://graph.microsoft.com/'))
expect(onGraph.length).toBeGreaterThanOrEqual(6)
expect(onGraph.every((c) => c.headers.Prefer === 'IdType="ImmutableId"')).toBe(true)
expect((graph.calls[1].body as { AttachmentItem: unknown }).AttachmentItem).toMatchObject({ name: 'cv.pdf', attachmentType: 'file', size: 10 * MB })
// Every byte, in order, in pieces under 4 MB, without the bearer token on the pre-authenticated URL.
expect(Buffer.compare(Buffer.concat(graph.uploaded), bytes(10 * MB))).toBe(0)