You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2022/10/21 11:05:29 UTC
[GitHub] [knox] moresandeep commented on a diff in pull request #650: KNOX-2827 - isDispatchAllowed should cut off path segments from the URL
moresandeep commented on code in PR #650:
URL: https://github.com/apache/knox/pull/650#discussion_r1001661250
##########
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/GatewayDispatchFilter.java:
##########
@@ -145,14 +147,21 @@ private boolean isDispatchAllowed(HttpServletRequest request) {
if (whitelist != null) {
String requestURI = request.getRequestURI();
- String decodedURL = null;
+ String decodedURL = requestURI;
try {
decodedURL = URLDecoder.decode(requestURI, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
//
}
+ String baseUrl;
+ try {
+ URL url = new URL(decodedURL);
+ baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), "").toString();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
Review Comment:
We should log the error before wrapping the exception and throwing.
--
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: dev-unsubscribe@knox.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org