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



##########
File path: 
src/main/java/org/apache/xml/security/utils/resolver/ResourceResolverContext.java
##########
@@ -51,4 +57,12 @@ public ResourceResolverContext(Attr attr, String baseUri, 
boolean secureValidati
         return properties;
     }
 
+    public boolean isSafeURIToResolve() {
+        if (allowUnsafeResourceResolving) {
+            return true;
+        }
+        boolean forbiddenURI = (uriToResolve != null && 
(uriToResolve.startsWith("file:") || uriToResolve.startsWith("http:")))
+                || (baseUri != null && (baseUri.startsWith("file:") || 
baseUri.startsWith("http:")));

Review comment:
       For the baseUri, you can make this check more precise by only checking 
relative URIs. This way you won't trigger false cases where a baseURI has been 
set for resolving some other URI but not an unsafe reference URI. Something 
like:
   
   `if (baseUri != null && !baseUri.isEmpty() && baseUri.charAt(0) != '#') {
     // now check if it is file or http ...`




-- 
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