Skip to content

Hosts should be able to limit the size of wasi:http/types.fields #889

@alexcrichton

Description

@alexcrichton

Currently guests are allowed to create an infinitely sized fields type representing http-headers and infinitely append headers to it. This was a subject of a CVE recently for Wasmtime as this represents a vector of resource exhaustion on the host that can be induced by a guest.

Currently appending a header to fields is allowed to fail, but none of the error reasons cover the situation of "headers are full". Additionally there are no documented limits for what's reasonable for guests to be expected to store in headers. Currently Wasmtime has an arbitrary limit that generates a trap if the guest exceeds it, but this is seen as a temporary band-aid (similar to #888).

Ideally it would be possible for hosts to return a first-class error to the wasm guest indicating "headers are too large" or something like that. Additionally it would be ideal if WASI could document what size of headers hosts are expected to handle on behalf of guests.

Effectively I'd like to make -Smax-http-fields-size=N effectively a noop in Wasmtime by enabling guests to handle any configuration. I'm not sure how best this should work out at the API level in WASI, but at least in my opinion there would ideally be some affordance for "host's aren't forced to buffer infinitely"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions