-
feat(douanier): adopt the platform's path-derived scope convention (#43) · 4197696d
The audio API now speaks the platform scope convention (nechapi scopes.py): access is hierarchical realm:domain:path and the required scope is DERIVED FROM THE ROUTE, so it's maintenance-free — add an endpoint and its scope exists. - scopes.py — vendored byte-for-byte from nechapi/_platform/scopes.py; a drift-guard test (test_scopes.py) fails if the two ever diverge, so the gateway and this service can never disagree on who's allowed in. - app.py — replaced the per-route require_scope("emotion"|"features"|…) strings with ONE path-derived dependency: `require` computes api:audio:<path> from the request and checks it; `require_auth` covers /me (any identity). Also closed a footgun: a gateway-injected request with a MISSING X-Scopes header now defaults to NO scopes (was "*"). - auth.py — Principal.has_scope is now the hierarchical matcher (api:audio:* authorizes api:audio:analyze:emotion, etc.). - tests — gateway-header tests grant api:audio:*; the scope-enforcement tests now prove real path-derivation (a sibling grant like api:audio:features → 403 on /grade and /onsets). +test_scopes.py for the matcher + drift guard. 67 passing. - clients/README — scope table rewritten to the convention (api:audio:<path>, grant api:audio:* or api:* for breadth). Validated end-to-end through https://api.nech.pl/audio/v1 with a freshly minted api:* token: /me → scopes [api:*]; /features 200 (cache miss→hit); a sibling scope 403s; no-identity 401s. Built + redeployed douanier:latest to erable (seccomp=unconfined per DEPLOY.md).PLN (Algolia) authored4197696d
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| api | Loading commit data... | |
| escales | Loading commit data... | |
| manifeste | Loading commit data... | |
| semaphore | Loading commit data... | |
| tasks | Loading commit data... | |
| tide-table | Loading commit data... | |
| ui | Loading commit data... | |
| .gitignore | Loading commit data... | |
| DESIGN.md | Loading commit data... | |
| PRODUCT.md | Loading commit data... | |
| README.md | Loading commit data... | |
| serve.py | Loading commit data... |