Class HardenedWSDLLocator
- All Implemented Interfaces:
javax.wsdl.xml.WSDLLocator
WSDLLocator that refuses a DOCTYPE declaration in the WSDL, or in
anything it imports, before wsdl4j sees it.
wsdl4j parses with its own unhardened DocumentBuilderFactory, and it
fetches the whole import chain itself, so a document reaching it unscreened is an
XXE in the server JVM. SecureWSDLLocator screens the client-side path, but
it fetches over http/https only -- deliberately, since that is all that path needs
-- so it cannot be used where a WSDL is loaded from a file, an archive, a
classpath resource or a catalog, which is what the deployment and runtime paths do.
This one separates the two concerns. It never decides where a document comes from: either a delegate locator resolves it, keeping whatever catalog or archive behaviour that locator implements, or it is read from its URI with any scheme the JVM supports. What it does in both cases is validate the bytes with a hardened SAX parse first, and hand wsdl4j a stream over the validated bytes. So hardening does not narrow what can be loaded.
-
Constructor Summary
ConstructorsConstructorDescriptionHardenedWSDLLocator(String baseURI) Reads from a URI with any scheme the JVM supports, which is what the call sites replaced by this used to let wsdl4j do for itself.HardenedWSDLLocator(javax.wsdl.xml.WSDLLocator delegate) Validates whatever a locator already in use resolves, leaving its resolution behaviour -- catalogs, archives, the classpath -- exactly as it was. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()getImportInputSource(String parentLocation, String importLocation)
-
Constructor Details
-
HardenedWSDLLocator
public HardenedWSDLLocator(javax.wsdl.xml.WSDLLocator delegate) Validates whatever a locator already in use resolves, leaving its resolution behaviour -- catalogs, archives, the classpath -- exactly as it was.- Parameters:
delegate- the locator to wrap
-
HardenedWSDLLocator
Reads from a URI with any scheme the JVM supports, which is what the call sites replaced by this used to let wsdl4j do for itself.- Parameters:
baseURI- the WSDL location
-
-
Method Details
-
getBaseInputSource
- Specified by:
getBaseInputSourcein interfacejavax.wsdl.xml.WSDLLocator
-
getBaseURI
- Specified by:
getBaseURIin interfacejavax.wsdl.xml.WSDLLocator
-
getImportInputSource
- Specified by:
getImportInputSourcein interfacejavax.wsdl.xml.WSDLLocator
-
getLatestImportURI
- Specified by:
getLatestImportURIin interfacejavax.wsdl.xml.WSDLLocator
-
close
public void close()- Specified by:
closein interfacejavax.wsdl.xml.WSDLLocator
-