mcl-bookclub#12: Host allow-list and Origin on POST for the admin listener (DNS rebinding) #13
Loading…
Reference in a new issue
No description provided.
Delete branch "mercurius/12-host-allow-list"
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?
Purpose (fix): a web page outside the LAN cannot send a command to the admin API, or read from it, by rebinding its own name to the box's LAN address. Erlang half; the Phoenix twin follows.
Threat model and Done-when: #12 (comment)
a991717red first: a rebound Host (POST, GET read, static UI) and a foreign Origin are served on main (4 failing, the IP/localhost/own-Origin cases passing).6e85920a cowboy middleware (mcl_bookclub_admin:execute/2, before the router) refuses with 403host_not_allowedany Host that is not an IP literal (v4/v6),localhost, or a name in the one new settingMCL_ADMIN_HOSTS(comma-separated, empty by default). A POST whoseOriginis nothttp://<its Host>:<port>(or isnull) gets 403origin_not_allowed. Docs: the module comment, guides/admin_ui.md (the overclaim is gone), architecture table, sys.config.src, Containerfile, compose, CHANGELOG.Behaviour change for the operator: reaching the UI by a DNS name now needs that name in
MCL_ADMIN_HOSTS. An IP or localhost needs nothing.Local (OTP 28.4.3): rebar3 lint, eunit 136/136, dialyzer clean. Mutant: with the Origin port compare dropped, the foreign-Origin test fails (1 of 17).
Refs #12