mcl-rag#26: cross-site reads refused, whole-host matching pinned, malformed MCL_RAG_HTTP_HOSTS entries named #28

Manually merged
terra merged 4 commits from saturnus/26-http-guard-follow-ups into main 2026-12-01 15:13:30 +00:00
Member

Purpose (hardening): close the three gaps Jupiter's review of #23 left open in the HTTP guard.

Refs #26 (the threat model and the GET probe are in c7454)

  • Cross-site reads. A request the browser marks Sec-Fetch-Site: cross-site is refused with 403 cross_site_request on every method, reads included. The probe found no content leak (no Access-Control-* header, preflight 415, no JSONP shape, no side effects). It did find a timing and size oracle: by-source returns 5550 bytes for a guessed path that exists and 12 for one that does not, and each search costs CPU. same-origin, same-site and none pass, as does a request without the header (curl, measure.py).
  • Pins.
    • Host 127.0.0.1.evil.example, localhost.evil.example and evil-localhost are refused;
    • Origin http://localhost.evil.example and the like cannot write;
    • PUT, PATCH and DELETE are held to JSON and to a local Origin.
  • Malformed MCL_RAG_HTTP_HOSTS entries. One with a scheme, a port or a path is named in a warning when the listener starts. The boot goes on, since the API still answers under localhost. IP addresses, bracketed or not, are bare.
  • Red first. The cases were committed alone (509549f) and were red on the old guard for cross-site reads and the warning. 8 mutants were each caught by their case: host prefix, host suffix, origin prefix, origin suffix, POST-only writes, no cross-site check, every entry bare, and no warning at start.
  • Local runs. rebar3 ct (80 passed), eunit, dialyzer and lint are all green.
  • Out of scope, filed as #27: most handlers return a bare Req from init/2.
Purpose (hardening): close the three gaps Jupiter's review of #23 left open in the HTTP guard. Refs #26 (the threat model and the GET probe are in c7454) - **Cross-site reads.** A request the browser marks `Sec-Fetch-Site: cross-site` is refused with 403 `cross_site_request` on every method, reads included. The probe found no content leak (no `Access-Control-*` header, preflight 415, no JSONP shape, no side effects). It did find a timing and size oracle: by-source returns 5550 bytes for a guessed path that exists and 12 for one that does not, and each search costs CPU. `same-origin`, `same-site` and `none` pass, as does a request without the header (curl, measure.py). - **Pins.** - `Host` 127.0.0.1.evil.example, localhost.evil.example and evil-localhost are refused; - `Origin` http://localhost.evil.example and the like cannot write; - PUT, PATCH and DELETE are held to JSON and to a local Origin. - **Malformed `MCL_RAG_HTTP_HOSTS` entries.** One with a scheme, a port or a path is named in a warning when the listener starts. The boot goes on, since the API still answers under localhost. IP addresses, bracketed or not, are bare. - **Red first.** The cases were committed alone (509549f) and were red on the old guard for cross-site reads and the warning. 8 mutants were each caught by their case: host prefix, host suffix, origin prefix, origin suffix, POST-only writes, no cross-site check, every entry bare, and no warning at start. - **Local runs.** `rebar3 ct` (80 passed), eunit, dialyzer and lint are all green. - **Out of scope**, filed as #27: most handlers return a bare `Req` from `init/2`.
Red on 15752f4: a cross-site read is answered, and a malformed MCL_RAG_HTTP_HOSTS entry is named nowhere.
A cross-site page's no-cors GET gets an opaque reply, but its timing and size still tell the page whether a path it
guessed is in the store, and each search costs the box its work: a request the browser marks Sec-Fetch-Site:
cross-site is refused with 403. An http_hosts entry with a scheme, a port or a path never matches; the listener's
start names each one in a warning, and the boot goes on.
mcl-rag#26: changelog
Some checks failed
c4 model / c4-model-1 (pull_request) Successful in 3s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Has been cancelled
lint-and-test / The tested lock arrives whole (pull_request) Has been cancelled
d2b4783ee2
mcl-rag#26 review: a Cross-Site header in another case is refused; the READMEs name the 403; the CHANGELOG says where the header is sent
All checks were successful
c4 model / c4-model-1 (pull_request) Successful in 5s
c4 model / c4-model (pull_request) Successful in 0s
lint-and-test / check (pull_request) Successful in 6m27s
lint-and-test / The tested lock arrives whole (pull_request) Successful in 1s
build-and-push / guard-1 (push) Successful in 4s
c4 model / c4-model-1 (push) Successful in 4s
c4 model / c4-model (push) Successful in 0s
build-and-push / check (push) Successful in 7m18s
build-and-push / The tested lock arrives whole (push) Has been skipped
build-and-push / test (push) Successful in 0s
build-and-push / Release (forge, v* tag) (push) Has been skipped
build-and-push / build-and-push (push) Successful in 3s
build-and-push / File the tested resolve for the signer (push) Successful in 2s
build-and-push / guard (push) Successful in 0s
build-and-push / attest (push) Successful in 0s
lint-and-test / check (push) Successful in 6m59s
lint-and-test / The tested lock arrives whole (push) Has been skipped
0397a80810
terra manually merged commit 0397a80810 into main 2026-12-01 15:13:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
macula-services/mcl-rag!28
No description provided.