fitzgen opened PR #15315 from fitzgen:main-backport-53c37d2015 to bytecodealliance:main:
Empty body writes have been shown to be a vector for unmetered heap growth in some http implementations. Drop these writes while still maintaining behavior that guest's may rely on.
For p2
BodyWriteStream, empty writes are dropped butErr(StreamError::Closed)is still returned if the underlying writer is closed.For p3
{Limited,Unlimited}GuestBodyConsumeremtpy writes will maintain the same behavior of waiting until there is capacity to write (Ready) but at the time that we would have previously written the empty buffer over channels, we just mark the chunk as completed without being sent avoiding potential unbound memory growth channels in backing implementations, including hyper/h2.Neither p2 or p3
wasi:httpspecifies behavior for empty body writes, and body contents are a byte stream with no defined mapping onto HTTP framing, so skipping them leaves the transmitted body unchanged:
- p2: wasi:io
output-stream.writeonly requires thatcontentsfit thecheck-writepermit and thatclosedbe returned if the stream has closed. An empty write now returnsOk(()), orclosedonce the body's receiver is gone.- p3: the Component Model treats a zero-length
stream.writeas a readiness probe whose completion is "allowed (but not required) to wait ... until the other end is 'ready'". An empty write now waits for channel capacity, as before, and completes with 0 items without forwarding anything.GHSA-f8mm-ggr3-89wh
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested rvolosatovs for a review on PR #15315.
fitzgen requested wasmtime-wasi-reviewers for a review on PR #15315.
fitzgen removed the review request for wasmtime-wasi-reviewers from PR #15315.
alexcrichton has enabled auto merge for PR #15315.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #15315 wasi-http p2/p3: drop empty body writes to the merge queue.
:check: alexcrichton merged PR #15315.
alexcrichton removed PR #15315 wasi-http p2/p3: drop empty body writes from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC