Skip to content

Commit 5af7c13

Browse files
committed
Correctly apply security constraints mapped to the context root using a URL pattern of "" git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc8.5.x/trunk@1823307 13f79535-47bb-0310-9956-ffa450edef68
1 parent 217bd5f commit 5af7c13

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

java/org/apache/catalina/realm/RealmBase.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ public void backgroundProcess() {
550550

551551
// Check each defined security constraint
552552
String uri = request.getRequestPathMB().toString();
553-
// Bug47080 - in rare cases this may be null
553+
// Bug47080 - in rare cases this may be null or ""
554554
// Mapper treats as '/' do the same to prevent NPE
555-
if (uri == null) {
555+
if (uri == null || uri.length() == 0) {
556556
uri = "/";
557557
}
558558

@@ -584,7 +584,8 @@ public void backgroundProcess() {
584584
}
585585

586586
for(int k=0; k < patterns.length; k++) {
587-
if(uri.equals(patterns[k])) {
587+
// Exact match including special case for the context root.
588+
if(uri.equals(patterns[k]) || patterns[k].length() == 0 && uri.equals("/")) {
588589
found = true;
589590
if(collection[j].findMethod(method)) {
590591
if(results == null) {

webapps/docs/changelog.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
Avoid NPE in ThreadLocalLeakPreventionListener if there is no Engine.
7070
(remm)
7171
</fix>
72+
<fix>
73+
<bug>62067</bug>: Correctly apply security constraints mapped to the
74+
context root using a URL pattern of <code>&quot;&quot;</code>. (markt)
75+
</fix>
7276
</changelog>
7377
</subsection>
7478
<subsection name="Coyote">

0 commit comments

Comments
 (0)