feat(java): detect HTTP client base URL set from a config-driven/non-literal expression via ApiClient.setBasePath (CWE-918) - #141
Open
ai-anant wants to merge 1 commit into
Conversation
…-driven expression via ApiClient.setBasePath (CWE-918)
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.
Adds a Java/Jenkins rule detecting HTTP-client base URLs assigned from a non-literal expression via
ApiClient.setBasePath()instead of a fixed string literal.When the base URL originates from a plug-in configuration field (global/folder/job setting) and no scheme/host allowlist is enforced, an authenticated user who can edit that configuration can redirect the outbound client at an internal service (loopback, router, cloud metadata 169.254.169.254) or a host they control. Requests built on that base URL routinely carry credentials, so it can also exfiltrate stored API keys/tokens/stored credentials.
Rule:
codevigilant.java.jenkins.ssrf.api-client-setbasepath-nonliteralpattern-notexcludes string-literal base URLssemgrep --validate; fires on a non-literal repro, stays silent on a literal base-URL negative repro.