Skip to content

feat: optional API key auth for write endpoints#10

Open
chrismdp wants to merge 1 commit intoJamsusMaximus:mainfrom
chrismdp:feat/api-key-auth
Open

feat: optional API key auth for write endpoints#10
chrismdp wants to merge 1 commit intoJamsusMaximus:mainfrom
chrismdp:feat/api-key-auth

Conversation

@chrismdp
Copy link
Copy Markdown

@chrismdp chrismdp commented Mar 3, 2026

Summary

  • Add CODEMAP_API_KEY env var for Bearer token auth on write endpoints (/api/activity, /api/thinking, /api/git-commit)
  • When unset, endpoints remain open (fully backwards compatible)
  • Update all hook scripts to send Authorization: Bearer header when CODEMAP_API_KEY is set
  • Add CODEMAP_SERVER_URL env var to hook scripts (default http://localhost:5174) so hooks can post to a remote server

Rationale

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

  • Without CODEMAP_API_KEY set, all endpoints work as before (no auth required)
  • With CODEMAP_API_KEY=test123, curl -X POST /api/thinking returns 401
  • With CODEMAP_API_KEY=test123, curl -X POST -H "Authorization: Bearer test123" /api/thinking returns 200
  • Hook scripts with CODEMAP_API_KEY env var send correct auth header

🤖 Generated with Claude Code

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant