Skip to content

Serve /health, /metrics and /debug/pprof/* without API authorization - #1703

Open
Slach wants to merge 1 commit into
masterfrom
metrics_listen
Open

Slach wants to merge 1 commit into
masterfrom
metrics_listen

Conversation

@Slach

@Slach Slach commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When api.username/api.password are set, basicAuthMiddleware required credentials for every route, including /health (k8s probes), /metrics (Prometheus) and /debug/pprof/*.
  • These paths now bypass authorization; all other API routes still require it.
  • /metrics and /debug/pprof/* are still registered only when enable_metrics / enable_pprof are on, so disabled endpoints keep returning 404.
  • ReadMe: documented in the api.username comment.

Test plan

  • pkg/server/metrics_auth_test.go: unit test through the real registerHTTPHandlers() router — /health, /metrics, /debug/pprof/ return 200 without credentials, /backup/version returns 401 without / 200 with credentials, disabled metrics/pprof return 404
  • make test

🤖 Generated with Claude Code

With api.username/api.password set, Prometheus scrapes, k8s probes and
pprof debugging all required credentials, because basicAuthMiddleware
wrapped every route on the single API listener. Bypass the auth check
for these monitoring/debug paths; /metrics and /debug/pprof/* are still
registered only when enable_metrics/enable_pprof are on, so disabled
endpoints stay 404.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Slach Slach added this to the 2.8.4 milestone Nov 30, 2026
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