Follow-up from code review on the MCP server feature (#50).
The MCP server's OAuth endpoints (/register, /authorize, /token) are publicly reachable via Cloudflare Tunnel. The Zod field-length caps landed inline in #50; the remaining DoS surface is in this issue.
- No rate limit on
/register, /authorize, /token. An attacker could spam any of these to fill auth.db on the phone or burn cycles. Either coarse per-IP token bucket via Hono middleware, or a Cloudflare WAF rule at the edge.
- No cleanup of unused DCR clients. Each
POST /register creates a row; if the client never completes an OAuth flow, the row sticks forever. Add a janitor that deletes clients with no associated tokens older than 24h.
- No purge of expired rows in
access_tokens / auth_codes. Indexes on expires_at exist but unused. Add a startup-time DELETE WHERE expires_at < ? (and re-run every 24h).
- No body-size limit on POST endpoints. A multi-GB POST to
/token or /register would be fully buffered. Add hono/body-limit middleware (16 KB for OAuth, 256 KB for /mcp).
Source: review of feature/mcp-server-#50.
Follow-up from code review on the MCP server feature (#50).
The MCP server's OAuth endpoints (
/register,/authorize,/token) are publicly reachable via Cloudflare Tunnel. The Zod field-length caps landed inline in #50; the remaining DoS surface is in this issue./register,/authorize,/token. An attacker could spam any of these to fillauth.dbon the phone or burn cycles. Either coarse per-IP token bucket via Hono middleware, or a Cloudflare WAF rule at the edge.POST /registercreates a row; if the client never completes an OAuth flow, the row sticks forever. Add a janitor that deletes clients with no associated tokens older than 24h.access_tokens/auth_codes. Indexes onexpires_atexist but unused. Add a startup-timeDELETE WHERE expires_at < ?(and re-run every 24h)./tokenor/registerwould be fully buffered. Addhono/body-limitmiddleware (16 KB for OAuth, 256 KB for/mcp).Source: review of feature/mcp-server-#50.