Security

laravel-rust-mcp-oauth Alpha Laravel for Rust

This page lists what the crate does against each attack on an MCP sign-in, and how to report a vulnerability.

AttackWhat the crate does
An app pretends to be Claude or ChatGPTThe selected HTTPS callback must be tied to a known client for verification. A known registration using a local callback gets a prompt that shows the claimed name. Unreviewed look-alikes get a cancel warning. Each connection requires approval
A stolen authorization codePKCE S256 is required. Codes work once, live 5 minutes and are bound to the client, callback, challenge, resource and scopes. A second use revokes what the first one got
A stolen refresh tokenTokens rotate on every refresh. An old one coming back outside a 2-minute retry window revokes the whole grant
A code sent to the wrong placeCallbacks must match a registered one exactly. Errors before the client and callback are trusted never redirect. Dangerous schemes, user names in URLs and .. tricks are refused
A token for another serverEach table set serves one MCP resource. Give different resources different table prefixes. Redirects carry iss (RFC 9207)
A 401 challenge prompts clients to request privileged scopesThe challenge offers the route's required scopes or the first configured scope, plus offline_access
An approval inherits broader scopesA grant is reused only for the same scope set. Tokens carry the approved scopes
Guest access across transportsGuest methods require one JSON-RPC 2.0 message in an application/json POST. The guard handles OPTIONS itself
Two account IDs compare as oneString account keys compare byte for byte
An older metadata fetch restores a removed callbackA permanent failure or callback removal clears the stored callbacks, including on the first fetch. When versions conflict, the store keeps only callbacks shared by both versions. An empty intersection leaves the registration invalidated
A callback is removed while the person approves or before the client exchanges a codeApproval and code exchange check the current callbacks on the writer inside their transactions
Cross-site requests and framingThe approval form has a CSRF token, and the page can't be framed or cached. The redirect that carries a code sends no Referer
Reaching your network through a metadata URLFetching uses HTTPS on 443 only and public addresses only, checked after resolution, with the connection pinned to them. No redirects, proxies or cookies, 5 seconds, 10 KB
A forged Host headerEvery advertised URL comes from APP_URL, never from the request
DNS rebinding against /mcpMcpAuthenticate refuses browser origins other than APP_URL's and the ones you allow
Flooding the endpointsPer-address limits on authorization (before any fetch), registration, token exchange and revocation. Per-account limits on approvals
A database leakOnly SHA-256 digests of 256-bit random tokens are stored
Tokens in logsDebug output redacts credentials, including the Location header of every callback redirect, including denials and other errors
A suspended user keeps accessYour can_use hook runs on every request; revoke_all ends every connection
Revocation with an old or unrelated tokenThe endpoint requires the public client ID and a live token issued to that client before it revokes the grant
A pending approval disappears during pruningUnexpired pending approvals keep their client registrations
A database outage logging everyone outA token that can't be checked gets 503, not 401

Reporting a vulnerability

Please report it privately through GitHub's private vulnerability reporting, not in a public issue. See SECURITY.md.