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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -53,6 +53,7 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
|||
addObject(name, object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -53,6 +53,7 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
|||
addObject(name, object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -148,9 +148,9 @@ public interface ServerWebExchange {
|
|||
/**
|
||||
* Return the {@link ApplicationContext} associated with the web application,
|
||||
* 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
|
||||
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext
|
||||
* @see org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)
|
||||
*/
|
||||
@Nullable
|
||||
ApplicationContext getApplicationContext();
|
||||
|
|
|
@ -264,8 +264,7 @@ public abstract class BodyInserters {
|
|||
}
|
||||
|
||||
/**
|
||||
* Inserter to write the given
|
||||
* {@code Publisher<DataBuffer>} to the body.
|
||||
* Inserter to write the given {@code Publisher<DataBuffer>} to the body.
|
||||
* @param publisher the data buffer publisher to write
|
||||
* @param <T> the type of the publisher
|
||||
* @return the inserter to write directly to the body
|
||||
|
|
|
@ -494,18 +494,24 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
|||
*/
|
||||
protected boolean isInvalidPath(String path) {
|
||||
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (path.contains(":/")) {
|
||||
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
||||
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (path.contains("..") && StringUtils.cleanPath(path).contains("../")) {
|
||||
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Path contains \"../\" after call to StringUtils#cleanPath: [" + path + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -630,18 +630,24 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
*/
|
||||
protected boolean isInvalidPath(String path) {
|
||||
if (path.contains("WEB-INF") || path.contains("META-INF")) {
|
||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Path with \"WEB-INF\" or \"META-INF\": [" + path + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (path.contains(":/")) {
|
||||
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
|
||||
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
|
||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Path represents URL or has \"url:\" prefix: [" + path + "]");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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 false;
|
||||
|
|
Loading…
Reference in New Issue