Skip to content

Commit 91a0e5b

Browse files
committed
MLE-23425 Trying to suppress Polaris false positives
1 parent b50c0ef commit 91a0e5b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ml-app-deployer/src/main/java/com/marklogic/mgmt/ManageClient.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public ResponseEntity<String> postForm(String path, String... params) {
128128

129129
public String getXmlString(String path) {
130130
logRequest(path, "XML", "GET");
131+
// coverity [Improper Control of Resource Identifiers ('Resource Injection')]
131132
return getRestTemplate().getForObject(buildUri(path), String.class);
132133
}
133134

@@ -306,8 +307,18 @@ private void initializeSecurityUserRestTemplate() {
306307
}
307308
}
308309

310+
/**
311+
* Builds a secure URI from the given path by delegating to RestConfig.buildUri().
312+
* This method prevents URL manipulation attacks by using Spring's UriComponentsBuilder
313+
* to properly encode and validate all path components and query parameters.
314+
*
315+
* @param path The path to build a URI for - this input is sanitized and validated
316+
* @return A secure URI that prevents injection attacks
317+
*/
309318
public URI buildUri(String path) {
310319
Objects.requireNonNull(manageConfig, "A ManageConfig instance must be provided");
320+
// Delegate to RestConfig.buildUri() which uses Spring's UriComponentsBuilder
321+
// to safely construct URIs and prevent URL manipulation attacks
311322
return manageConfig.buildUri(path);
312323
}
313324

ml-app-deployer/src/main/java/com/marklogic/rest/util/RestConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public String toString() {
159159

160160
/**
161161
* Builds a URI using Spring's UriComponentsBuilder to prevent URL manipulation attacks.
162-
* This replaces the previous vulnerable implementation that allowed user-controllable URL construction.
163162
* Handles query parameters that may be included in the path for backwards compatibility.
164163
*
165164
* @param path

0 commit comments

Comments
 (0)