This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new 51aa88f8b2 Upgrade xmlsec to 4.0.4 (#1428)
51aa88f8b2 is described below
commit 51aa88f8b216c2763b1e6d521717642c70de1090
Author: PJ Fanning <[email protected]>
AuthorDate: Sat Oct 17 18:13:21 2026 +0100
Upgrade xmlsec to 4.0.4 (#1428)
* Upgrade xmlsec to 4.0.4
xmlsec 4 makes XMLSignatureInput abstract, so RelationshipTransformService
now uses XMLSignatureNodeInput. The xmlsec 4 module descriptor requires
jakarta.xml.bind and jakarta.activation (provided scope in its pom), so add
those APIs alongside xmlsec in the signing features and the Ant build.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Explain why the jakarta APIs are listed next to xmlsec
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ant: add xmlsec as a root module for ooxml tests
xmlsec 3 was an automatic module, so it was resolved along with the other
automatic modules on the module path. xmlsec 4 is an explicit module and
poi-ooxml only has 'requires static' on it, so it must be added explicitly.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* changes.xml: note xmlsec 4 JPMS resolution
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* poi-integration: require the ant module
TestAllFiles uses Ant's DirectoryScanner. It used to get access implicitly
because requiring xmlsec 3 (an automatic module) grants readability of all
automatic modules; xmlsec 4 is an explicit module, so require ant directly
and put the ant jar on the Ant build's integration module path.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
build.gradle | 4 +++-
build.xml | 17 ++++++++++++++---
poi-integration/src/test/jpms/module-info.java | 1 +
poi-ooxml/build.gradle | 6 ++++++
.../dsig/services/RelationshipTransformService.java | 4 ++--
src/documentation/content/xdocs/changes.xml | 2 +-
6 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/build.gradle b/build.gradle
index 9ffa70c8b0..a8d00e04db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -175,7 +175,9 @@ subprojects {
guavaVersion = '33.7.2-jre'
slf4jVersion = '2.0.20'
jspecifyVersion = '1.0.1'
- xmlSecVersion = '3.0.6'
+ xmlSecVersion = '4.0.4'
+ jakartaXmlBindVersion = '4.0.2'
+ jakartaActivationVersion = '2.1.3'
apiGuardianVersion = '1.1.2'
jdkVersion = (project.properties['jdkVersion'] ?: '17') as int
diff --git a/build.xml b/build.xml
index f5b1db5f1a..4973b419c6 100644
--- a/build.xml
+++ b/build.xml
@@ -292,7 +292,9 @@ under the License.
<dependency prefix="main.antlauncher"
artifact="org.apache.ant:ant-launcher:1.10.18" usage="excelant"/>
<!-- xml signature libs - not part of the distribution -->
- <dependency prefix="dsig.xmlsec"
artifact="org.apache.santuario:xmlsec:3.0.6" usage="ooxml-provided"/>
+ <dependency prefix="dsig.xmlsec"
artifact="org.apache.santuario:xmlsec:4.0.4" usage="ooxml-provided"/>
+ <dependency prefix="dsig.jakarta-xml-bind"
artifact="jakarta.xml.bind:jakarta.xml.bind-api:4.0.2" usage="ooxml-provided"/>
+ <dependency prefix="dsig.jakarta-activation"
artifact="jakarta.activation:jakarta.activation-api:2.1.3"
usage="ooxml-provided"/>
<dependency prefix="dsig.bouncycastle-prov"
artifact="org.bouncycastle:bcprov-jdk18on:1.86" usage="ooxml-provided"/>
<dependency prefix="dsig.bouncycastle-pkix"
artifact="org.bouncycastle:bcpkix-jdk18on:1.86" usage="ooxml-provided"/>
<dependency prefix="dsig.bouncycastle-util"
artifact="org.bouncycastle:bcutil-jdk18on:1.86" usage="ooxml-provided"/>
@@ -451,6 +453,8 @@ under the License.
<path id="ooxml.xmlsec.classpath">
<pathelement location="${dsig.xmlsec.jar}"/>
+ <pathelement location="${dsig.jakarta-xml-bind.jar}"/>
+ <pathelement location="${dsig.jakarta-activation.jar}"/>
<pathelement location="${dsig.bouncycastle-prov.jar}"/>
<pathelement location="${dsig.bouncycastle-pkix.jar}"/>
<pathelement location="${dsig.bouncycastle-util.jar}"/>
@@ -715,6 +719,7 @@ under the License.
<include name="fontbox-3.0.5.jar"/>
<include name="graphics2d-3.0.3.jar"/>
<include name="stax2-api-4.2.1.jar"/>
+ <include name="xmlsec-3.0.6.jar"/>
</fileset>
<fileset dir="${basedir}/lib/ooxml-tests">
<include name="guava-20.0.jar"/>
@@ -787,6 +792,8 @@ under the License.
<available file="${dsig.bouncycastle-pkix.jar}"/>
<available file="${dsig.bouncycastle-util.jar}"/>
<available file="${dsig.xmlsec.jar}"/>
+ <available file="${dsig.jakarta-xml-bind.jar}"/>
+ <available file="${dsig.jakarta-activation.jar}"/>
<available file="${main.commons-collections4.jar}"/>
<available file="${main.commons-logging.jar}"/>
<available file="${main.commons-math3.jar}"/>
@@ -847,6 +854,8 @@ under the License.
<downloadfile src="${dsig.bouncycastle-pkix.url}"
dest="${dsig.bouncycastle-pkix.jar}"/>
<downloadfile src="${dsig.bouncycastle-util.url}"
dest="${dsig.bouncycastle-util.jar}"/>
<downloadfile src="${dsig.xmlsec.url}" dest="${dsig.xmlsec.jar}"/>
+ <downloadfile src="${dsig.jakarta-xml-bind.url}"
dest="${dsig.jakarta-xml-bind.jar}"/>
+ <downloadfile src="${dsig.jakarta-activation.url}"
dest="${dsig.jakarta-activation.jar}"/>
</target>
<target name="check-ooxml-jars">
@@ -1479,7 +1488,7 @@ under the License.
<poiunit failureproperty="ooxml.test.failed" heap="768"
modulepath-ref="restest.modules"
module1="ooxml" module2="scratchpad"
module3="org.bouncycastle.pkix" module4="org.slf4j"
- module5="org.apache.commons.logging"
+ module5="org.apache.santuario.xmlsec,org.apache.commons.logging"
outputDir="${ooxml.reports.test}">
<zipfileset
src="build/dist/maven/poi-ooxml-tests/poi-ooxml-${version.id}-tests.jar">
<include name="**/${testpattern}.class"/>
@@ -1558,6 +1567,7 @@ under the License.
<pathelement path="${ooxml.lib}"/>
<pathelement path="${ooxml-provided.lib}"/>
<pathelement path="${ooxml-tests.lib}"/>
+ <pathelement location="${main.ant.jar}"/>
</modulepath>
</javac>
@@ -1799,7 +1809,7 @@ under the License.
<sequential>
<poiunit failureproperty="ooxml.test.failed" heap="768"
jacocodest="build/jacoco-@{type}.exec"
modulepath-ref="@{modulepath-ref}" module1="ooxml"
module2="scratchpad" module3="org.bouncycastle.pkix"
- module4="org.slf4j" module5="org.apache.commons.logging"
outputDir="${ooxml.reports.test}">
+ module4="org.slf4j"
module5="org.apache.santuario.xmlsec,org.apache.commons.logging"
outputDir="${ooxml.reports.test}">
<zipfileset
src="build/dist/maven/poi-ooxml-tests/poi-ooxml-${version.id}-tests.jar">
<include name="**/${testpattern}.class"/>
<exclude name="**/*$*.class"/>
@@ -1859,6 +1869,7 @@ under the License.
<pathelement path="lib/ooxml"/>
<pathelement path="lib/ooxml-provided"/>
<pathelement path="lib/ooxml-tests"/>
+ <pathelement location="${main.ant.jar}"/>
</path>
<poiunit failureproperty="integration.test.failed" heap="3072"
showoutput="true" jacocodest="build/jacoco-integration.exec"
diff --git a/poi-integration/src/test/jpms/module-info.java
b/poi-integration/src/test/jpms/module-info.java
index 6ba7e60e4a..a75333f468 100644
--- a/poi-integration/src/test/jpms/module-info.java
+++ b/poi-integration/src/test/jpms/module-info.java
@@ -24,6 +24,7 @@ module org.apache.poi.stress {
requires org.apache.commons.collections4;
requires org.apache.commons.csv;
requires org.apache.commons.io;
+ requires ant;
requires transitive org.apache.poi.poi;
requires org.apache.poi.examples;
requires org.apache.poi.scratchpad;
diff --git a/poi-ooxml/build.gradle b/poi-ooxml/build.gradle
index 69d7216439..352e4d550f 100644
--- a/poi-ooxml/build.gradle
+++ b/poi-ooxml/build.gradle
@@ -70,11 +70,17 @@ dependencies {
api 'com.github.virtuald:curvesapi:1.08'
api 'org.apache.commons:commons-collections4:4.6.0'
+ // xmlsec 4's module-info requires jakarta.xml.bind and
jakarta.activation, but its pom
+ // declares them with provided scope, so they must be supplied when xmlsec
is on the module path
signingImplementation "org.apache.santuario:xmlsec:${xmlSecVersion}"
+ signingImplementation
"jakarta.xml.bind:jakarta.xml.bind-api:${jakartaXmlBindVersion}"
+ signingImplementation
"jakarta.activation:jakarta.activation-api:${jakartaActivationVersion}"
signingImplementation
"org.bouncycastle:bcpkix-jdk18on:${bouncyCastleVersion}"
signingImplementation
"org.bouncycastle:bcutil-jdk18on:${bouncyCastleVersion}"
rendersignImplementation "org.apache.santuario:xmlsec:${xmlSecVersion}"
+ rendersignImplementation
"jakarta.xml.bind:jakarta.xml.bind-api:${jakartaXmlBindVersion}"
+ rendersignImplementation
"jakarta.activation:jakarta.activation-api:${jakartaActivationVersion}"
rendersignImplementation
"org.bouncycastle:bcpkix-jdk18on:${bouncyCastleVersion}"
rendersignImplementation
"org.bouncycastle:bcutil-jdk18on:${bouncyCastleVersion}"
diff --git
a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/services/RelationshipTransformService.java
b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/services/RelationshipTransformService.java
index 23dbb152f3..9a4f93b733 100644
---
a/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/services/RelationshipTransformService.java
+++
b/poi-ooxml/src/main/java/org/apache/poi/poifs/crypt/dsig/services/RelationshipTransformService.java
@@ -54,7 +54,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.poi.logging.PoiLogManager;
import org.apache.poi.ooxml.util.DocumentHelper;
import org.apache.poi.util.SuppressForbidden;
-import org.apache.xml.security.signature.XMLSignatureInput;
+import org.apache.xml.security.signature.XMLSignatureNodeInput;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import
org.openxmlformats.schemas.xpackage.x2006.digitalSignature.CTRelationshipReference;
@@ -229,7 +229,7 @@ public class RelationshipTransformService extends
TransformService {
LOG.atDebug().log("# Relationship elements: {}", box(rsList.size()));
- return new ApacheNodeSetData(new XMLSignatureInput(root));
+ return new ApacheNodeSetData(new XMLSignatureNodeInput(root));
}
public Data transform(Data data, XMLCryptoContext context, OutputStream
os) throws TransformException {
diff --git a/src/documentation/content/xdocs/changes.xml
b/src/documentation/content/xdocs/changes.xml
index e057f62562..d875804294 100644
--- a/src/documentation/content/xdocs/changes.xml
+++ b/src/documentation/content/xdocs/changes.xml
@@ -85,7 +85,7 @@
<summary-item>Upgrade pdfbox dependency to 3.0.8</summary-item>
<summary-item>Upgrade SLF4J to 2.0.20</summary-item>
<summary-item>Upgrade xmlbeans dependency to 5.4.1</summary-item>
- <summary-item>Upgrade xmlsec dependency to 3.0.6</summary-item>
+ <summary-item>Upgrade xmlsec dependency to 4.0.4 (when using JPMS,
jakarta.xml.bind-api and jakarta.activation-api are also needed on the module
path, and xmlsec is no longer an automatic module so it must be resolved
explicitly, e.g. with --add-modules org.apache.santuario.xmlsec or a requires
in your own module-info)</summary-item>
<summary-item>Upgrade Ant to 1.10.18</summary-item>
<summary-item>Upgrade Gradle to 9.8.1</summary-item>
<summary-item>Upgrade JUnit to 6.1.3</summary-item>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]