You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(auth): enforce role permissions on REST storage and settings mutations #60
With AUTH_ENABLED=true, a valid viewer API key can upload and delete managed files and write administrative settings through REST. Authentication is enforced, but these endpoints do not enforce the advertised role hierarchy.
Tested revision: 41ec093a745f1c0277893dc8f758b96b216c970f, isolated SQLite + embedded Qdrant deployment. All inputs were synthetic.
Reproduction
Bootstrap an admin API key and issue a key with role=viewer.
With the viewer key, POST /admin/api/storage/upload containing a harmless text file.
DELETE that fixture through /admin/api/storage/file?path=viewer-write.txt.
Read the current auto-sync interval and POST the same value to /admin/api/settings/auto-sync.
All three writes returned HTTP 200, not 403. Upload indexed the fixture and delete removed it. In contrast, the same viewer correctly received 403 from /admin/api/auth/keys, and anonymous requests received 401.
Relevant code
Storage REST handlers import role helpers but do not use them to guard these mutations.
AuthMiddleware validates the token; that alone does not authorize mutations.
Expected outcome
Apply explicit least-privilege role policies to REST operations, consistent with the MCP role contract: viewers read, editors perform permitted content mutations, admins manage configuration/credentials/keys.
Validate the intended policy across repository/path/storage/settings endpoints rather than fixing only the three demonstrated routes.
Reject unauthorized operations before filesystem, vector-store, configuration, or relational side effects.
Add role-matrix regression tests including anonymous/invalid/revoked keys, viewer denials, editor content writes, and admin-only configuration.
No claim of a complete security audit is made; this records the reproduced role-policy failures.
While AuthMiddleware verifies token validity, individual REST router endpoints in app/api/routers/storage.py and app/api/routers/settings.py lack role check dependencies. As a result, API keys with role=viewer are able to upload/delete files and write administrative settings.
3. Implementation Plan
Apply FastAPI role dependencies to all mutating endpoints:
Admin only (require_role("admin")): /admin/api/settings/*, /admin/api/auth/*, vector store test/config.
Activity
google-labs-jules commentedon Oct 27, 2026
Jules is on it. When finished, you will see another comment and be able to review a PR.
spelech commentedon Oct 27, 2026
Triage & Implementation Brief
1. Scope & Effort
2. Root Cause & Context
While
AuthMiddlewareverifies token validity, individual REST router endpoints inapp/api/routers/storage.pyandapp/api/routers/settings.pylack role check dependencies. As a result, API keys withrole=viewerare able to upload/delete files and write administrative settings.3. Implementation Plan
require_role("admin")):/admin/api/settings/*,/admin/api/auth/*, vector store test/config.require_role("editor")):/admin/api/storage/upload,/admin/api/storage/file(DELETE), repo registration/sync.require_role("viewer")): Read-only operations (GET /admin/api/stats,GET /admin/api/repos, file reads, search).4. Acceptance Criteria
google-labs-jules commentedon Oct 27, 2026
Ready for a review! A PR has been created.