Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
tomcat.19932
tomcat-9.0-CVE-2021-24122.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tomcat-9.0-CVE-2021-24122.patch of Package tomcat.19932
From 935fc5582dc25ae10bab6f9d5629ff8d996cb533 Mon Sep 17 00:00:00 2001 From: Mark Thomas <markt@apache.org> Date: Fri, 6 Nov 2020 19:03:57 +0000 Subject: [PATCH] Fix BZ 64871. Log if file access is blocked due to symlinks https://bz.apache.org/bugzilla/show_bug.cgi?id=64871 --- .../webresources/AbstractFileResourceSet.java | 19 ++++++++++++++++++- .../webresources/LocalStrings.properties | 2 ++ webapps/docs/changelog.xml | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) Index: apache-tomcat-9.0.36-src/java/org/apache/catalina/webresources/AbstractFileResourceSet.java =================================================================== --- apache-tomcat-9.0.36-src.orig/java/org/apache/catalina/webresources/AbstractFileResourceSet.java +++ apache-tomcat-9.0.36-src/java/org/apache/catalina/webresources/AbstractFileResourceSet.java @@ -22,11 +22,15 @@ import java.net.URL; import org.apache.catalina.LifecycleException; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.compat.JrePlatform; import org.apache.tomcat.util.http.RequestUtil; public abstract class AbstractFileResourceSet extends AbstractResourceSet { + private static final Log log = LogFactory.getLog(AbstractFileResourceSet.class); + protected static final String[] EMPTY_STRING_ARRAY = new String[0]; private File fileBase; @@ -128,6 +132,19 @@ protected final File file(String name, boolean mustExist) { canPath = normalize(canPath); } if (!canPath.equals(absPath)) { + if (!canPath.equalsIgnoreCase(absPath)) { + // Typically means symlinks are in use but being ignored. Given + // the symlink was likely created for a reason, log a warning + // that it was ignored. + String msg = sm.getString("abstractFileResourceSet.canonicalfileCheckFailed", + getRoot().getContext().getName(), absPath, canPath); + // Log issues with configuration files at a higher level + if(absPath.startsWith("/META-INF/") || absPath.startsWith("/WEB-INF/")) { + log.error(msg); + } else { + log.warn(msg); + } + } return null; } Index: apache-tomcat-9.0.36-src/java/org/apache/catalina/webresources/LocalStrings.properties =================================================================== --- apache-tomcat-9.0.36-src.orig/java/org/apache/catalina/webresources/LocalStrings.properties +++ apache-tomcat-9.0.36-src/java/org/apache/catalina/webresources/LocalStrings.properties @@ -15,6 +15,8 @@ abstractArchiveResourceSet.setReadOnlyFalse=Archive based WebResourceSets such as those based on JARs are hard-coded to be read-only and may not be configured to be read-write +abstractFileResourceSet.canonicalfileCheckFailed=Resource for web application [{0}] at path [{1}] was not loaded as the canonical path [{2}] did not match. Use of symlinks is one possible cause. + abstractResource.getContentFail=Unable to return [{0}] as a byte array abstractResource.getContentTooLarge=Unable to return [{0}] as a byte array since the resource is [{1}] bytes in size which is larger than the maximum size of a byte array Index: apache-tomcat-9.0.36-src/webapps/docs/changelog.xml =================================================================== --- apache-tomcat-9.0.36-src.orig/webapps/docs/changelog.xml +++ apache-tomcat-9.0.36-src/webapps/docs/changelog.xml @@ -81,6 +81,10 @@ <bug>64493</bug>: Revert possible change of returned protocol attribute value on the <code>Connector</code>. (remm) </fix> + <add> + <bug>64871</bug>: Log a warning if Tomcat blocks access to a file + because it uses symlinks. (markt) + </add> </changelog> </subsection> <subsection name="Coyote">
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor