Docs

Security model

How Neurouter authenticates people and agents, authorizes every MCP tool call, stores upstream credentials, guards outbound requests and protects its web console.

Last updated: 2026-11-24 · Markdown

This page summarizes the controls in the gateway. To report a vulnerability, see the security policy.

Identity

  • People sign in with OpenID Connect (authorization code with PKCE, state and nonce). Sessions are server-side, in HttpOnly cookies with CSRF tokens. Users without a verified email are rejected when the provider sends email_verified.
  • Roles: Admin, Auditor (read-only), Server Owner and User. Admin and Auditor can be mapped from identity-provider groups (OIDC_ADMIN_GROUPS, OIDC_AUDITOR_GROUPS); groups can be synced from the groups claim.
  • Agents are identities owned by a user. They authenticate to /mcp with an API key or an OAuth access token issued by Neurouter's own authorization server, and the audit log records "agent X on behalf of user Y".
  • AUTH_DEV_LOGIN (email-only login) is refused outside development.

Neurouter's authorization server

Neurouter is an OAuth 2.1 authorization server for MCP clients and a resource server for /mcp:

  • protected resource metadata (RFC 9728) with a 401 WWW-Authenticate challenge, and authorization server metadata (RFC 8414);
  • client ID metadata documents, with optional dynamic registration for compatibility;
  • PKCE with S256, exact redirect URI matching, per-client consent;
  • audience-bound access tokens (RFC 8707) and rotating refresh tokens.

No token passthrough. Client tokens are never forwarded upstream, as the MCP specification requires.

Authorization

  • Grants allow or deny a server or a single tool for a user, a group or an agent. Deny wins. An agent can be narrowed below its owner's access.
  • A tool the caller may not use is indistinguishable from an unknown tool, in search results and in errors.
  • Admins and owners hold no implicit access to tools: access comes from explicit grants.
  • See Access control.

Tool pinning

Each upstream tool definition (description and schema) is hashed and must be approved. If a server changes a definition, the tool is blocked until an owner re-approves it, which guards against "rug pull" changes. Arguments are validated against the pinned schema. See Tool pinning.

Human approval

Tools flagged requires_approval are held until an owner or admin approves. By default the person who made the request cannot approve it. See Approvals.

Upstream credentials

Shared bearer tokens, custom headers and per-user upstream OAuth tokens are envelope-encrypted: each secret is encrypted with AES-256-GCM under a data key, and data keys are wrapped by your key-encryption keys (NEUROUTER_MASTER_KEYS). Both layers rotate without downtime; see Deployment.

Outbound requests

Requests to upstream servers and other outbound fetches are guarded against server-side request forgery. Cloud metadata ranges are always denied; private networks are configurable with UPSTREAM_ALLOW_PRIVATE_NETWORKS and OUTBOUND_ALLOW_PRIVATE_NETWORKS.

Audit

Every MCP call, search, admin change and sign-in is audited, with redaction rules applied before storage so secrets in arguments are never written. The log is hash-chained with signed checkpoints. See Audit log.

Web console

Strict Content Security Policy (default-src 'self', no inline script) and frame-ancestors 'none'. /mcp checks Origin against PUBLIC_URL and MCP_ALLOWED_ORIGINS.

API keys

API keys use a fixed, scannable prefix (nr_live_). Only an HMAC of the secret, peppered with HASH_PEPPER, is stored. A revoked key stops working immediately on every replica.