Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

lfoppiano
Copy link
Collaborator

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

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
Collaborator 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
8 of 10 checks passed
@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