Skip to content

Auth

This page is how authentication works inside the API Worker. Setting up sign-in, the allowlists, connections and ending sessions are in Sign-in and sessions; the request header is in REST API.

Each request is identified once, where it enters the app, as one of two principals:

Principal Identified by Role
The operator Authorization: Bearer <FELIX_API_TOKEN>. The header is compared with the token by hashing both with SHA-256 and comparing the digests in constant time, so neither the token nor its length leaks through timing. Always an admin. Recorded as operator in approvals and the audit log.
A person A session token from sign-in, sent the same way. admin or member, from the allowlist that let them in. Recorded by their id, github:<id> or google:<id>.

A request with neither is anonymous. /health, /demo, the sign-in routes, the connection callbacks, preview links and signed triggers take no bearer token; every other route answers 401 without one. The operator token is the deployment’s own credential, for automation and the first admin; it is not tied to a person and cannot sign out (400 not_a_session).

There is no session store. A session is a token Felix signs (HS256, issuer felix, audience felix-api) with the person’s id, role, provider and name, and an expiry of FELIX_LOGIN_TTL_SECONDS (eight hours by default). It is checked on every request: signature, issuer, audience and expiry, with a minute of clock tolerance. There is no refresh; signing in again issues a new one.

Since the role is in the token, and the allowlist is read only at sign-in, a change to the allowlist reaches a person at their next sign-in: someone made a member keeps admin, and someone removed keeps their session, until it ends. To apply a change at once, end their sessions (POST /v1/people/<id>/revoke).

Ending sessions. Ending a person’s sessions records the time in the people registry, and a token issued at or before that second is refused from then on. Each server instance caches the record for up to 30 seconds, so an ending takes effect everywhere within 30 seconds, at once on the instance that made it. A registry that cannot be read refuses the session rather than risk letting an ended one through. Ending sessions does not remove anyone from the allowlist.

Keys. Every key sign-in uses is derived from FELIX_AUTH_KEY with HKDF, under a separate label for each use:

Key Seals or signs
Cookie key The sign-in flow cookie (state, PKCE verifier, nonce and return address, 10 minutes) and the one-time hand-off (60 seconds), with AES-256-GCM. Each sealed value is bound to its purpose, so one sealed for one step never opens as another.
Session key Session tokens.
Connection key The provider tokens people’s connections keep at rest, bound to the person and provider.

Rotating FELIX_AUTH_KEY therefore signs everyone out and leaves every stored connection unreadable, so people connect again.

Caller Threads Admin routes
Member Their own: threads they created. No: 403 forbidden.
Admin, operator Every thread. Yes.

A thread belongs to the person who created it (owner); one the operator token created has no owner. Every thread route checks the caller against the owner, and a thread the caller may not see answers 404 thread_not_found, as if it did not exist, so ids do not reveal whose threads are whose. Lists and search show a member only their own. The admin routes include the traces and metrics, the MCP endpoint, people and the audit log, and every settings change (agents, the GitHub list, the skill library’s reviews, documents, evals and workflows); members read most settings without changing them. Each page in Management API says who may use its routes.

A run acts for the thread’s owner, whoever starts it: the owner, an admin, a schedule or a trigger. Its memories and connections are the owner’s, and a run on a thread with no owner has neither.

With the RATE_LIMITER binding, every /v1/ request is counted before it is routed, sign-in included, against 300 units a minute in each Cloudflare location (the binding’s limit and period):

Caller Counted as
A signed-in person Their own allowance.
The operator token One shared operator allowance.
Anonymous An allowance per client address (an IPv6 address by its /64), which slows token guessing without throttling anyone signed in.

A signed-in person and the operator each have two allowances: one for reads (GET and HEAD) and one for everything else, so what open pages read cannot refuse an action.

A run request, an MCP call or starting a sign-in (authorize, device) costs 10 units, anything else 1. Over the limit, the API answers 429 rate_limited with retry-after: 60. /health is never counted, and calls the MCP endpoint makes to the API in process were counted with the MCP request. Starting a terminal sign-in has its own limit: 10 an hour per client address and 300 an hour for the deployment, counted in memory by each Worker isolate, so it is best effort rather than exact.

Triggers into a deployment and webhooks out of it are signed with FELIX_SIGNING_SECRET instead of carrying a token: HMAC-SHA256 over <timestamp>.<body>, sent as felix-signature: sha256=<hex> with felix-timestamp. A timestamp more than five minutes off is refused, the comparison is the platform’s constant-time verify, and each signature on a trigger or a workflow signal is accepted once across the deployment, whatever thread or run it names. See Scheduling and runs.

The model never holds a credential, and no route returns one.

Credential Kept Used
A person’s GitHub or Google connection Sealed per person: in a THREADS Durable Object by default, or with FELIX_STORES=postgres in the felix_connections table, through the CONNECTIONS Hyperdrive binding (a role that reaches only that table) when it is bound and STORES otherwise. Refreshed within five minutes of expiry. By the Worker, for that person’s own threads: github_get and the GitHub write tools call GitHub with it, and the sandbox’s egress handler adds it only to requests for the checked-out repository.
Hosted MCP server headers Worker secrets, named as ${NAME} in FELIX_MCP_SERVERS. Sent to that server only.
GITHUB_TOKEN A Worker secret. Skill imports from public repositories, for a higher rate limit.
Model provider keys Worker secrets or bindings. Inference only.

The audit log names the people and ids involved in each change, never a token, a prompt or a decision’s note. See Ending sessions, and the audit log.