mirror of
https://github.com/spring-cloud/spring-cloud-netflix.git
synced 2026-09-18 08:09:07 +00:00
Add checking for "#". Add logging.
This commit is contained in:
+16
-2
@@ -224,10 +224,24 @@ public class PreDecorationFilter extends ZuulFilter {
|
||||
return forwardURI;
|
||||
}
|
||||
|
||||
private boolean insecurePath(String uri) {
|
||||
return uri.contains("../");
|
||||
private boolean insecurePath(String path) {
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
return false;
|
||||
}
|
||||
boolean isInvalid = path.contains("..");
|
||||
if (isInvalid && log.isWarnEnabled()) {
|
||||
log.warn("Path contains \"..\"");
|
||||
}
|
||||
if (!isInvalid) {
|
||||
isInvalid = path.contains("#");
|
||||
if (isInvalid && log.isWarnEnabled()) {
|
||||
log.warn("Path contains \"#\"");
|
||||
}
|
||||
}
|
||||
return isInvalid;
|
||||
}
|
||||
|
||||
|
||||
private void addProxyHeaders(RequestContext ctx, Route route) {
|
||||
HttpServletRequest request = ctx.getRequest();
|
||||
String host = toHostHeader(request);
|
||||
|
||||
Reference in New Issue
Block a user