Goal
Make the authz middleware reject requests when the authenticated API key does
not hold the required scope for the route being accessed.
Background
The middleware currently stamps scopes onto trusted headers but never checks
whether the key's scopes satisfy the requirements of the route. A key with
chat:read can currently call providers:write routes without restriction.
Depends on #83. Closes part of #46.
Acceptance Criteria
Scope
In scope: transport-axum/src/authz.rs
Out of scope: allowed_models/allowed_providers (separate issue)
Verification
cargo test -p transport-axum
Goal
Make the authz middleware reject requests when the authenticated API key does
not hold the required scope for the route being accessed.
Background
The middleware currently stamps scopes onto trusted headers but never checks
whether the key's scopes satisfy the requirements of the route. A key with
chat:readcan currently callproviders:writeroutes without restriction.Depends on #83. Closes part of #46.
Acceptance Criteria
required_scope(route_class, path)function maps routes to theirrequired scope
client_api_policyreturns HTTP 403INSUFFICIENT_SCOPEwhen theauthenticated key lacks the required scope
adminscope grants access to all routes (superset semantics)admin scope allowed on any route
Scope
In scope:
transport-axum/src/authz.rsOut of scope:
allowed_models/allowed_providers(separate issue)Verification
cargo test -p transport-axum