Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Correctly apply security constraints mapped to the context root using a
URL pattern of ""

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1823306 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Feb 6, 2018
1 parent a8b0e84 commit 723ea6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions java/org/apache/catalina/realm/RealmBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,9 @@ public void backgroundProcess() {

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

Expand Down Expand Up @@ -580,7 +580,8 @@ public void backgroundProcess() {
}

for(int k=0; k < patterns.length; k++) {
if(uri.equals(patterns[k])) {
// Exact match including special case for the context root.
if(uri.equals(patterns[k]) || patterns[k].length() == 0 && uri.equals("/")) {
found = true;
if(collection[j].findMethod(method)) {
if(results == null) {
Expand Down
4 changes: 4 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
When using Tomcat embedded, only perform Authenticator configuration
once during web application start. (markt)
</fix>
<fix>
<bug>62067</bug>: Correctly apply security constraints mapped to the
context root using a URL pattern of <code>&quot;&quot;</code>. (markt)
</fix>
</changelog>
</subsection>
<subsection name="Coyote">
Expand Down

0 comments on commit 723ea6a

Please sign in to comment.