Repository navigation
feat(#409): view-only API key model — role/permission for uteke-serve - #423
Merged
Merged
Conversation
Add dual-role API token support to uteke-server: - Admin token (--auth-token): full access to all endpoints - Read-only token (--read-only-token): GET-only access Read-only tokens can access recall, search, list, stats, graph, and health endpoints. POST/DELETE operations return 403 Forbidden. Both tokens use SHA-256 hashing with constant-time comparison. Env vars: UTEKE_AUTH_TOKEN (admin), UTEKE_READ_ONLY_TOKEN (read-only) Usage: uteke-serve --auth-token admin-secret --read-only-token viewer-key # Read-only client: curl -H "Authorization: Bearer viewer-key" http://localhost:8767/stats # Write attempt fails: curl -X POST -H "Authorization: Bearer viewer-key" ... → 403
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (3)
Review powered by cora-cli · BYOK · MIT |
| let mut cli_host: Option<String> = None; | ||
| let mut cli_port: Option<u16> = None; | ||
| let mut cli_auth_token: Option<String> = None; | ||
| let mut cli_read_only_token: Option<String> = None; |
| AuthResult::Disabled | ||
| }; | ||
|
|
||
| // Enforce read-only restriction (#409): ReadOnly tokens can only use GET. |
| // need hashing per-request (avoids double-hash on every auth check). | ||
| let auth_token_hash = auth_token.as_deref().map(|t| Sha256::digest(t).into()); | ||
|
|
||
| // Read-only token (#409): CLI arg or env var. |
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
…#423) * feat(#409): view-only API key model — role/permission for uteke-serve Add dual-role API token support to uteke-server: - Admin token (--auth-token): full access to all endpoints - Read-only token (--read-only-token): GET-only access Read-only tokens can access recall, search, list, stats, graph, and health endpoints. POST/DELETE operations return 403 Forbidden. Both tokens use SHA-256 hashing with constant-time comparison. Env vars: UTEKE_AUTH_TOKEN (admin), UTEKE_READ_ONLY_TOKEN (read-only) Usage: uteke-serve --auth-token admin-secret --read-only-token viewer-key # Read-only client: curl -H "Authorization: Bearer viewer-key" http://localhost:8767/stats # Write attempt fails: curl -X POST -H "Authorization: Bearer viewer-key" ... → 403 * style: fmt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #409.
Summary
Add dual-role API token support to uteke-server.
Changes
Usage
Enforced restrictions
Read-only tokens can access: GET /health, /stats, /namespaces, /graph, /memory.
POST/DELETE operations return 403.
Milestone: v0.3.0 — Graph RAG