Validate Host and refuse Origin at the HTTP boundary #40

Merged
Collaborator

Add a loopback-default Host allowlist and repeatable serve option, refuse Origin headers before capacity and authentication checks, and document the transport behavior. Cover the guard with unit and served-process tests.

Closes #39
Co-Authored-By: gpt-6.1-terra noreply@openai.com

Add a loopback-default Host allowlist and repeatable serve option, refuse Origin headers before capacity and authentication checks, and document the transport behavior. Cover the guard with unit and served-process tests. Closes #39 Co-Authored-By: gpt-6.1-terra <noreply@openai.com>
Validate Host and refuse Origin at the HTTP boundary
All checks were successful
ci/woodpecker/pr/validation Pipeline was successful
99bbcf6554
Add a loopback-default Host allowlist and repeatable serve option, refuse Origin headers before capacity and authentication checks, and document the transport behavior. Cover the guard with unit and served-process tests.

Closes #39
Co-Authored-By: gpt-6.1-terra <noreply@openai.com>
Address HTTP boundary review findings
All checks were successful
ci/woodpecker/pr/validation Pipeline was successful
7c8d16963f

This was generated by AI during the merge gate.

Merge gate record: PR #40 (#39), head 7c8d16963f

Gate run by minds-guide@voyager under the operator's standing grant (delegation operator-word-d982c2768589).

Reviews. These are independent sub-agents with no shared context, run on a detached worktree at the exact head.

Lens Round 1 (99bbcf65) Round 2 (7c8d1696)
Spec (spec and #39 rulings 1-5) FAIL, 1 nit: the no-echo check could not fail PASS, 0 findings. A mutation test shows header, token and body echoes all go red
Standards (repo standards: pyproject, ADRs, glossary, neighbouring code) FAIL, 3 nits PASS, 0 findings. Nit 3 (rename --allowed-host) was dropped because the spec names the option
Security (§19) PASS Not re-run. The delta changes only test code and drops the text of an exception that is never shown

Security review (§19), summary. The reviewer probed the real served app (uvicorn and h11) over raw sockets.

  • Host matching is exact, against a frozenset of loopback names plus the --allowed-host values. It fails closed with 421 for:
    • a trailing dot;
    • a non-canonical IPv6 form;
    • userinfo;
    • an empty port;
    • non-ASCII;
    • a missing Host;
    • a duplicate Host.
  • Any Origin header gets 403 origin_refused, whatever its case or value, including an empty value, null and duplicates.
  • Both checks run before the capacity slot, the bearer check and the body read. A refused request takes no slot, gets no 401 and reads no body.
  • --allowed-host refuses wildcards, schemes, ports, paths, userinfo and non-ASCII values. An invalid value maps to the fixed invalid_arguments and is not echoed.
  • Refusal bodies are fixed, and no header value or token appears in a body, a response header or the log.
  • A websocket upgrade to /mcp, /mcp/ or / gets 403, which closes spec open risk 4 by evidence.
  • Info finding: the Boundary still passes websocket scopes through, so the refusal depends on fastmcp's Route matching only http. This is filed as #41 (ready-for-human, after #35), per the operator ruling.

CI. Pipeline 46 is success on the exact head 7c8d1696, with raw logs audited:

  • 4 steps, 0 failure signatures;
  • quality is clean;
  • unit: 427 passed;
  • real-http-transport: 66 passed.

Integrate. The locked-environment exact-head integrate on 7c8d1696 has readyForMerge true, testResult green, verifiedCommitSha 7c8d1696 and 0 rework rounds. The first integrate on 99bbcf65 escalated only because the runner ran pytest --collect-only with bare system Python and not the locked environment. That was a runner-environment defect, not a code defect.

Merge. Pinned to head 7c8d1696 with codex-svd pinned-merge, which refuses while a live SVD run holds this repository.

> *This was generated by AI during the merge gate.* ## Merge gate record: PR #40 (#39), head 7c8d16963fbe7a6115c4b10ad598759becdee17c Gate run by minds-guide@voyager under the operator's standing grant (delegation `operator-word-d982c2768589`). **Reviews.** These are independent sub-agents with no shared context, run on a detached worktree at the exact head. | Lens | Round 1 (99bbcf65) | Round 2 (7c8d1696) | | --- | --- | --- | | Spec (spec and #39 rulings 1-5) | FAIL, 1 nit: the no-echo check could not fail | PASS, 0 findings. A mutation test shows header, token and body echoes all go red | | Standards (repo standards: pyproject, ADRs, glossary, neighbouring code) | FAIL, 3 nits | PASS, 0 findings. Nit 3 (rename `--allowed-host`) was dropped because the spec names the option | | Security (§19) | PASS | Not re-run. The delta changes only test code and drops the text of an exception that is never shown | **Security review (§19), summary.** The reviewer probed the real served app (uvicorn and h11) over raw sockets. - Host matching is exact, against a frozenset of loopback names plus the `--allowed-host` values. It fails closed with 421 for: - a trailing dot; - a non-canonical IPv6 form; - userinfo; - an empty port; - non-ASCII; - a missing Host; - a duplicate Host. - Any `Origin` header gets 403 `origin_refused`, whatever its case or value, including an empty value, `null` and duplicates. - Both checks run before the capacity slot, the bearer check and the body read. A refused request takes no slot, gets no 401 and reads no body. - `--allowed-host` refuses wildcards, schemes, ports, paths, userinfo and non-ASCII values. An invalid value maps to the fixed `invalid_arguments` and is not echoed. - Refusal bodies are fixed, and no header value or token appears in a body, a response header or the log. - A websocket upgrade to `/mcp`, `/mcp/` or `/` gets 403, which closes spec open risk 4 by evidence. - Info finding: the `Boundary` still passes websocket scopes through, so the refusal depends on fastmcp's `Route` matching only `http`. This is filed as #41 (ready-for-human, after #35), per the operator ruling. **CI.** Pipeline 46 is `success` on the exact head 7c8d1696, with raw logs audited: - 4 steps, 0 failure signatures; - quality is clean; - unit: 427 passed; - real-http-transport: 66 passed. **Integrate.** The locked-environment exact-head integrate on 7c8d1696 has `readyForMerge` true, `testResult` green, `verifiedCommitSha` 7c8d1696 and 0 rework rounds. The first integrate on 99bbcf65 escalated only because the runner ran `pytest --collect-only` with bare system Python and not the locked environment. That was a runner-environment defect, not a code defect. **Merge.** Pinned to head 7c8d1696 with `codex-svd pinned-merge`, which refuses while a live SVD run holds this repository.
svc-svd-writer deleted branch feat/svd-dev-attention-mind-mcp-39-streamable-http-endpoint-v-64403f95 2026-11-20 02:04:05 +00:00
Sign in to join this conversation.
No description provided.