Skip to content

Fix code scanning alert no. 41: Resolving XML external entity in user-controlled data#1205

Merged
lfoppiano merged 2 commits intomasterfrom
alert-autofix-41
Dec 19, 2024
Merged

Fix code scanning alert no. 41: Resolving XML external entity in user-controlled data#1205
lfoppiano merged 2 commits intomasterfrom
alert-autofix-41

Conversation

@lfoppiano
Copy link
Copy Markdown
Member

Fixes https://github.com/kermitt2/grobid/security/code-scanning/41

To fix the problem, we need to ensure that the XML parser is fully secured against XXE attacks. This involves:

  1. Ensuring that the SAXParserFactory is configured to disallow DTDs.
  2. Ensuring that the XMLReader is configured to disallow external entities.
  3. Adding an EntityResolver that returns an empty string for any external entity.

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

lfoppiano and others added 2 commits November 30, 2024 05:24
…-controlled data

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

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 40.763% (-0.02%) from 40.781%
when pulling c3008ec on alert-autofix-41
into 37dcec1 on master.

@lfoppiano lfoppiano marked this pull request as ready for review December 10, 2024 06:40
Copy link
Copy Markdown
Member Author

@lfoppiano lfoppiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes look good to me

@lfoppiano lfoppiano merged commit 09b28cd into master Dec 19, 2024
@lfoppiano lfoppiano deleted the alert-autofix-41 branch December 19, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants