asobi_body_cap_plugin (asobi v0.75.1)
View SourcePre-request plugin that caps HTTP request body size.
Runs before nova_request_plugin so we can short-circuit oversized requests
with 413 before any body bytes are buffered into BEAM heap.
H2 (2026-05-19): without this cap, an authenticated client could POST a
multi-GB JSON body to any /api/v1/** endpoint and OOM the node before the
controller's per-route check (e.g. MAX_SAVE_DATA_BYTES) ever ran.
Options: max_body => non_neg_integer() %% bytes, default 1 MiB require_content_length => boolean()%% reject chunked w/o content-length, default true
Summary
Functions
-spec plugin_info() -> map().
-spec post_request(cowboy_req:req(), map(), map(), term()) -> {ok, cowboy_req:req(), term()}.
-spec pre_request(cowboy_req:req(), map(), map(), term()) -> {ok, cowboy_req:req(), term()} | {stop, cowboy_req:req(), term()}.