Release v0.2.0: multiple named API keys per user
Replaces the single per-user DRF token with named, individually-revocable
API keys, so you can run one key per agent and cut off a leaked one without
disrupting the others.
- New ApiKey model (user, name, dbk_-prefixed key, created_at, last_used_at).
Data migration copies every existing authtoken 1:1 into a "default" named
key with the same value, so no client (incl. the sibling test project's
hardcoded test-user key) needs reconfiguring.
- Auth (resolve_token_user) resolves against ApiKey and stamps last_used_at,
throttled to one write/minute.
- Settings -> API Keys: table with name/key/created/last-used + per-row
revoke and a create form; keys viewable on demand. Settings -> Account now
links here; Settings -> Users issues a named initial key.
- Gated provisioning API for test installations: GET/POST /api/keys and
DELETE /api/keys/{id}, controlled by DAYBOOK_KEY_PROVISIONING_API (unset ->
follows DEBUG, so off in deployment). Advertised via key_provisioning_api
in /api/capabilities; 403 when disabled.
- Docs (api/deployment/quickstart/posting-helper), SKILL.md, and env.example
updated from "token / Settings -> Account" to "key / Settings -> API Keys".
- Tests: new API + UI suites for keys; existing token-based tests moved to
ApiKey. Full suite 129 passing.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5c46f2aa67
commit
19c1798f90
24 changed files with 602 additions and 63 deletions
|
|
@ -64,9 +64,10 @@ DATABASE_PATH=/data/db.sqlite3
|
|||
ARTIFACTS_ROOT=/data/artifacts_store
|
||||
```
|
||||
|
||||
There is no shared API token to configure — Daybook uses per-user tokens
|
||||
(DRF `Token` model) issued from Settings → Account once a user exists. Do not
|
||||
commit `deploy/.env`.
|
||||
There is no shared API token to configure — Daybook uses per-user API keys
|
||||
created under Settings → API Keys once a user exists (each user can hold
|
||||
several, one per agent, each individually revocable). Do not commit
|
||||
`deploy/.env`.
|
||||
|
||||
Create the persistent data directory and bring the stack up:
|
||||
|
||||
|
|
@ -94,7 +95,7 @@ that's expected; it confirms the app is up and enforcing auth. (Don't add
|
|||
`curl -f` — it treats the 403 as an error. The container healthcheck uses
|
||||
the login page, which is 200 without auth.) Open
|
||||
`http://<vm-ip>:8000/` in a browser and log in with the superuser you just
|
||||
created, then grab a personal token from Settings → Account and use it for a
|
||||
created, then create a personal key under Settings → API Keys and use it for a
|
||||
smoke-test post:
|
||||
|
||||
```bash
|
||||
|
|
@ -191,8 +192,8 @@ Caddy: header_up X-Forwarded-Proto https
|
|||
- `docker compose -f deploy/docker-compose.yml ps` shows `daybook` healthy.
|
||||
- `GET /api/capabilities` returns 403 without auth, 200 with a valid token or
|
||||
session (check the status code — don't use `curl -f`, which errors on 403).
|
||||
- At least one superuser exists (`manage.py createsuperuser`) with a token
|
||||
from Settings → Account.
|
||||
- At least one superuser exists (`manage.py createsuperuser`) with a key
|
||||
from Settings → API Keys.
|
||||
|
||||
## Known MVP Constraints
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue