Security Model¶
The API-token and session model that gates the
/api/*routers: threat model, scope matrix, token lifecycle, rate limits, auditability and the production hardening checklist.Closes BL-20260430-10 and BL-20260503-16. Operator-facing manual for the API-token model that gates
/api/agents/*,/api/analysis,/api/graph/*, and/api/lsat/*. Source of truth: docs/constitution.md §4 (provenance/audit) and §8 (security baselines).
Threat model summary¶
Law AI's product-runtime LLM defaults to Claude over the LLM_PROVIDER_CHAIN (local-only is an explicit LLM_PROVIDER_CHAIN=ollama pin, required for confidentiality-bound data — docs/constitution.md §1), while every other component (databases, graph store, ingestion) stays local-first regardless. The threat model assumes:
- Trusted LAN, untrusted internet. A self-hosted instance may be exposed beyond
localhost. In practice,HasScope.has_permission(backend/law_ai/core/auth.py) opens a route to unauthenticated traffic whenever the route's*_API_KEYsetting is empty — regardless ofENVIRONMENT. There is no code path that checksENVIRONMENTbefore granting this fallback, so a deployment that forgets to setAGENT_API_KEYis silently open on every gated router, not just in dev. Since BL-20260430-12,ENVIRONMENT=productionrefuses to boot while any gated router is open (law_ai.E001, see Hardening checklist); staging and every other non-development environment only log a warning, so treat "every*_API_KEYis set" as a hard operational requirement there too, not a convenience. - No multi-tenant isolation yet. Tokens are scope-gated, not user-gated — an
ApiTokenmay name an owner, but a scope still grants everything that scope reaches, and there are no roles. Per-user roles remain unbuilt; the JWT/OAuth half of BL-20260503-13 shipped and is documented under Authentication (bearer path). - Provenance is not optional. Every request through
ProvenanceMiddlewareand every LLM call throughlaw_ai.core.llmis auditable via theaudit.AuditEventlog (see Auditability) and, whenPHOENIX_COLLECTOR_ENDPOINTis configured, Phoenix traces. - Default-open posture whenever a router's key is unset.
HasScopegrants access when neither anApiTokenrow nor an env-configured*_API_KEYmatches the requested scope — this is what letsmake devwork with zero setup, but it is the same code path that makes an unconfigured production deployment open. See item 1. SECRET_KEYandALLOWED_HOSTSare part of the gate.SECRET_KEYsigns the HS256 access tokens of the bearer path and the LSAT answer-shuffle tokens the grade path trusts (lsat/services/shuffle.py), on top of Django's own signing, so whoever knows it can forge those signatures (a forged access token'skhclaim must still match a liveApiToken).ALLOWED_HOSTScontaining*turns off Django's Host-header validation, so a forgedHostreaches every absolute URL the app builds.settings/base.pyships a public development default for the first and["*"]for the second so thatmake devand the tests boot with no configuration;ENVIRONMENT=productionrefuses to boot on either (law_ai.E002,law_ai.E003, #221).
Authentication¶
Two independent mechanisms feed the same HasScope check, and it matters which one a request goes through:
- DB-token path:
ApiKeyAuthentication(core/auth.py) reads theX-API-Keyheader, SHA-256-hashes it, and looks up a non-revokedcore.ApiTokenrow bykey_hash. On a match,HasScopegrants access if the token'sscopeequals the route's scope or the token's scope is"agent"— anagent-scopedApiTokenis a master key across every gated router, mirroringAGENT_API_KEY's role among the env keys. - Env-key fallback path: when no header matches a DB token,
HasScopefalls back to whichever*_API_KEYDjango setting the route declares (e.g.ANALYSIS_API_KEY, falling back further toAGENT_API_KEY). If that setting has a value, the raw header is compared withsecrets.compare_digest(constant-time); if it's empty, the request is allowed through (see threat model item ¼). - Storage:
ApiToken.key_hashis the only persisted form of a key — there is no plaintext column.ApiToken.generate()(core/models.py) mints a random token and returns the plaintext once, but nothing in the codebase calls it today; the only way tokens actually get created isseed_api_keys, which registers a hash for a value the operator already chose (see below) rather than generating a new secret. - Session path (spec 036 FR-2 / BL-20260503-13): with no
X-API-Keyheader,ApiKeyAuthenticationdelegates to DRF'sSessionAuthentication, so an authenticated Django session is a credential in its own right and satisfiesHasScopeon every gated router. CSRF is enforced by DRF on unsafe methods exactly as it is for the admin. A session is additive: with no session cookie the class behaves identically to spec 011, so key-only and anonymous callers are unaffected.core.ApiTokenalso gained a nullableuserFK — a key bound to an owner authenticates as that user, which is what makes per-user quotas and ownership checks work for programmatic clients. The account routes themselves live at/api/auth/{csrf,login,logout,me}(core/urls_auth.py) and areAllowAny, because they are what establishes identity. The browser deliberately keeps using the cookie rather than the bearer path below (spec 036 RQ-1): the frontend is first-party and same-origin, so a cookie beats a bearer token in browser storage. - Bearer path (BL-20260503-13):
POST /api/auth/tokenis an RFC 6749 §4.4 client-credentials grant. A caller presents itsX-API-Keyonce and receives a short-lived HS256 JWT (15 min by default,JWT_ACCESS_TTL_SECONDS) plus a rotating refresh token; every subsequent request carriesAuthorization: Bearer <jwt>and the long-lived key stays out of the wire.law_ai.core.jwt_auth.JwtBearerAuthenticationdecodes the JWT withpython-jose, resolves its privatekhclaim back to theApiTokenrow, and hands DRF the same(actor, ApiToken)pair the header path produces — soHasScope, the throttles and the ownership checks need no bearer-specific branch, and a bearer token can never carry more scope than the key that minted it. Two revocation levers exist and they differ: revoking theApiTokeninvalidates every JWT minted from it immediately (the lookup filters onrevoked_at__isnull=True), whilePOST /api/auth/token/revoke(RFC 7009) kills only a refresh token. There is no way to recall an unexpired access token short of revoking itsApiToken, which is why the access TTL is minutes. Refresh tokens are stored selector/verifier style oncore.OAuthRefreshToken: a publichandlefor the lookup and apasslibpbkdf2-sha256 digest of the secret half — redeeming one rotates it (the presented row is marked revoked and points at its successor viarotated_to), so a replayed refresh token is a hard 400. The env-key fallback deliberately cannot mint a bearer token: an env key has noApiTokenrow, so there would be nothing to scope it to and nothing to revoke it by.python-joseandpasslibcome from the[future-auth]extra, whichbackend/Dockerfilenow installs. - Frontend: no key reaches the browser (BL-20260430-07).
frontend/lib/api.ts::apiFetchcalls the same-origin proxy routeapp/api/backend/[...path]/route.ts, which forwards toBACKEND_INTERNAL_URLand attachesX-API-Keyfrom a server-onlyAGENT_API_KEY. The agent-run WebSocket cannot be proxied by a route handler, soapp/api/ws-ticket/route.tsmints a stream-scoped ticket that expires in 60s (law_ai/core/ws_ticket.pyverifies it, andAgentRunConsumerstill accepts a raw key orX-API-Keyfor non-browser clients). Since BL-20260906-09 the socket also accepts the other two credentials the REST gate does — a provisionedagent-scopedApiToken, and an authenticated Django session off the ChannelsAuthMiddlewareStackscope — so a signed-in browser user holding no key can watch the run they just started.NEXT_PUBLIC_AGENT_API_KEYno longer exists. The proxy also carries the session: since BL-20260906-08 it forwards the browser'sCookieheader upstream and relays everySet-Cookieback individually, which is what letscomponents/shell/AccountMenu.tsxsign a user in through/api/auth/{csrf,login,logout,me}without the browser ever addressing the backend's origin. It stripsOriginandRefereron the way up — this hop is a server-side fetch, not a cross-origin browser request, and forwarding an origin the backend can never match would fail DRF's session CSRF check on every login. CSRF is still enforced, by the double-submit token:GET csrfsets the cookie and returns the token, and the write echoes it inX-CSRFToken.
Scope matrix¶
HasScope (a DRF BasePermission) is parameterised per route by the has_scope(scope, *fallback_envs) factory in law_ai.core.auth, producing RequireAgent / RequireAnalysis / RequireGraph / RequireLsat — the module docstring notes these are "convenience factories matching the legacy make_api_key_dep helpers" (that older helper no longer exists; this is the current implementation). Scopes are bare strings (ApiToken.SCOPE_* in core/models.py), not colon-suffixed.
| Route prefix | Required scope | Per-route override env | Falls back to | Notes |
|---|---|---|---|---|
/api/agents/* |
agent |
AGENT_API_KEY |
none | Spec 008. Rate-limited on the audit scope — these reads serve the provenance log. Includes WS handshakes for /ws/agents/{run_id} and the ops dashboard channel /ws/agents/ops, authenticated separately (see below). |
/api/analysis |
analysis |
ANALYSIS_API_KEY |
AGENT_API_KEY |
Spec 009. POST only; rate-limited on the llm scope (see Rate limiting). |
/api/graph/* |
graph |
GRAPH_API_KEY |
AGENT_API_KEY |
Spec 009. Read-only neighborhood/path queries. |
/api/lsat/* |
lsat |
LSAT_API_KEY |
AGENT_API_KEY |
Spec 009. Includes the tutor endpoint. Coaching tokens stream over the same Channels socket as analysis (/ws/agents/{stream_id}, authenticated by ticket), not over SSE — ADR 0001 and spec 011 chose WebSockets as the repo-wide push transport, so BL-20260503-03 shipped there rather than adding a second surface. |
/health |
(unauth) | — | — | Always public, no token required. |
An agent-scoped ApiToken (see Authentication) satisfies every row above, same as AGENT_API_KEY does for the env-key fallback.
WebSocket auth is separate and narrower. AgentRunConsumer (agentsapi/consumers.py) does not go through DRF at all: it reads ?api_key= (or ?token=) from the query string, or an X-API-Key handshake header for non-browser clients, and compares it against AGENT_API_KEY only — there is no ApiToken/DB lookup on the WS path, and per-router keys (ANALYSIS_API_KEY, etc.) don't apply to it. With AGENT_API_KEY unset the socket accepts any connection, matching the REST default-open posture.
Share links (BL-20260429-26)¶
GET /api/shared/<slug> is the one deliberately unauthenticated route in the API. Its security rests on four properties, all in analysis/urls_shared.py and analysis/models.py:
- Only a signed-in user can mint one.
POST /api/analysis/<id>/sharerefuses anonymous and key-only callers, and refuses a run owned by someone else unless the caller is staff. So every public link has an accountable author. - A minted slug is 32 random bytes (
secrets.token_urlsafe(32), ~256 bits), which puts enumeration out of reach. An owner may pick a readable slug instead — it is validated against^[a-z0-9][a-z0-9_-]{2,63}$, so a chosen slug can never smuggle a path segment, but a guessable slug is the owner's explicit choice. - Revocation is immediate and permanent.
DELETE /api/analysis/<id>/share/<slug>stampsrevoked_at; the row is never deleted, so the slug stays taken and a dead link cannot be revived under a new owner. Archiving the run, or clearing itsshareableflag, kills every link to it. - Every refusal is the same 404. Revoked, archived, unshareable and never-minted are indistinguishable to a caller, so probing the endpoint learns nothing.
Deployments handling matters under a confidentiality obligation set ANALYSIS_SHAREABLE_DEFAULT=false: newly persisted runs are then marked unshareable and minting is refused for all of them (spec 036 NFR-PRIV-1). The shared payload always carries the not-legal-advice disclaimer, because a reader arriving from a link has none of the Studio's context.
Token lifecycle¶
Issue / seed¶
There is no "mint a brand-new token" command today. The operator picks the plaintext value (e.g. openssl rand -hex 32) and sets it as the relevant env var; seed_api_keys then registers a hashed ApiToken row so the DB-token auth path recognizes it too. The command takes no flags — it unconditionally reads all four settings and seeds whichever are non-empty:
# 1. Set your own random values, e.g. in .env or a secrets manager:
# AGENT_API_KEY=<random> ANALYSIS_API_KEY=<random> GRAPH_API_KEY=<random> LSAT_API_KEY=<random>
# (any of ANALYSIS/GRAPH/LSAT left unset falls back to AGENT_API_KEY at request time.)
# 2. Register ApiToken rows for whatever is set:
docker compose run --rm backend python manage.py seed_api_keys
# seed_api_keys: created=2 already_present=0
It never prints a plaintext token — there's nothing to print, since the operator supplied the plaintext in step 1. Internally it's ApiToken.objects.get_or_create(key_hash=sha256(value), defaults={"scope": ..., "name": "env"}) per non-empty setting, so it's idempotent on the hash, not on any label: re-running with unchanged env values is a no-op, and changing an env value creates a new row rather than mutating the old one (the old row is left as-is, still valid, until explicitly revoked — see Rotate).
Rotate¶
There is no dedicated rotate command; rotation is "issue the new value, then revoke the old row":
- Set a new value for the relevant
<ROUTER>_API_KEYin the secrets manager /.env. - Re-run
seed_api_keys— this seeds a newApiTokenrow for the new hash. It does not touch the old row. - Roll the new value out to clients (env var update +
docker compose restart backend frontend). - Revoke the old row (see below) — until you do, both the old and new values authenticate successfully.
Revoke¶
No revoke_api_key management command exists yet. Today, revoke a DB token via the Django admin (/admin/core/apitoken/, set Revoked at) or the shell:
from django.utils import timezone
from law_ai.core.models import ApiToken
ApiToken.objects.filter(key_hash=ApiToken.hash_key("<old-plaintext-key>")).update(
revoked_at=timezone.now()
)
ApiKeyAuthentication.authenticate filters on revoked_at__isnull=True, so a revoked row is immediately rejected on the DB-token path.
Sharp edge: revoking the DB row alone does not fully lock the key out. When ApiKeyAuthentication can't find a matching, non-revoked ApiToken, request.auth stays None, and HasScope then falls through to the env-key comparison (secrets.compare_digest against the live *_API_KEY setting). If that setting still holds the old value, the old key keeps working through the fallback path even after its ApiToken row is revoked. Full revocation of a compromised key requires also rotating the underlying *_API_KEY env value and restarting the backend — not just flipping revoked_at.
Rate limiting (BL-20260811-06, BL-20260503-12)¶
Two scopes are throttled, both through ScopedActorRateThrottle (core/throttling.py):
llm— the endpoints that invoke a model (/api/analysis, the LSAT tutor and its siblings). 20/min anonymous, 60/min identified.audit— every/api/agents/*read, includingruns,runs/<trace_id>,metricsand the autonomy dashboard panels. These are cheap (no model call), but they serve the provenance log, so BL-20260430-09 asked that a leaked key not be able to scrape it at line speed; consolidated into BL-20260503-12, it lands here. 120/min anonymous, 600/min identified — an order of magnitude abovellm, which clears the ops dashboard's own polling with room to spare, but finite.
Neither scope has an on/off switch: the throttle is attached to the views, and the rates are the only knob (LLM_THROTTLE_RATE, LLM_KEYED_THROTTLE_RATE, AUDIT_THROTTLE_RATE, AUDIT_KEYED_THROTTLE_RATE). Both scopes bucket on the narrowest principal the request can prove:
- a provisioned
ApiToken→ itskey_hash(throttle_llm_key:<sha256>); - a signed-in Django user → their pk (
throttle_llm_user:<pk>); - neither → the client IP (
throttle_llm_ip:<addr>), as before.
Two consequences worth stating plainly. First, DRF's stock ScopedRateThrottle reads request.user.pk once is_authenticated is true — and _AnonymousActor had no pk, so a request carrying a provisioned key raised AttributeError on every throttled view. No test sent a key at a throttled route, so it sat latent; the new class (and a pk on the actor) closes it. Second, per-IP buckets under-serve everyone behind a shared proxy, which is why an identified caller also gets the more generous llm_keyed rate (LLM_KEYED_THROTTLE_RATE, default 60/min) instead of the anonymous LLM_THROTTLE_RATE (20/min). A single ApiToken may override both through its rate_limit column (a DRF rate string such as "200/min").
django-ratelimit was deliberately not added: DRF's throttle already owns the cache and the 429, and the only thing missing was the cache key.
Stored settings (BL-20260830-07)¶
/api/settings/values persists the setting rows the shell used to keep only in localStorage (core/urls_settings.py). The precedence engine stays in TypeScript (frontend/lib/scope/resolver.ts) — the backend decides only which rows exist and who may write them, which makes the authorisation surface small and explicit:
- Read returns the caller's scope chain and nothing else:
instance:localfor everyone, plususer:<pk>for a signed-in caller. Another user's rows are never in the response. It also returnswritableScopes— the subset of that chain the caller may write, derived from the samemay_writethe writes are checked against (BL-20260906-73) — so the settings UI can grey out an instance write it would only have had refused. It is an affordance, never the check: the check is still on the write. - Write to
user:<pk>is allowed only when that pk is the caller's — this is the item's IDOR surface, and it is checked on everyPUTandDELETE. Theuser:mealias exists so a client never has to send a pk it might get wrong. - Write to
instance:localis staff-only: an instance default (especially alockedone) overrides every user. - Anonymous callers read instance rows and can write nothing, so the shell's localStorage-only behaviour without accounts is unchanged.
- Values are capped at 4KB and must be JSON-serialisable; every write and delete is provenance-logged as
setting_value.updated/setting_value.deletedwith the actor.
Matters, export and account deletion (BL-20260817-01)¶
Matters hold client facts, so /api/matters/* accepts only a signed-in session or a user-bound ApiToken — a scope key never reaches them — and every lookup filters by owner=request.user. A slug that belongs to someone else answers 404, identical to one that never existed, so the URL cannot be used to test whether a matter exists. Matters are never resolvable by a public share slug; that surface exists for analyses only.
POST /api/analysis accepts an optional matter_id (BL-20260817-05) that scopes the research round to a matter, promoting the authorities that matter has already had verified to the front of retrieval. That id is checked against owner=request.user before it is honoured — an unowned or unknown id answers 404 and an anonymous caller 401 — because the boost set is another account's verified work and would otherwise leak through the ranking and through retrieval_stats.boost_source. The bias is always declared back to the caller in retrieval_stats.boosted_count / boost_source.
GET /api/matters/<slug>/export and GET /api/account/export are the portability half: one JSON bundle carrying the matter, its artifacts (with their provenance trace_ids), authorities, tasks and a merged timeline, logged as matter.exported.
POST /api/account/delete is the other half, and it deliberately does not call user.delete(). That would cascade away rows constitution §4 makes permanent, and the PROTECT FK on matter ownership blocks it halfway through anyway. Instead core/accounts/deletion.py separates the two kinds of data an account holds: personal data (LSAT attempt history, the caller's user:<pk> setting rows) is deleted outright, while records of what happened (audit events, HITL decisions, quarantine reviews, analyses) are kept and de-identified — the auth row survives with a scrubbed username, no usable password and is_active=False, so every FK stays valid and no history is rewritten. Matters are archived and reassigned to a deleted-user tombstone — with their slugs rewritten to <slug>-<matter pk> on the way, because Matter is unique on (owner, slug) and slugs are auto-derived from the matter's name, so without that the second account to delete a matter called "Lease" would collide on the shared tombstone and the atomic block would roll the entire de-identification back. API tokens are revoked, share links are killed, and the whole thing is one account.deleted provenance event. The endpoint requires the caller to retype their username, and it is session-only: a leaked API key must never be able to end an account.
Auditability¶
AuditEvent (backend/law_ai/audit/models.py) has five columns: kind, timestamp, trace_id, agent_version, payload (JSONField holding the full event). There is no key_hash, route, method, status_code, or actor_label column.
ProvenanceMiddleware calls ProvenanceLogger.log_request on every HTTP request/response, writing a kind="http_request" row whose payload is {timestamp, request_id, method, path, client_ip, status_code, user_agent, type}. This does not capture which token (if any) authenticated the request — there is currently no field on the HTTP audit row that ties it back to a key_hash or ApiToken, so tracing "who made this request" from the audit log alone isn't possible today; you'd need to correlate client_ip/timestamp against access logs out of band.
Operators can browse recent activity via the Django admin (/admin/audit/auditevent/) or query directly — path, method, and status_code are nested inside payload (JSONB), not top-level columns:
SELECT payload->>'path' AS path, count(*), max(timestamp) AS last_seen
FROM audit_auditevent
WHERE kind = 'http_request' AND timestamp > now() - interval '7 days'
GROUP BY payload->>'path'
ORDER BY last_seen DESC;
LLM provider credentials¶
Runtime model calls route through the ordered chain in LLM_PROVIDER_CHAIN (default claude_code,anthropic_api,xai,ollama), implemented in law_ai.core.llm. The two Claude tiers share one transport, law_ai.core.claude_code, with two independent credentials:
CLAUDE_CODE_OAUTH_TOKEN— a Claude subscription token minted withclaude setup-token, sent asAuthorization: Bearer <token>plus theanthropic-beta: oauth-2025-04-20header. Tried first.ANTHROPIC_API_KEY— a standard Anthropic API key, sent asx-api-key. Tried second, when the OAuth tier is unset or fails.
Both are read once per call via settings_proxy (django-environ → settings/base.py), never persisted to a database row, and never written to the audit log or application logs — the llm_call provenance event records the provider name, model, and latency, not the credential. If neither Claude credential is usable, the chain falls through to the xAI tier (below) and then to local Ollama (OLLAMA_BASE_URL), which sends no data off the machine.
The xAI tier (draft review)¶
Tier 3 (xai) is Grok over a subscription OAuth token, not an API key: make xai-login runs a device-code grant against https://auth.x.ai reusing the public Grok-CLI desktop client id and stores the result at XAI_CREDENTIALS_PATH (default .xai/credentials.json, gitignored) — the one runtime credential in this list that lands on disk rather than staying in the environment. Treat that file as a secret: it holds a refresh token that mints access tokens for the whole subscription, not just this app. XAI_ACCESS_TOKEN / XAI_REFRESH_TOKEN can supply it from the environment instead. The tier is inert until that login runs, so a deployment that never authorises it never sends anything to xAI.
Data handling on this path is not yet accepted (BL-20260904-03). What xAI publishes for its developer API says calls are "stored on our servers (encrypted at rest) for 30 days for auditing purposes" and that "xAI never trains on your API inputs or outputs without your explicit permission" (docs.x.ai — FAQ · API Security, read 2026-09-05, no effective date on the page). What is unresolved is whether those developer-API commitments govern a call authorised by a consumer subscription token, because https://x.ai/legal/terms-of-service and https://x.ai/legal/privacy-policy return HTTP 403 to automated fetches and were not read. There is no DPA for this path and no account-level Zero Data Retention setting available to it. The full write-up and the options are in ADR 0007; until an owner records a decision there, treat the xAI tier as a third-party egress path with unreviewed terms.
Confidentiality-bound data: per docs/constitution.md §1, any matter under an obligation forbidding third-party processing must pin LLM_PROVIDER_CHAIN=ollama — this disables both Claude tiers and the xAI tier outright rather than relying on them simply being unconfigured. The default chain now has two third-party vendors in front of the local tier, so the pin is the only configuration that keeps prompt text on the host. The LegalBench eval harness stays pinned to Ollama unconditionally so benchmark numbers stay comparable regardless of what an individual deployment's chain is set to.
Hardening checklist (production)¶
-
ENVIRONMENT=productionset;DJANGO_SETTINGS_MODULE=law_ai.settings.prod. -
SECRET_KEYset via secrets manager to a long random value (e.g.openssl rand -hex 32) — required: production refuses to boot on thesettings/base.pydefault, a key shorter than 50 characters, one with fewer than 5 unique characters or one prefixeddjango-insecure-(law_ai.E002, Django's ownsecurity.W009rule made an error). See threat model item 5. -
ALLOWED_HOSTSset to the deployment's own host names, comma-separated — required: production refuses to boot with*in it (law_ai.E003). -
AGENT_API_KEY(and any per-router keys) set via secrets manager, not committed.env— required, not optional: production refuses to boot while any gated router is open (law_ai.E001). See threat model item 1. -
python manage.py seed_api_keysrun once at boot so the DB-token path recognizes the configured keys. - HTTPS terminator in front of daphne (Caddy / Traefik / nginx).
-
LLM_THROTTLE_RATE/LLM_KEYED_THROTTLE_RATE/AUDIT_THROTTLE_RATE/AUDIT_KEYED_THROTTLE_RATEreviewed for the deployment's size. Per-token rate limiting is on by default (BL-20260503-12) and needs no flag; these only tune it. - Phoenix collector reachable at
PHOENIX_COLLECTOR_ENDPOINTfor trace audit. -
LLM_PROVIDER_CHAINreviewed: pin toollamafor confidentiality-bound deployments, otherwise confirmCLAUDE_CODE_OAUTH_TOKEN/ANTHROPIC_API_KEYare set via secrets manager if Claude tiers should be reachable. - xAI tier decided: either leave it unauthorised (
make xai-loginnever run — the tier stays inert), or read ADR 0007's terms review and record the acceptance before any client material can reach it;XAI_CREDENTIALS_PATHprotected like a secret if it is authorised. -
python manage.py check --deployexits 0. Underlaw_ai.settings.prodit cannot while a router is open orSECRET_KEY/ALLOWED_HOSTSis unsafe (law_ai.E001,law_ai.E002,law_ai.E003):CoreConfig.ready()(core/apps.py) raisesImproperlyConfiguredduringdjango.setup(), before the checks run, which is the same refusal daphne, Celery and every other management command meet.
Related docs¶
- docs/constitution.md §1 (LLM provider chain), §4 (provenance/audit), §8 (security baselines).
- docs/architecture.md — auth layer in the API row of the Component Responsibility table.
- specs/008-agent-api-auth/ and specs/009-extend-api-auth/.