Blame SOURCES/tomcat-7.0.76-CVE-2018-1304.patch

9a9096
commit 2d69fde135302e8cff984bb2131ec69f2e396964
9a9096
Author: Mark Thomas <markt@apache.org>
9a9096
Date:   Tue Feb 6 11:41:16 2018 +0000
9a9096
9a9096
    git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk@1823309 13f79535-47bb-0310-9956-ffa450edef68
9a9096
9a9096
diff --git a/java/org/apache/catalina/realm/RealmBase.java b/java/org/apache/catalina/realm/RealmBase.java
9a9096
index 2098c2e8cc..9697440d35 100644
9a9096
--- java/org/apache/catalina/realm/RealmBase.java
9a9096
+++ java/org/apache/catalina/realm/RealmBase.java
9a9096
@@ -688,9 +688,9 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
9a9096
9a9096
         // Check each defined security constraint
9a9096
         String uri = request.getRequestPathMB().toString();
9a9096
-        // Bug47080 - in rare cases this may be null
9a9096
+        // Bug47080 - in rare cases this may be null or ""
9a9096
         // Mapper treats as '/' do the same to prevent NPE
9a9096
-        if (uri == null) {
9a9096
+        if (uri == null || uri.length() == 0) {
9a9096
             uri = "/";
9a9096
         }
9a9096
9a9096
@@ -722,7 +722,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
9a9096
                 }
9a9096
9a9096
                 for(int k=0; k < patterns.length; k++) {
9a9096
-                    if(uri.equals(patterns[k])) {
9a9096
+                    // Exact match including special case for the context root.
9a9096
+                    if(uri.equals(patterns[k]) || patterns[k].length() == 0 && uri.equals("/")) {
9a9096
                         found = true;
9a9096
                         if(collection[j].findMethod(method)) {
9a9096
                             if(results == null) {
9a9096
diff -up webapps/docs/changelog.xml.orig webapps/docs/changelog.xml
9a9096
--- webapps/docs/changelog.xml.orig	2019-02-28 15:11:59.735767416 -0500
9a9096
+++ webapps/docs/changelog.xml	2019-02-28 15:12:23.805697236 -0500
9a9096
@@ -64,6 +64,10 @@
9a9096
         When generating a redirect to a directory in the Default Servlet, avoid
9a9096
         generating a protocol relative redirect. (markt)
9a9096
       </fix>
9a9096
+      <fix>
9a9096
+        <bug>62067</bug>: Correctly apply security constraints mapped to the
9a9096
+        context root using a URL pattern of "". (markt)
9a9096
+      </fix>
9a9096
     </changelog>
9a9096
   </subsection>
9a9096
 </section>