coheigea commented on code in PR #3803:
URL: https://github.com/apache/cxf/pull/3803#discussion_r4744556429


##########
rt/wsdl/src/main/java/org/apache/cxf/wsdl11/AbstractWrapperWSDLLocator.java:
##########
@@ -95,14 +93,12 @@ public String getBaseURI() {
     }
 
     public InputSource getImportInputSource(String parentLocation, String 
importLocation) {
-        // Do a check on the scheme to see if it's anything that could be a 
security risk
-        try {
-            URI url = new URI(importLocation);
-            if (!(url.getScheme() == null || 
URIResolver.getAllowedSchemes().contains(url.getScheme()))) {
-                throw new IllegalArgumentException("The " + url.getScheme() + 
" URI scheme is not allowed");
-            }
-        } catch (URISyntaxException e) {
-            // Just continue here as we might still be able to load it from 
the filesystem
+        // Do a check on the scheme to see if it's anything that could be a 
security risk. This also checks
+        // the location of an archive (e.g. jar:ftp://...), and does not need 
the import location to parse
+        // as a URI. A relative import is resolved against its parent, which 
has already been checked.
+        String scheme = URIResolver.getDisallowedScheme(importLocation, null);

Review Comment:
   @reta The boolean form already exists as 
URIResolver.isAllowedReference(href, base). I’ve used getDisallowedScheme here 
because the error message names the rejected scheme, e.g. “The ftp URI scheme 
is not allowed” for jar:ftp://… (the validator tests check for that message). 
Happy to switch to isAllowedReference with a more generic message if you’d 
prefer.



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