HTTP face hardening and log discipline (#17) #28
No reviewers
Labels
No labels
boundary:crosses
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/messages-mind-mcp!28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-17-http-hardening"
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?
Closes #17.
What this adds
The controls that a request passes before the framework reads it, in
src/messages_mind_mcp/face.py, and a log that holds counts, roles, codes and fault classes only.server.allowed_hosts, which is required and has no default (ADR 0011)421Originheader403server.rate_burst(20), thenserver.rate_per_second(5)429withRetry-After413,408Error: code=deadline-exceeded503400GET /healthzanswersok.GET /healthz/syncanswersokwhen a sync ended in the last 15 minutes, else503withunavailable. Neither needs a token. No sync runs yet, so the second answers503today.2xxis one fixed word. The MCP library writes request values into its error text, and the router's redirect for a trailing slash repeats the query.role=. A refusal is a count of its kind:refused=host count=3. A record of the HTTP server reaches the log only from a closed list of start and stop lines.Bearer.A change that breaks an existing config
[server]now needsallowed_hosts. A config without it is refused at startup.config.example.tomlshows the key.What the review found
The two-axis review found seven defects. All are closed in this commit.
POST /healthzwith a slow body skipped the rate limit. Only aGET /healthzwith no body is outside the limit.GET /mcp/?x=…returned a307whoseLocationrepeated the query. It is now404.rate_per_secondaccepted a string and a boolean.Tests
README.mdandSECURITY.mdwith the number in the code.make checkpasses on macOS with 270 tests. 37 mutation checks each fail a test.Choices for the reviewer
Origin, its own included. The issue says "a foreign Origin". No MCP client sends the header./healthz/syncis 15 minutes. The sync worker (#12) must agree with it./healthz/syncis inside the rate limit, so a flood from one address makes a monitor on that address read429.Limits that the documents state
🤖 Generated with Claude Code