fix(security): close CodeQL SSRF and polynomial-redos alerts in ConnectivityController#151
Merged
coopernetes merged 1 commit intomainfrom Apr 13, 2026
Merged
Conversation
…ctivityController
- Validate the `repoPath` query param against a strict allowlist pattern
(letters/digits/dots/hyphens/slashes only; no `..`, `@`, `:`, etc.)
before it can influence any outbound URL — clears the SSRF taint flow
reported by CodeQL alerts #297 and #298.
- Build the probe URI using the multi-arg URI constructor anchored to the
trusted provider base URI (scheme/host/port from config, never from
user input) so the authority cannot be overridden by a crafted repoPath.
- Replace the `replaceAll("/+$", "")` regex in probe() with a plain
while-loop trim to eliminate the polynomial backtracking risk on inputs
with many trailing slashes (CodeQL alert #296).
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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
repoPathquery parameter against a strict allowlist (/?[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*) before it can influence any outbound URL, clearing the SSRF taint flow (CodeQL alerts #297 and #298)URIconstructor anchored to the trusted provider base URI — scheme/host/port always come from config, never from user inputreplaceAll("/+$", "")regex inprobe()with a plain while-loop trim to eliminate polynomial backtracking on inputs with many trailing slashes (CodeQL alert #296)Test plan
./gradlew :git-proxy-java-dashboard:compileJavasucceedsGET /api/admin/connectivity?provider=<name>&repoPath=owner/repo.gitreturns a valid git probe resultGET /api/admin/connectivity?provider=<name>&repoPath=../evilreturns HTTP 400