Polishing
This commit is contained in:
parent
bf272b0b21
commit
ae8f680d2e
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,6 +53,7 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
||||||
addObject(name, object);
|
addObject(name, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given object to the list of JNDI objects that this template will expose.
|
* Add the given object to the list of JNDI objects that this template will expose.
|
||||||
* @param name the name the client is expected to look up
|
* @param name the name the client is expected to look up
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2018 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -53,6 +53,7 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
||||||
addObject(name, object);
|
addObject(name, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given object to the list of JNDI objects that this template will expose.
|
* Add the given object to the list of JNDI objects that this template will expose.
|
||||||
* @param name the name the client is expected to look up
|
* @param name the name the client is expected to look up
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,9 @@ public interface ServerWebExchange {
|
||||||
/**
|
/**
|
||||||
* Return the {@link ApplicationContext} associated with the web application,
|
* Return the {@link ApplicationContext} associated with the web application,
|
||||||
* if it was initialized with one via
|
* if it was initialized with one via
|
||||||
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext}.
|
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)}.
|
||||||
* @since 5.0.3
|
* @since 5.0.3
|
||||||
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext
|
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
ApplicationContext getApplicationContext();
|
ApplicationContext getApplicationContext();
|
||||||
|
|
|
||||||
|
|
@ -264,8 +264,7 @@ public abstract class BodyInserters {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserter to write the given
|
* Inserter to write the given {@code Publisher<DataBuffer>} to the body.
|
||||||
* {@code Publisher<DataBuffer>} to the body.
|
|
||||||
* @param publisher the data buffer publisher to write
|
* @param publisher the data buffer publisher to write
|
||||||
* @param <T> the type of the publisher
|
* @param <T> the type of the publisher
|
||||||
* @return the inserter to write directly to the body
|
* @return the inserter to write directly to the body
|
||||||
|
|
|
||||||
|
|
@ -494,18 +494,24 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||||
*/
|
*/
|
||||||
protected boolean isInvalidPath(String path) {
|
protected boolean isInvalidPath(String path) {
|
||||||
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
||||||
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (path.contains(":/")) {
|
if (path.contains(":/")) {
|
||||||
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
||||||
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
||||||
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
|
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
|
||||||
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -630,18 +630,24 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||||
*/
|
*/
|
||||||
protected boolean isInvalidPath(String path) {
|
protected boolean isInvalidPath(String path) {
|
||||||
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
||||||
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (path.contains(":/")) {
|
if (path.contains(":/")) {
|
||||||
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
||||||
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
||||||
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
|
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
|
||||||
logger.warn("Invalid Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
if (logger.isWarnEnabled()) {
|
||||||
|
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue