From bf078be52d28b485dad99e4f8e682b088768e8df Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Fri, 30 Jul 2021 18:58:52 +1000 Subject: [PATCH] Issue #6497 - aliasChecker with no baseResource should always denies aliases Signed-off-by: Lachlan Roberts --- .../eclipse/jetty/server/AllowedResourceAliasChecker.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java index 14a7f138ae6a..4a050790046f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AllowedResourceAliasChecker.java @@ -76,9 +76,6 @@ protected Path getBasePath() protected void doStart() throws Exception { _basePath = getPath(_contextHandler.getBaseResource()); - if (_basePath == null) - throw new IllegalStateException("Could not obtain base resource path"); - String[] protectedTargets = _contextHandler.getProtectedTargets(); if (protectedTargets != null) { @@ -99,6 +96,9 @@ protected void doStop() throws Exception @Override public boolean check(String uri, Resource resource) { + if (_basePath == null) + return false; + // The existence check resolves the symlinks. if (!resource.exists()) return false;