feat: optional API key auth for write endpoints#10
Open
chrismdp wants to merge 1 commit intoJamsusMaximus:mainfrom
Open
feat: optional API key auth for write endpoints#10chrismdp wants to merge 1 commit intoJamsusMaximus:mainfrom
chrismdp wants to merge 1 commit intoJamsusMaximus:mainfrom
Conversation
- Add CODEMAP_API_KEY env var for Bearer token auth on /api/activity, /api/thinking, and /api/git-commit endpoints - When unset, endpoints remain open (backwards compatible) - Update all hook scripts to send Authorization header when CODEMAP_API_KEY is set - Add CODEMAP_SERVER_URL env var to hook scripts (default localhost:5174) so hooks can target a remote server Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
CODEMAP_API_KEYenv var for Bearer token auth on write endpoints (/api/activity,/api/thinking,/api/git-commit)Authorization: Bearerheader whenCODEMAP_API_KEYis setCODEMAP_SERVER_URLenv var to hook scripts (defaulthttp://localhost:5174) so hooks can post to a remote serverRationale
For remote deployment, write endpoints need protection so only authorised hook scripts can post activity. Read/browser endpoints are left open (intended to be protected by nginx basic auth or similar at the reverse proxy layer).
Test plan
CODEMAP_API_KEYset, all endpoints work as before (no auth required)CODEMAP_API_KEY=test123,curl -X POST /api/thinkingreturns 401CODEMAP_API_KEY=test123,curl -X POST -H "Authorization: Bearer test123" /api/thinkingreturns 200CODEMAP_API_KEYenv var send correct auth header🤖 Generated with Claude Code