[java-xmltooling COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/xml/encryption/Decrypte...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Dec 13 15:50:44 EST 2013
Author: putmanb
Date: Fri Dec 13 15:50:43 2013
New Revision: 815
URL: http://svn.shibboleth.net/view/java-xmltooling?rev=815&view=rev
Log:
JXT-107: Decrypter internal ParserPool has unsafe defaults
Modified:
branches/REL_1/doc/RELEASE-NOTES.txt
branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java
Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/doc/RELEASE-NOTES.txt?rev=815&r1=814&r2=815&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Fri Dec 13 15:50:43 2013
@@ -5,6 +5,7 @@
[JXT-104] - ClasspathResolver doesn't set systemId on resolved InputSources failing subsequent resolutions
[JXT-105] - DefaultBootstrap unexpectedly uses a parser StaticBasicParserPool with expandEntityReferences set to true
[JXT-106] - Update Apache Santuario (xmlsec) to 1.5.6
+[JXT-107] - Decrypter internal ParserPool has unsafe defaults
Changes in Release 1.4.0
=============================================
Modified: branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java?rev=815&r1=814&r2=815&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java Fri Dec 13 15:50:43 2013
@@ -27,17 +27,21 @@
import java.util.List;
import java.util.Set;
+import javax.xml.XMLConstants;
+
import org.apache.xml.security.Init;
import org.apache.xml.security.encryption.XMLCipher;
import org.apache.xml.security.encryption.XMLEncryptionException;
import org.opensaml.xml.Configuration;
import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.XMLRuntimeException;
import org.opensaml.xml.io.Marshaller;
import org.opensaml.xml.io.MarshallingException;
import org.opensaml.xml.io.Unmarshaller;
import org.opensaml.xml.io.UnmarshallerFactory;
import org.opensaml.xml.io.UnmarshallingException;
-import org.opensaml.xml.parse.BasicParserPool;
+import org.opensaml.xml.parse.ParserPool;
+import org.opensaml.xml.parse.StaticBasicParserPool;
import org.opensaml.xml.parse.XMLParserException;
import org.opensaml.xml.security.Criteria;
import org.opensaml.xml.security.CriteriaSet;
@@ -170,13 +174,14 @@
public class Decrypter {
/** ParserPool used in parsing decrypted data. */
- private final BasicParserPool parserPool;
+ private final ParserPool parserPool;
/** Unmarshaller factory, used in decryption of EncryptedData objects. */
private UnmarshallerFactory unmarshallerFactory;
/** Load-and-Save DOM Implementation singleton. */
// private DOMImplementationLS domImplLS;
+
/** Class logger. */
private final Logger log = LoggerFactory.getLogger(Decrypter.class);
@@ -219,20 +224,15 @@
resolverCriteria = null;
kekResolverCriteria = null;
- // Note: this is hopefully only temporary, until Xerces implements DOM 3 LSParser.parseWithContext().
- parserPool = new BasicParserPool();
- parserPool.setNamespaceAware(true);
-
- // Note: this is necessary due to an unresolved Xerces deferred DOM issue/bug
- HashMap<String, Boolean> features = new HashMap<String, Boolean>();
- features.put("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
- parserPool.setBuilderFeatures(features);
+ // Note: Use of this internal JAXP ParserPool is hopefully only temporary,
+ // to be replaced when Xerces implements DOM 3 LSParser.parseWithContext(...).
+ parserPool = buildParserPool();
unmarshallerFactory = Configuration.getUnmarshallerFactory();
defaultRootInNewDocument = false;
}
-
+
/**
* Get the flag which indicates whether by default the DOM Element which backs a decrypted SAML object
* will be the root of a new DOM document. Defaults to false.
@@ -965,6 +965,40 @@
}
}
}
+
+ /**
+ * Build the internal parser pool instance used to parse decrypted XML.
+ *
+ * <p>
+ * Note: When using a Xerces parser or derivative, the following feature must be set to false:
+ * <code>http://apache.org/xml/features/dom/defer-node-expansion</code>
+ * </p>
+ *
+ * @return a new parser pool instance
+ */
+ protected ParserPool buildParserPool() {
+ StaticBasicParserPool pp = new StaticBasicParserPool();
+ HashMap<String, Boolean> features = new HashMap<String, Boolean>();
+
+ pp.setNamespaceAware(true);
+
+ // Note: this feature config is necessary due to an unresolved Xerces deferred DOM issue/bug
+ features.put("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
+
[... 18 lines stripped ...]
More information about the commits
mailing list