mcl-rag#23: the local HTTP API refuses a rebound Host, a non-JSON write and a cross-site Origin #24
Loading…
Reference in a new issue
No description provided.
Delete branch "uranus/23-http-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #23. Purpose (security): a web page the owner opens can neither write to nor read the corpus through the loopback HTTP API.
mcl_rag_http_guardis a cowboy middleware that runs ahead ofcowboy_router, so every route passes it before a handler runs or a body is read:Hostother than localhost, 127.0.0.1, ::1 or a name in the newMCL_RAG_HTTP_HOSTSgets 400host_not_allowed, on every method;application/json, parameters allowed, or it gets 415;Origin, it must name an allowed host,nullincluded, or it gets 403.Tests:
test/mcl_rag_http_guard_SUITE.erl(10 cases) goes over a raw socket. Each refused write is checked against the store and has stored nothing.e788b77alone fails 7 of the 10.c191c6b, all green:rebar3 lint, eunit (233), ct (74) and dialyzer.Threat model: issue comment 7330. Done-when 3 holds: no new check or job.