Register pprof debug endpoints behind admin-token auth#809
Open
AbirAbbas wants to merge 1 commit into
Open
Conversation
…min-token auth Add /debug/pprof/ routes gated by X-Admin-Token (returns 401 on missing/wrong token, 200 with valid token). Named profiles (goroutine, heap, etc.) share the same gating. When no admin token is configured the endpoints are open, consistent with existing AdminTokenAuth behavior.
AbirAbbas
marked this pull request as draft
July 21, 2026 22:12
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
AbirAbbas
marked this pull request as ready for review
July 22, 2026 13:41
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
/debug/pprof/*endpoints (index, cmdline, profile, symbol, trace, and named profiles) on the control-plane gin router.X-Admin-Tokenheader with constant-time comparison, returning 401 on missing or wrong tokens.Closes #428
Changes
control-plane/internal/server/server.go— Registers the new admin pprof route group.control-plane/internal/server/routes_admin.go— Adds pprof middleware (constant-time token check returning 401) and route registration.control-plane/internal/server/routes_admin_test.go— Seven test cases covering token auth and profile endpoint selection.Test plan
go vet ./...passes clean.go test ./internal/server/...passes (the pre-existingTestStartAndStopCoverAdditionalBranchesfailure is unrelated and also present on clean main)./debug/pprof/without a token returns 401; with the correct token returns the pprof index.🤖 Built with AgentField SWE-AF
🔌 Powered by AgentField