Skip to content

Harden HTTP server auth: default-deny admin, constant-time compare#1

Open
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/server-auth-hardening
Open

Harden HTTP server auth: default-deny admin, constant-time compare#1
phyceClaw wants to merge 1 commit into
phyce:mainfrom
phyceClaw:fix/server-auth-hardening

Conversation

@phyceClaw

Copy link
Copy Markdown

Summary

Hardens the HTTP server auth middleware.

  • Admin endpoints default-deny: AdminAuthMiddleware granted full access to /config (read/write API keys, engine paths) when no admin key was configured. It now returns 403 until an admin key is set.
  • Constant-time comparison: token checks used == (timing-unsafe); now use crypto/subtle.ConstantTimeCompare.
  • Documents the intentional unauthenticated mode on the non-admin middleware.

Testing

CGO_ENABLED=1 go build ./... passes; go vet clean.

🤖 Generated with Claude Code

- AdminAuthMiddleware now returns 403 when no admin key is configured
  instead of granting access to /config (which exposes API keys)
- Use crypto/subtle.ConstantTimeCompare for all token checks
- Document the intentional unauthenticated mode on AuthMiddleware

Co-Authored-By: Claude Opus 4.8 (1M context) <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