Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.

Commit 9e700b9

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.0.x/trunk@1823308 13f79535-47bb-0310-9956-ffa450edef68
1 parent e241ae1 commit 9e700b9

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
@@ -757,9 +757,9 @@ public void backgroundProcess() {
757757

758758
// Check each defined security constraint
759759
String uri = request.getRequestPathMB().toString();
760-
// Bug47080 - in rare cases this may be null
760+
// Bug47080 - in rare cases this may be null or ""
761761
// Mapper treats as '/' do the same to prevent NPE
762-
if (uri == null) {
762+
if (uri == null || uri.length() == 0) {
763763
uri = "/";
764764
}
765765

@@ -791,7 +791,8 @@ public void backgroundProcess() {
791791
}
792792

793793
for(int k=0; k < patterns.length; k++) {
794-
if(uri.equals(patterns[k])) {
794+
// Exact match including special case for the context root.
795+
if(uri.equals(patterns[k]) || patterns[k].length() == 0 && uri.equals("/")) {
795796
found = true;
796797
if(collection[j].findMethod(method)) {
797798
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
rather than the user facing Principal object as Tomcat requires the
7070
internal object to correctly process later authorization checks. (markt)
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="Other">

0 commit comments

Comments
 (0)