Ideon Logo
Ideon

Security Model

Ideon secures requests at multiple layers: proxy, API route validation, database row level security in Postgres, and WebSocket authorization.

Proxy Security Headers

The proxy applies these headers to pages and API routes:

  • Content Security Policy: Restricts content to the same origin, with a per-request nonce for scripts. Framing is blocked with frame-ancestors 'none', and plugins with object-src 'none'.
  • Framing and sniffing: X-Frame-Options: DENY and X-Content-Type-Options: nosniff.
  • Referrer and permissions: Referrer-Policy: strict-origin-when-cross-origin, and camera, microphone and geolocation are disabled.
  • HTTPS: When APP_URL starts with https://, Ideon adds HSTS (one year, including subdomains) and upgrade-insecure-requests.

The MCP endpoint (/api/mcp) and webhook endpoints (/webhooks/...) are served before the Next.js proxy runs, so these headers and the session check do not apply to them. They have their own authentication, described below.

Authentication and Authorization

  • Auth is handled by NextAuth with JWT sessions. The session cookie is httpOnly and SameSite=Lax, and is marked secure when APP_URL is HTTPS.
  • API routes enforce authentication with shared server utilities, and project routes check the caller's role before running.
  • Admin endpoints require admin or superadmin roles.
  • Passwords are hashed with Argon2.

API Keys

API keys (sk-ideon-...) are stored as SHA-256 hashes and act as the user who created them, with the same project roles. They are accepted only by the MCP endpoint and by webhook endpoints. All other API routes use the session cookie.

Secrets and Encryption

All internal secrets are derived from SECRET_KEY with HKDF-SHA256: the session signing secret, the encryption key and the proxy authentication token secret.

  • Stored credentials: Git tokens and Vercel tokens are encrypted with AES-256-GCM, using a per-user salt.
  • Password reset tokens are stored as HMAC hashes and expire after one hour.
  • Rotating SECRET_KEY invalidates every active session. Credentials encrypted with the previous key can no longer be decrypted, so users have to enter their Git and Vercel tokens again.

Rate Limits

TargetLimit
Sign-in attempts5 per 15 minutes per identifier
Registration5 per 10 minutes
Forgot and reset password5 per 10 minutes per identifier
User invitations10 per hour per user
MCP requests60 per minute per API key
Webhooks30 per minute per webhook block

Production deployments on Postgres share the sign-in and account limits across instances. Development uses in-memory counters.

Database Row Level Security

Postgres uses row level security policies to scope data access per user. Each request sets app.current_user_id before DB queries. Public share links use a separate app.share_token setting that only exposes the shared project.

WebSocket Authorization

Realtime connections validate the user session and ensure the user has access to the requested project document. In production, the Origin header of the upgrade request must match APP_URL. Viewers can read a canvas but their changes are discarded, and the attempt is recorded in the audit trail.

Shell Block

The Shell block starts a real terminal on the host that runs Ideon. The shell process inherits the environment of the Ideon server, including its secrets. Only the project creator and project owners can start one, and SHELL_MAX_SESSIONS=0 disables the feature. Leave it disabled on instances shared with people you do not fully trust.

SSRF Protection

Link previews, image proxying, Git statistics and repository sync validate URLs and block restricted destinations before fetching. Use GIT_ALLOWED_HOSTS to explicitly allow internal Git servers.