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. 3: Resolving XML external entity in user-controlled data #255

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

hazendaz
Copy link
Member

Fixes https://github.com/mybatis/ibatis-2/security/code-scanning/3

To fix the problem, we need to disable the parsing of external entities and DTDs explicitly. This can be done by setting the setFeature method on the DocumentBuilderFactory to disallow DOCTYPE declarations and external entities. Additionally, we should set setExpandEntityReferences(false) to prevent the expansion of entity references.

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

hazendaz and others added 2 commits September 25, 2024 20:14
…controlled data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@hazendaz hazendaz marked this pull request as ready for review September 26, 2024 00:15
@coveralls
Copy link

Coverage Status

coverage: 65.153%. remained the same
when pulling 34b8758 on autofix/alert-3-4b30a4bea3
into b789b99 on master.

@hazendaz hazendaz merged commit 260b4d2 into master Sep 26, 2024
30 checks passed
@hazendaz hazendaz self-assigned this Sep 26, 2024
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