Streamable HTTP endpoint validates neither Origin nor Host #39
Labels
No labels
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:fire
svd:go
svd:hold
svd:respec
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/attention-mind-mcp#39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Filed under: operator word "go" sha256:4cd0e21a9a07
Summary
The served MCP endpoint accepts every
Originheader and everyHostheader. The MCP Streamable HTTP transport requiresOriginvalidation. The provider does not meet that requirement.Requirement
The MCP transport specification, revision 2025-11-25, section "Streamable HTTP", Security Warning, says:
The attention contract tells an external provider to implement that transport (section "Wire artifacts and mapping" at mind-spec
3da6a26). The draft connectivity requirement MCN-005 in mind-spec also says that Host/Origin controls remain valid for the route.Evidence
Checked at provider commit
3862272with the locked dependencies: fastmcp 3.4.11, mcp 1.30.0, starlette 1.10.0.Source reading:
http_app(path="/mcp", stateless_http=True, json_response=True). It passes nohost_origin_protection,allowed_hostsorallowed_origins.http_host_origin_protection = False. With that value fastmcp installs noHostOriginGuardMiddleware.security_settings. The mcp SDK then runs withenable_dns_rebinding_protection=False.Live probe on loopback, with a synthetic queue and a synthetic credential in temporary directories. Each request is an
initializePOST unless the row says otherwise.OriginOrigin: https://evil.exampleHost: evil.example:<port>Origin: nulltools/listOrigin: https://evil.exampleOPTIONSpreflight fromhttps://evil.example, no bearerAccess-Control-*headersExisting mitigation
Every request needs a bearer, including on loopback. A web page does not hold the token, and the preflight request fails. This lowers the severity. It does not meet the requirement.
Rulings
Piers made these rulings on 2026-11-20.
Originheader. It keeps no list of allowed origins. messages-mind uses the same policy.serveoption. The value is not stored with the queue.## Blocked by.Hostfirst, thenOrigin. It uses neither fastmcp's guard nor Starlette'sTrustedHostMiddleware.Known risk of ruling 1: it locks out any client that sends
Origin. Whether the Grok connector sendsOriginis not verified. A list of allowed origins is an additive change, and it needs a new ruling.Agent Brief
Category: bug
Summary: Validate
Hostand refuseOriginon every request to the MCP endpoint.Current behavior: The endpoint serves an authenticated request whatever its
OriginandHostheaders say.Desired behavior:
Hostheader is not on the allowlist gets HTTP 421.Originheader gets HTTP 403. This applies to every value, including a loopback origin andnull.Originheader passes the Origin check. A non-browser client sends none.serveoption.Key interfaces:
servecommand: one new repeatable option that names one allowed host for each use.host_origin_protection,allowed_hostsandallowed_originsonhttp_app. Its guard alone does not meet ruling 1. Read the notes below.Acceptance criteria:
Originsucceeds.Originreturns 403.Originreturns 403.Origin: nullreturns 403.Hostthat is not on the allowlist returns 421.Hostthat theserveoption names succeeds.serveoption.Out of scope:
Notes for the implementer
Originwhen theHostis loopback, in strict mode too. It therefore does not refuse everyOrigin."auto"mode decides from the local address of the connection. In an in-process probe with a simulated non-loopback address,"auto"let a foreignHostthrough. That probe did not run under uvicorn in a container, so verify the packaged case directly.Origin. mail-mind and people-mind allow listed hosts through Starlette'sTrustedHostMiddleware, and source reading finds noOrigincheck in either. Those two were not probed.Piers ruled on the implementation route on 2026-11-20. Ruling 5 in the issue body records it: the control is a guard in the repo's own ASGI boundary, with the
Hostcheck (421) before theOrigincheck (403), and both before the bearer check.Reasons: fastmcp's guard accepts a loopback
Originwhen theHostis loopback, so it does not meet ruling 1. Starlette'sTrustedHostMiddlewareanswers 400, not 421. messages-mind already uses the boundary-guard shape.The human act that this issue reserved is done, so the
## Human actsection is removed and the label moves toready-for-agent. The agent brief in the issue body is the specification. The attention seat drives the SVD run.One difference from messages-mind: this provider allows the loopback names by default. Do not make the host list a required setting.
⏸ SVD architect gate: dev/attention-mind-mcp#39 streamable-http-endpoint-validates-neither-origin-nor-host
Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
standard· dispatch effortmediumRun:
20261119T220620Z-16f00bfdHeld because: CLEAN but 4 open risk(s) (3 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
Change: Add the guard to Boundary.call in src/attention_mind_mcp/mcp_adapter.py, right after the non-http pass-through (:116-118) and before the capacity check (:119) and the bearer check in _http (:202-209). The checks are: exactly one Host whose host part (port stripped, lowercased) is in LOOPBACK_HOSTS={localhost,127.0.0.1,[::1]} (spelling from binding.py:53) plus the operator hosts, else _reply(421,{"error":"misdirected_request"}); then any Origin header, else _reply(403,{"error":"origin_refused"}). Mirror the _http header-scan shape (:203-205) and the fixed-body _reply calls (:94-107, :120). Add a public allowed_host() normaliser. Boundary/create_app gain an additive allowed_hosts kwarg; http_app (:307) stays argument-identical (no fastmcp guard). cli.py serve gains a repeatable --allowed-host (dest=allowed_hosts, action=append, type=allowed_host, default=[]), mirroring --grant at :55, passed only to create_app at :109 and never to Store. Reader fixes: tests/test_queries.py drive() gets a loopback Host; the two test_foundation Boundary tests move base_url from http://test to http://127.0.0.1; running_server gains an extra=() kwarg. New unit and transport tests go in tests/test_foundation.py. README :52/:110 document the control and the option.
Files:
src/attention_mind_mcp/mcp_adapter.py·src/attention_mind_mcp/cli.py·tests/test_foundation.py·tests/test_queries.py·README.mdDecision: accept the 4 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/src/attention-mind-mcp/data/svd39/specs/2026-11-19-streamable-http-endpoint-validates-neither-origin-nor-host.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/src/attention-mind-mcp/data/svd39/specs/2026-11-19-streamable-http-endpoint-validates-neither-origin-nor-host.mdlabel flip withheld (--no-label-writes); gate label is the orchestrator's act — attention
spec-verify-dispatch Half B for dev/attention-mind-mcp#39 streamable-http-endpoint-validates-neither-origin-nor-host completed integration verify.
99bbcf6554spec-verify-dispatch Half B for dev/attention-mind-mcp#39 streamable-http-endpoint-validates-neither-origin-nor-host completed integration verify.
99bbcf655499bbcf6554. Local: unit 427 passed, transport 66 passed, ruff check/format and mypy clean. No blockers.codex-svd ship --run-id 20261120T013017Z-64403f95available to a permitted seat)label flip withheld (--no-label-writes); gate label is the orchestrator's act — attention
spec-verify-dispatch Half B for dev/attention-mind-mcp#39 streamable-http-endpoint-validates-neither-origin-nor-host completed integration verify.
7c8d16963f7c8d16963f; local unit 427 passed, transport 66 passed, ruff/format/mypy clean.-k "host or origin or asgi"does not select test_create_app_installs_guard_without_framework_defaults or test_served_default_allowlist_is_loopback_only; both exist and ran in the full unit/transport suites.codex-svd ship --run-id 20261120T013017Z-64403f95available to a permitted seat)label flip withheld (--no-label-writes); gate label is the orchestrator's act — attention