Security model
What the API does to protect a deployment and its data, as the code does it today. To report a vulnerability, follow SECURITY.md.
Sign-in and passwords
- Passwords are stored as bcrypt hashes.
POST /api/v1/auth/loginandPOST /api/v1/auth/tokeneach take 10 requests a minute from one IP address; the next request in that minute is answered429 Too Many Requests.- In
stagingandproduction, the API does not start with aSECRET_KEYshorter than 32 characters, or with a well-knownFIRST_SUPERUSER_PASSWORDsuch as the demo one.
Roles
- A signed-in user's role,
ADMIN,DEVELOPER,ANALYSTorVIEWER, and a separate superuser flag decide what the user may do (RBAC). ANALYSTandVIEWERcannot create, change or delete experiments or feature flags.- Every role,
VIEWERincluded, can create an API key for itself, and an API key writes tracking data: assignments and events.
API keys
- An API key is stored only as a hash. Its value is shown once, in the response that creates it.
- A request that carries an API key and no sign-in is refused with
401by the routes that create, change or delete experiments and feature flags, and by the routes that manage users. - Four read operations also accept a key that carries the
mcp:readscope: listing feature flags, listing experiments, reading an experiment and reading its results. The key reads there as the user who created it, under that user's role; a key without the scope is refused with403. - The two routes a web page calls for the visual editor,
POST /api/v1/tracking/visualandPOST /api/v1/tracking/visual/preview, refuse a key that carries any scope with403: a key in a page can be read by anyone who opens it. - A deleted or expired key is refused with
401.
Response headers
- Every response except a CORS preflight carries
X-Frame-Options: DENY,X-Content-Type-Options: nosniffandContent-Security-Policy: default-src 'none'; frame-ancestors 'none'. - The two API reference pages,
/api/v1/docsand/api/v1/redoc, get a policy that also allows the scripts, styles and fonts they load. - Outside development, every response except a CORS preflight also carries
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload.