coheigea commented on a change in pull request #58:
URL: 
https://github.com/apache/santuario-xml-security-java/pull/58#discussion_r703487183



##########
File path: 
src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java
##########
@@ -102,16 +102,19 @@ public Data dereference(URIReference uriRef, 
XMLCryptoContext context)
             }
         }
 
-        try {
-            ResourceResolverContext resContext = new 
ResourceResolverContext(uriAttr, baseURI, secVal);
-            XMLSignatureInput in = ResourceResolver.resolve(resContext);
-            if (in.isOctetStream()) {
-                return new ApacheOctetStreamData(in);
-            } else {
-                return new ApacheNodeSetData(in);
+        ResourceResolverContext resContext = new 
ResourceResolverContext(uriAttr, baseURI, secVal);
+        if ((uriRef instanceof javax.xml.crypto.dsig.Reference) || 
resContext.isURISafeToResolve()) {
+            try {
+                XMLSignatureInput in = ResourceResolver.resolve(resContext);
+                if (in.isOctetStream()) {
+                    return new ApacheOctetStreamData(in);
+                } else {
+                    return new ApacheNodeSetData(in);
+                }
+            } catch (Exception e) {
+                throw new URIReferenceException(e);
             }
-        } catch (Exception e) {
-            throw new URIReferenceException(e);
         }
+        throw new URIReferenceException("Uri " + uri + " is forbidden");

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to