Skip to content

fix: catch defusedxml security errors #1138

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

benmss
Copy link
Member

@benmss benmss commented Aug 4, 2025

Summary

This PR fixes an uncaught exception that can be triggered by XML files with restricted content.

Description of changes

When searching for repositories for Maven projects, Macaron must parse the contents of the related POM files in the XML format. Use of the defusedxml library addresses the various security concerns this parsing involves, but the exceptions these cases can raise have not yet been accounted for.

This PR makes a small adjustment to the pomparser module, extending the catch clause to include the defusedxml security related exceptions.
A unit test has also been included with examples of valid and invalid XML files.

@benmss benmss self-assigned this Aug 4, 2025
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 4, 2025
@benmss benmss added the bug Something isn't working label Aug 4, 2025
@benmss benmss marked this pull request as ready for review August 5, 2025 00:15
@benmss benmss requested review from behnazh-w and tromai as code owners August 5, 2025 00:15
@behnazh-w behnazh-w requested a review from nicallen August 5, 2025 06:29
benmss added 3 commits August 6, 2025 15:32
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
Signed-off-by: Ben Selwyn-Smith <benselwynsmith@googlemail.com>
@benmss benmss force-pushed the benmss/fix-xml-parse-error branch from 1fa7ed6 to 5d1495e Compare August 6, 2025 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants