Context
ApiKey model has permissions (JSON), ApiKeyAuthGuard validates keys, but key permissions aren't applied to endpoint authorization anywhere; docs/ (RBAC matrix) documents USER/AGENT/ADMIN roles, not key scopes.
Problem
API keys currently grant whatever the linked user can do - no scope limiting. An integration using a read-only key can mutate data. The permission column is stored but inert.
Proposed approach
Introduce a KeyPermissionsGuard that reads request.authUser (populated by ApiKeyAuthGuard) and enforces declared scopes against route metadata; update docs/RBAC_Permission_Matrix.md; add specs for allowed/denied scopes.
Acceptance criteria
- Scoped API keys enforce read/write limits; docs match behavior.
Context
ApiKeymodel haspermissions(JSON),ApiKeyAuthGuardvalidates keys, but keypermissionsaren't applied to endpoint authorization anywhere;docs/(RBAC matrix) documents USER/AGENT/ADMIN roles, not key scopes.Problem
API keys currently grant whatever the linked user can do - no scope limiting. An integration using a read-only key can mutate data. The permission column is stored but inert.
Proposed approach
Introduce a
KeyPermissionsGuardthat readsrequest.authUser(populated byApiKeyAuthGuard) and enforces declared scopes against route metadata; updatedocs/RBAC_Permission_Matrix.md; add specs for allowed/denied scopes.Acceptance criteria