Issue #6497 - add warnings for alias checker deprecations

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2021-10-15 12:01:35 +11:00
parent 2426b34a51
commit 4682e6381f
2 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,7 @@
package org.eclipse.jetty.server; package org.eclipse.jetty.server;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -46,9 +47,18 @@ public class SameFileAliasChecker implements AliasCheck
{ {
private static final Logger LOG = LoggerFactory.getLogger(SameFileAliasChecker.class); private static final Logger LOG = LoggerFactory.getLogger(SameFileAliasChecker.class);
public SameFileAliasChecker()
{
LOG.warn("SameFileAliasChecker is deprecated");
}
@Override @Override
public boolean check(String pathInContext, Resource resource) public boolean check(String pathInContext, Resource resource)
{ {
// Do not allow any file separation characters in the URI.
if (File.separatorChar != '/' && pathInContext.indexOf(File.separatorChar) >= 0)
return false;
// Only support PathResource alias checking // Only support PathResource alias checking
if (!(resource instanceof PathResource)) if (!(resource instanceof PathResource))
return false; return false;

View File

@ -3041,6 +3041,11 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
@Deprecated @Deprecated
public static class ApproveAliases implements AliasCheck public static class ApproveAliases implements AliasCheck
{ {
public ApproveAliases()
{
LOG.warn("ApproveAliases is deprecated");
}
@Override @Override
public boolean check(String pathInContext, Resource resource) public boolean check(String pathInContext, Resource resource)
{ {