Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BRMO-384] Fix Resolving XML external entity in user-controlled data#2310

Merged
mprins merged 7 commits into
masterB3Partners/brmo:masterfrom
BRMO-384B3Partners/brmo:BRMO-384Copy head branch name to clipboard
Nov 19, 2024
Merged

[BRMO-384] Fix Resolving XML external entity in user-controlled data#2310
mprins merged 7 commits into
masterB3Partners/brmo:masterfrom
BRMO-384B3Partners/brmo:BRMO-384Copy head branch name to clipboard

Conversation

@mprins

@mprins mprins commented Nov 18, 2024

Copy link
Copy Markdown
Member

Fixes:

To fix the problem, we need to configure the DocumentBuilderFactory to disable the parsing of external entities and DTDs. This can be done by setting specific features on the DocumentBuilderFactory instance. The changes should be made in the WozXMLReader class where the DocumentBuilderFactory is instantiated.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

@mprins mprins changed the title Fix code scanning alert no. 1431: Resolving XML external entity in user-controlled data [BRMO-384] Fix Resolving XML external entity in user-controlled data Nov 18, 2024
@mprins mprins self-assigned this Nov 18, 2024
Comment thread brmo-loader/src/main/java/nl/b3p/brmo/loader/xml/NhrXMLReader.java Fixed
mprins and others added 6 commits November 19, 2024 11:14
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…er-controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
StreamSource source = new StreamSource(in);
// Prevent external entity resolution
source.setSystemId("");
transformer.transform(source, r);

Check failure

Code scanning / CodeQL

Resolving XML external entity in user-controlled data

XML parsing depends on a [user-provided value](1) without guarding against external entity expansion.

Copilot Autofix

AI over 1 year ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@codecov

codecov Bot commented Nov 19, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.

Project coverage is 38%. Comparing base (ada4313) to head (248e70f).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/nl/b3p/brmo/loader/xml/BRPXMLReader.java 0% 3 Missing ⚠️
...a/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java 0% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #2310   +/-   ##
========================================
+ Coverage        38%     38%   +1%     
  Complexity      806     806           
========================================
  Files           371     371           
  Lines         18863   18878   +15     
  Branches       1777    1777           
========================================
+ Hits           7153    7162    +9     
- Misses        11138   11143    +5     
- Partials        572     573    +1     
Files with missing lines Coverage Δ
.../nl/b3p/brmo/loader/xml/Brk2SnapshotXMLReader.java 94% <100%> (+1%) ⬆️
...ain/java/nl/b3p/brmo/loader/xml/GbavXMLReader.java 89% <100%> (+1%) ⬆️
...main/java/nl/b3p/brmo/loader/xml/NhrXMLReader.java 95% <100%> (+1%) ⬆️
...main/java/nl/b3p/brmo/loader/xml/WozXMLReader.java 79% <100%> (+1%) ⬆️
...main/java/nl/b3p/brmo/loader/xml/BRPXMLReader.java 0% <0%> (ø)
...a/nl/b3p/brmo/loader/xml/BrkSnapshotXMLReader.java 0% <0%> (ø)

... and 1 file with indirect coverage changes

---- 🚨 Try these New Features:

@mprins
mprins marked this pull request as ready for review November 19, 2024 13:47
@mprins mprins added the bug label Nov 19, 2024
@mprins
mprins merged commit de43aed into master Nov 19, 2024
@mprins
mprins deleted the BRMO-384 branch November 19, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.