Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D3F55200B9D for ; Wed, 28 Sep 2016 15:16:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D2B9F160ADD; Wed, 28 Sep 2016 13:16:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2599A160AE2 for ; Wed, 28 Sep 2016 15:16:26 +0200 (CEST) Received: (qmail 921 invoked by uid 500); 28 Sep 2016 13:16:26 -0000 Mailing-List: contact dev-help@shiro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shiro.apache.org Delivered-To: mailing list dev@shiro.apache.org Received: (qmail 843 invoked by uid 99); 28 Sep 2016 13:16:26 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2016 13:16:26 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 95E372C2A6A for ; Wed, 28 Sep 2016 13:16:20 +0000 (UTC) Date: Wed, 28 Sep 2016 13:16:20 +0000 (UTC) From: "Brian Demers (JIRA)" To: dev@shiro.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SHIRO-584) URL Path matching issue with WebUtils.getPathWithinApplication MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 28 Sep 2016 13:16:27 -0000 [ https://issues.apache.org/jira/browse/SHIRO-584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Brian Demers resolved SHIRO-584. -------------------------------- Resolution: Fixed Fix Version/s: 1.3.2 > URL Path matching issue with WebUtils.getPathWithinApplication > -------------------------------------------------------------- > > Key: SHIRO-584 > URL: https://issues.apache.org/jira/browse/SHIRO-584 > Project: Shiro > Issue Type: Bug > Components: Authorization (access control) > Affects Versions: 1.3.1 > Environment: Shiro 1.3.1, Tomcat 7.0.70 > Reporter: Mark Bortolazzo > Fix For: 1.3.2 > > > Summary: > In WebUtils.getPathWithinApplication > - request.getRequestURI() - Is normalized to remove //, ../, ./ etc > - request.getContextPath() - is not normalized > When these values are compared for which url authorization to use all existing rules are bypassed. > Long Version: > If I access my application using a url like: > http://localhost:8080//context/path/Action.action > (note the double // after the port): > This causes shiro to not match any of my urls > The cause of this appears to be in WebUtils.getPathWithinApplication() > in WebUtils.getContextPath() > request.getContextPath() returns //context > which is left as //context > In WebUtils.getRequestUri() > request.getRequestURI() returns //context/path/Action.action > this is then sanitized in the WebUtils.normalize() method to return /context/path/Action.action. > WebUtils.getPathWithinApplication then compares the 2 values with: > if (StringUtils.startsWithIgnoreCase(requestUri, contextPath)) > Which doesn't match. > So the method returns /context/path/Action.action instead of /path/Action.action > Because all the matching URLS are /path/** they don't match the /context/path > So PathMatchingFilterChainResolver.getChain() doesn't return any chains. > It seems to me that the contextPath should also be passed through the normalize() method to remove the leading // > Regards > Mark -- This message was sent by Atlassian JIRA (v6.3.4#6332)