Fix critical security issues: command injection, wildcard CORS, SSRF#2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Fix critical security issues: command injection, wildcard CORS, SSRF#2devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- CSI NodeService: Replace Runtime.exec(String) with ProcessBuilder(List)
to avoid shell metacharacter interpretation. Add input validation
(regex allowlist + InvalidPathException check) for volumeId and
targetPath from gRPC requests before passing to mount/unmount commands.
- ProfileServlet: Remove Access-Control-Allow-Origin: * header that allowed
any origin to access the async-profiler endpoint, exposing JVM profiling
data to cross-origin requests.
- MetricsProxyEndpoint: Validate the {api} path parameter against
^[a-zA-Z0-9_]+$ before interpolating it into the Prometheus URL,
preventing path traversal to arbitrary Prometheus endpoints.
Generated-by: Devin (Claude)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
What changes were proposed in this pull request?
This PR fixes three security vulnerabilities found during a codebase audit:
1. CSI NodeService — Command Injection (Critical)
NodeService.executeCommand()usedRuntime.getRuntime().exec(String)which tokenizes viaStringTokenizer, andnodeUnpublishVolume/nodePublishVolumeinterpolated unvalidated gRPC request fields (volumeId,targetPath) directly into shell command strings viaString.format().Fix:
Runtime.exec(String)withProcessBuilder(List<String>)for explicit argument separation (no shell interpretation).validatePath()that rejects paths not matching^[a-zA-Z0-9/_\\:. -]+$and catchesInvalidPathException, applied to bothtargetPathandvolumeIdbefore use.2. ProfileServlet — Wildcard CORS (Medium-High)
setResponseHeader()setAccess-Control-Allow-Origin: *, allowing any website to make cross-origin requests to the async-profiler endpoint. This could expose JVM profiling data to untrusted origins.Fix: Remove the
Access-Control-Allow-Origin: *header entirely. The profiling endpoint is an internal management tool and should not be accessible cross-origin.3. MetricsProxyEndpoint — SSRF via Path Traversal (Medium)
The
{api}@PathParaminGET /api/v1/metrics/{api}was passed toPrometheusServiceProviderImpl.getMetricsResponse()which interpolated it into a URL viaString.format("%s/api/v1/%s?%s", ...)without validation. A craftedapivalue like../../admin/tsdbcould reach arbitrary Prometheus endpoints.Fix: Validate
apiagainst^[a-zA-Z0-9_]+$and return 400 Bad Request for non-matching values.What is the link to the Apache JIRA
No JIRA — this is a fork-level security hardening PR.
How was this patch tested?
mvn clean install -DskipTests -DskipShade -DskipRecon -DskipDocs) passes.TestProfileServletdoes not reference the removed CORS header.Generated-by: Devin (Claude)
Link to Devin session: https://app.devin.ai/sessions/56da5ad1fcfd44a0a984cf13ee9a426c
Requested by: @marcuslin123