Repository navigation
Embed Xerces 2.12.2 in the XML connector instead of 2.6.2 - #185
Conversation
|
Suggestion: drop jaxen is unused. No class in the connector references Bumping jaxen is not enough on its own. In 1.1.6 and 1.2.0 Proposed change on top of this PR:
Verified locally on this branch with jaxen removed (
|
jaxen 1.1.1 brings xercesImpl 2.6.2, and openicf.osgi.embed copies it into the bundle's lib directory. Trivy flags it with CVE-2012-0881 and CVE-2013-4002, both fixed in 2.12.0. It is not dead weight: the connector's DocumentBuilderFactory.newInstance() runs under the bundle's child-first loader and finds this Xerces. Declare xercesImpl 2.12.2 directly so it wins over jaxen's, and move xml-apis to 1.4.01, the version xercesImpl 2.12.2 is built against.
No class in the connector or in the jars embedded in lib/ references org.jaxen; its only effect was to put jaxen-1.1.1 into the bundle and bring xercesImpl 2.6.2. xercesImpl 2.12.2 stays declared directly: it is the parser the connector uses at runtime and the one the tests read through org.apache.xerces internals.
fd5229e to
b35a626
Compare
|
Applied in b35a626: jaxen is removed from the dependencies and from Rechecked locally: no The PR description is updated accordingly. The 228 it used to give included |
The XML connector bundle embeds
xercesImpl-2.6.2.jar(2004). Trivy flags it in both the 2.1.0-SNAPSHOT build and the released 2.0.4 image with CVE-2012-0881 and CVE-2013-4002 (high, DoS while parsing XML), both fixed in 2.12.0. Code scanning alerts #1857, #1858, #1811, #1812.Where 2.6.2 comes from
jaxen:1.1.1(provided) depends onxercesImpl:2.6.2, andopenicf.osgi.embedlistsxercesImpl.Embed-Dependencyhas no scope filter there, so the transitive provided artifact is copied intolib/.jaxen itself is unused: no class in the connector references
org.jaxen, and neither does any other jar embedded inlib/(Saxon-HE, xsom, xercesImpl, xml-apis, stax-api, relaxngDatatype). jaxen 1.1.1 has noMETA-INF/services, so nothing discovers it as a provider either. Its only effect was to put a 2007 jar inlib/and pull in xercesImpl 2.6.2.Xerces, on the other hand, is the parser the connector actually uses:
XMLHandlerImplcallsDocumentBuilderFactory.newInstance()under the bundle's child-first class loader, which takes xml-apis, Xerces and Saxon from the bundle'slib/(seeXMLConnectorBundleIT).Change
jaxenis removed from the dependencies and fromopenicf.osgi.embed.xercesImpl2.12.2 is declared directly. It has to be: without it Xerces would vanish fromlib/,DocumentBuilderFactory.newInstance()would fall back to the JDK's internal Xerces, and the tests that importorg.apache.xerces.*(XercesNodeLists,XMLHandlerReloadTests) would no longer compile.xml-apis1.3.04 → 1.4.01, the versionxercesImpl2.12.2 depends on.The bundle's
lib/now holdsSaxon-HE-9.4.0.7,relaxngDatatype-20020414,stax-api-1.0-2,xercesImpl-2.12.2,xml-apis-1.4.01andxsom-20070407;Import-Packageno longer mentions jaxen or its optional dom4j/jdom/xom packages. No other bundle in the distribution embeds Xerces.Tests
xml-connectorunit tests: 227, 0 failures. They include the XML connector: every operation reparses and rewrites the whole file, and DOM walks take O(N²) #157 tests that read Xerces internals through reflection (XercesNodeLists:CoreDocumentImpl.fFreeNLCache,ParentNode.fNodeListCache) and assert that the loaded document is not aDeferredDocumentImpl; those fields and classes are unchanged in 2.12.2.XMLConnectorBundleIT(packaged bundle under the child-first loader: create, update, Saxon filter search, authenticate, delete, reload after an outside edit): passes.