Replace API keys with scoped macaroons - #275
Closed
benthecarman wants to merge 1 commit into
Closed
Conversation
Use standard v2 macaroons so clients can restrict permissions, RPC methods, and expiry without access to server root keys. Support separate credentials with independent revocation through gRPC, the CLI, and MCP. Carry caller restrictions into newly issued credentials to prevent privilege escalation. Replace request HMAC headers with bearer macaroons over TLS. Clients must use the new credentials; existing event streams retain admission- time authorization. Add reference vectors and tests for token parsing, attenuation, persistence, and live authentication. AI assistance: OpenAI Codex.
|
👋 Hi! I see this is a draft PR. |
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.
Alternative to #273 for #140. The shared API key gives every client full access. Replace it with standard v2 macaroons so applications can receive scoped, independently revocable credentials and add restrictions locally.
The implementation supports first-party permission, RPC-method, and expiry caveats. Every caveat must pass; permission sets intersect, and API-issued children inherit the caller's caveats. Root keys stay in private server files. The CLI and MCP expose creation, listing, revocation, and effective permissions;
attenuate-macaroonworks offline.No dependencies were added. The shared v2 codec uses the server and client's existing HMAC implementations, with constant-time verification through
ring. Checked-in vectors come from pymacaroons 0.13.0, which also verified output from the Rust CLI.Behavior to review:
x-authsigning with themacaroonbearer header over TLS. Clients must upgrade and use the new credentials. There is no per-request signature or replay protection.Validation:
AI assistance: OpenAI Codex.