Skip to main content

Security

The API defends itself against floods and guessing. Its counters live in Valkey, so every replica enforces the same limits. The security settings section tunes it.

The client's address​

Limits and the audit log need the address of the real client, not of the ingress in front of the API. The API follows X-Forwarded-For from its peer backwards, through every address in security.trusted_proxies, and takes the first one that is not a trusted proxy. The default trusts the private ranges, where the ingress controller and cluster networking live. A client coming through the ingress cannot pose as another by sending a forged X-Forwarded-For, because only what trusted proxies appended is followed.

A pod of the cluster that reached the API directly would be a trusted proxy itself, and workspaces are pods of the cluster. The chart therefore gives the API servers a network policy that admits only the ingress controller (networkPolicy.ingressNamespace), the bundled worker's agents and the bundled Prometheus, and lets only the API servers reach PostgreSQL and Valkey; add other peers, such as your own Prometheus, under networkPolicy.apiserverFrom. Policies only hold where the cluster's network enforces them (see Network): elsewhere, narrow trusted_proxies to the addresses of the ingress controller's pods. Valkey requires a password either way.

Behind Cloudflare or another proxy outside the cluster, either add its address ranges to trusted_proxies, or set security.client_ip_source to a preset (cf_connecting_ip, x_real_ip, true_client_ip) or custom with security.client_ip_header (for example Fly-Client-IP; X-Forwarded-For is rejected as a custom header—use x_forwarded_for instead). Set a single-value header only if nothing can reach the ingress around that proxy: anyone who can is believed.

Request rates​

SettingDefaultLimits
address_requests_per_minute3000Requests of one client address. Many people may share an address, a classroom behind NAT for example.
credential_requests_per_minute600Requests made with one access or API token.

A request over the limit is answered with 429, the code too_many_requests and a Retry-After header. 0 turns a limit off. The ingress authorizing workspace traffic (/v1/auth/workspace) is never limited.

Guessing passwords and codes​

Every password sign-in, every second-factor code and every password confirmation (changing the password, removing a second factor) takes one of the account's guesses before it is checked, so that concurrent attempts cannot slip under the limit. A complete sign-in gives the account its guesses back; knowing the password alone does not, so a second factor cannot be guessed by signing in again and again.

SettingDefault
account_failures5Guesses of one account within the window.
address_failures30Failed guesses from one address within the window, whichever account.
failure_window_s900The window. Afterwards one more guess is allowed every window divided by the limit: every three minutes by default.

An address over its limit waits (429, too_many_attempts). An account over its limit waits too, unless Cloudflare Turnstile is on, in which case signing in asks for a challenge instead. Anybody may make an account wait by guessing its password; with Turnstile, its owner solves a challenge and signs in at once. Accounts that sign in through an identity provider are not affected.

An administrator sees on a user's page whether the account is blocked, and Unblock sign-in gives it its guesses back (DELETE /v1/users/{user_id}/sign-in/failures, recorded as user.unblock).

Human verification​

Human verification protects password sign-in, password reset, and device sign-in against automated guessing. Providers are configured under security.captcha; Cloudflare Turnstile is supported first. Create a widget for the platform's host name in the Cloudflare dashboard, then:

values.yaml
settings:
security:
captcha:
provider: turnstile # off or turnstile
mode: failures # failures or always
turnstile:
site_key: 0x4AAAAAAA...
secret_key: 0x4AAAAAAA...
SettingMeaning
provider: offDisabled. Accounts guessed at wait instead.
provider: turnstile + mode: failuresPassword sign-in asks for a challenge once the account has used its guesses.
provider: turnstile + mode: alwaysPassword sign-in, forgot-password, and device sign-in always ask for a challenge.

The API checks each token with the configured provider, bound to the action (login, forgot, or device). When the verifier cannot be reached, the attempt is refused with 503 and captcha_unavailable: a challenge that cannot be checked was not passed. Sign-in through identity providers never asks for one. For Turnstile, the sign-in page loads the widget from challenges.cloudflare.com, which browsers must be able to reach.

With always, a command-line client that starts a device sign-in (POST /v1/auth/device) is asked for one too, bound to the action device. idk login cannot answer it: its users sign in with an API token they made (idk login --token).

Headers​

Every API response carries X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy: no-referrer, Cache-Control: no-store unless the endpoint caches on purpose, and an X-Request-ID (the ingress's, when it sends one) that also appears in the API's logs.

The web UI is served with a Content Security Policy that allows scripts and frames only from the platform itself and from Cloudflare Turnstile, and with X-Frame-Options: DENY, Strict-Transport-Security and a Permissions-Policy that turns off the camera, microphone, location and payments.

Git credentials and transport​

When the Git plugin is enabled, workspace credentials follow least privilege and stay off disk:

  • HTTPS by default, never embedded userinfo: Provider URLs, token hosts, and repository URLs reject embedded credentials (user:password@) unconditionally and require https:// unless an administrator explicitly enables git.allow_insecure_http.
  • In-memory Unix socket IPC: The sidecar holds credentials strictly in memory (never writing a plaintext credentials file into /run/idekube) and serves them over /run/idekube/git.sock with SO_PEERCRED peer-UID verification rejecting nobody (UID 65534).
  • Repository-scoped and mode-restricted: Only workspaces in a user's personal team with attached repositories receive credentials, scoped via credential.useHttpPath=true to the exact attached (scheme, host, path). Workspaces with zero repositories receive none, and clone_only credentials are purged from sidecar memory immediately after initial clone.
  • Upstream revocation on unlink: Disconnecting a GitHub or GitLab account revokes the upstream OAuth grant or tokens outside any database transaction before removing the local record, failing closed unless the user explicitly confirms a forced local disconnect.

Rotating the secret key​

The secret key signs tokens and seals what the platform must read back, such as second-factor seeds and Git tokens. To replace it, after a leak for example, set the new key and keep the old one among the previous keys:

values.yaml
secretKey: <new key>
previousSecretKeys: [<old key>]

Tokens and sealed values name the key that made them: the platform signs and seals with the new key and still checks and opens what the old one did, so nobody is signed out and nothing sealed is lost. Once the old key's tokens have expired, a day at most, and what it sealed has been written again, drop it from previousSecretKeys. Values derived from the key, such as pseudonyms, follow the new key at once.