Repository navigation
MLE-29977: Fixed Polaris reported CWE-404 - #1987
hmadala001 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Regression tests are missing for both changed InputStream overloads to verify underlying input cleanup when unconsumed or partially consumed streams are closed and UncheckedIOException when InputStream.close() fails.
1 open issue
What changed in this PR
This PR addresses Polaris-reported CWE-404 resource cleanup issues in the Java client library and its Jackson example.
Changes:
- Use try-with-resources for JSON generators and the example input stream.
- Close internally created JSON parsers when splitter streams are closed or stream setup fails.
| File | Description |
|---|---|
marklogic-client-api/src/main/java/com/marklogic/client/pojo/util/GenerateIndexConfig.java |
Ensure the configuration generator closes on failure. |
marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java |
Ensure generators close in both write implementations. |
marklogic-client-api/src/main/java/com/marklogic/client/datamovement/JSONSplitter.java |
Add parser cleanup handlers and setup-failure cleanup. |
examples/src/main/java/com/marklogic/client/example/handle/JacksonHandleExample.java |
Scope the example input stream with try-with-resources. |
Review effort: Balanced
| JsonParser jsonParser = new JsonFactory().createParser(input); | ||
| return split(jsonParser); | ||
| try { | ||
| return split(jsonParser).onClose(() -> closeParser(jsonParser)); |
|
The
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fixed |

No description provided.