Skip to content

Harden XML parsing via commons-secure-xml - #673

Merged
coheigea merged 6 commits into
apache:masterfrom
garydgregory:feature/use-commons-secure-xml
Sep 14, 2026
Merged

coheigea merged 6 commits into
apache:masterfrom
garydgregory:feature/use-commons-secure-xml

Conversation

@garydgregory

Copy link
Copy Markdown
Member

This reuses Apache Commons Secure XML.

This reuses Apache Commons Secure XML.
@garydgregory
garydgregory marked this pull request as ready for review September 6, 2026 17:26
Comment on lines 146 to 153

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These hardenings are no longer necessary, and can be removed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done.

private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(SOAPUtil.class);

private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
private static DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Using newNSInstance() here allows to remove the setNamespaceAware on line 51.

garydgregory and others added 3 commits September 7, 2026 12:21
…rberos/KerberosTest.java

Co-authored-by: Piotr P. Karwasz <piotr@github.copernik.eu>
Remove now redundant code.

@ppkarwasz ppkarwasz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

I found two remaining lines that could be simplified:

Comment thread ws-security-stax/src/main/java/org/apache/wss4j/stax/setup/WSSec.java Outdated
Comment thread ws-security-common/src/test/java/org/apache/wss4j/common/util/SOAPUtil.java Outdated
@coheigea
coheigea merged commit ea0ca8a into apache:master Sep 14, 2026
3 checks passed
@coheigea

Copy link
Copy Markdown
Contributor

Thanks for the contribution!

coheigea pushed a commit that referenced this pull request Sep 14, 2026
* Harden XML parsing via commons-secure-xml

This reuses Apache Commons Secure XML.

* Update integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java

Co-authored-by: Piotr P. Karwasz <piotr@github.copernik.eu>

* Harden XML parsing via commons-secure-xml

Remove now redundant code.

* Use newNSInstance().

* Harden XML parsing via commons-secure-xml

* Sentence starts with a capital letter.

---------

Co-authored-by: Piotr P. Karwasz <piotr@github.copernik.eu>
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.

3 participants