Skip to content

fix(security): close CodeQL SSRF and polynomial-redos alerts in ConnectivityController#151

Merged
coopernetes merged 1 commit intomainfrom
fix/codeql-connectivity-controller
Apr 13, 2026
Merged

fix(security): close CodeQL SSRF and polynomial-redos alerts in ConnectivityController#151
coopernetes merged 1 commit intomainfrom
fix/codeql-connectivity-controller

Conversation

@coopernetes
Copy link
Copy Markdown
Owner

Summary

  • Validates the repoPath query 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)
  • Constructs the probe URI using the multi-arg URI constructor anchored to the trusted provider base URI — scheme/host/port always come from config, never from user input
  • Replaces the replaceAll("/+$", "") regex in probe() with a plain while-loop trim to eliminate polynomial backtracking on inputs with many trailing slashes (CodeQL alert #296)

Test plan

  • CI CodeQL scan passes (alerts #296, #297, #298 dismissed)
  • ./gradlew :git-proxy-java-dashboard:compileJava succeeds
  • Manual: GET /api/admin/connectivity?provider=<name>&repoPath=owner/repo.git returns a valid git probe result
  • Manual: GET /api/admin/connectivity?provider=<name>&repoPath=../evil returns HTTP 400

…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>
@coopernetes coopernetes merged commit 3973ddb into main Apr 13, 2026
9 checks passed
@coopernetes coopernetes deleted the fix/codeql-connectivity-controller branch April 13, 2026 20:12
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