Conversation
…ted parts Fixes CodeQL go/request-forgery (CWE-918) alert #32 on RegisterServerlessAgentHandler by splitting normalizeServerlessDiscoveryURL into a parse helper that returns a freshly constructed *url.URL (validated scheme literal, allowlisted host, path.Clean-ed path, no user/query/fragment propagated) and having the handler build the /discover URL from those sanitized components rather than string-concatenating the caller-supplied value. Also rejects opaque URLs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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. |
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
RegisterServerlessAgentHandler.normalizeServerlessDiscoveryURLinto a parse helper that returns a freshly constructed*url.URL(validated scheme literal, allowlisted host,path.Clean-ed path — no user-info / query / fragment ever propagated).discoveryURLfrom those sanitized components rather than string-concatenating the caller-supplied value, so no tainted string flows intohttp.NewRequestWithContext.http:foo/path).Test plan
go test ./control-plane/internal/handlers/...— full suite green (69.7s)nodes_serverless_ssrf_test.go:./,../, trailing slashes)User/RawQuery/Fragment/Opaque)[::]tolocalhostTestRegisterServerlessAgentHandler_DiscoverySanitizedFunctional:/discoverpath even when input contains./and../segmentsnormalizeServerlessDiscoveryURL100%,parseServerlessDiscoveryURL90.6%,RegisterServerlessAgentHandler79.2%go vet ./control-plane/internal/handlers/...clean🤖 Generated with Claude Code