aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java11
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java24
2 files changed, 32 insertions, 3 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
index 7a246d6..beb1c15 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/TransformParser.java
@@ -23,11 +23,14 @@
package at.gv.egovernment.moa.spss.api.xmlbind;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import javax.xml.transform.TransformerException;
+
import org.w3c.dom.Element;
import org.w3c.dom.traversal.NodeIterator;
@@ -42,6 +45,7 @@ import at.gv.egovernment.moa.spss.api.common.XPathFilter;
import at.gv.egovernment.moa.spss.api.common.XPathFilter2Transform;
import at.gv.egovernment.moa.spss.api.common.XPathTransform;
import at.gv.egovernment.moa.spss.api.common.XSLTTransform;
+import at.gv.egovernment.moaspss.logging.Logger;
import at.gv.egovernment.moaspss.util.Constants;
import at.gv.egovernment.moaspss.util.DOMUtils;
import at.gv.egovernment.moaspss.util.XPathUtils;
@@ -137,6 +141,13 @@ public class TransformParser {
} else if (XSLTTransform.XSLT.equals(algorithmUri)) {
return parseXSLTTransform(transformElem);
} else {
+ try {
+ Logger.info("Find suspect XML transformation: " + DOMUtils.serializeNode(transformElem));
+
+ } catch (TransformerException | IOException e) {
+ Logger.warn("Can not serialize suspect XML transformation", e);
+
+ }
throw new MOAApplicationException("1108", new Object[] { algorithmUri });
}
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java
index 5f8b46d..6a79a87 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java
@@ -48,8 +48,11 @@ import org.w3c.dom.Element;
import org.w3c.dom.traversal.NodeIterator;
import org.xml.sax.SAXException;
+import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.api.common.TSLConfiguration;
import at.gv.egovernment.moa.spss.api.impl.TSLConfigurationImpl;
+import at.gv.egovernment.moa.spss.api.xmlbind.ProfileParser;
+import at.gv.egovernment.moa.spss.api.xmlbind.TransformParser;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
@@ -66,6 +69,7 @@ import iaik.pki.revocation.RevocationSourceTypes;
import iaik.server.modules.xml.BlackListEntry;
import iaik.server.modules.xml.ExternalReferenceChecker;
import iaik.server.modules.xml.WhiteListEntry;
+import iaik.server.modules.xmlverify.TransformationParsingException;
import iaik.utils.RFC2253NameParser;
import iaik.utils.RFC2253NameParserException;
import iaik.xml.crypto.utils.URI;
@@ -1095,7 +1099,21 @@ public class ConfigurationPartsBuilder {
* @return The mapping from profile ID to profile.
*/
public Map buildVerifyTransformsInfoProfiles() {
- return loadProfiles(VERIFY_TRANSFORMS_INFO_PROFILE_XPATH, "VerifyTransformsInfoProfile");
+ Map<String, Element> profiles = loadProfiles(VERIFY_TRANSFORMS_INFO_PROFILE_XPATH, "VerifyTransformsInfoProfile");
+
+ // validate entries
+ ProfileParser profileParser = new ProfileParser();
+ profiles.entrySet().forEach(el -> {
+ try {
+ profileParser.parseVerifyTransformsInfoProfile(el.getValue());
+
+ } catch (MOAApplicationException e) {
+ Logger.warn("TransformationProfile with Id:" + el.getKey() + " is invalid: " + e.getMessage());
+ }
+ });
+
+ return profiles;
+
}
/**
@@ -1116,8 +1134,8 @@ public class ConfigurationPartsBuilder {
*
* @return Map The profile ID to profile mapping.
*/
- private Map loadProfiles(String xpath, String profileRoot) {
- final Map profiles = new HashMap();
+ private Map<String, Element> loadProfiles(String xpath, String profileRoot) {
+ final Map<String, Element> profiles = new HashMap<>();
final NodeIterator profileIter = XPathUtils.selectNodeIterator(getConfigElem(), xpath);
Element profileElem;