[ https://issues.apache.org/jira/browse/WW-3529?focusedWorklogId=818416&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-818416 ]
ASF GitHub Bot logged work on WW-3529: -------------------------------------- Author: ASF GitHub Bot Created on: 19/Oct/22 10:29 Start Date: 19/Oct/22 10:29 Worklog Time Spent: 10m Work Description: sonarcloud[bot] commented on PR #620: URL: https://github.com/apache/struts/pull/620#issuecomment-1283783418 Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_struts&pullRequest=620) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=620&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=620&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_struts&pullRequest=620&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_struts&pullRequest=620&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=620&metric=new_coverage&view=list) [94.9% Coverage](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=620&metric=new_coverage&view=list) [](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=620&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_struts&pullRequest=620&metric=new_duplicated_lines_density&view=list) Issue Time Tracking ------------------- Worklog Id: (was: 818416) Time Spent: 20m (was: 10m) > NamedVariablePatternMatcher does not properly escape characters > --------------------------------------------------------------- > > Key: WW-3529 > URL: https://issues.apache.org/jira/browse/WW-3529 > Project: Struts 2 > Issue Type: Bug > Components: Other > Affects Versions: 2.2.1 > Reporter: Richard Vermillion > Priority: Major > Fix For: 6.1.0 > > Attachments: NamedVariablePatternMatcher.patch > > Time Spent: 20m > Remaining Estimate: 0h > > The {{com.opensymphony.xwork2.util.NamedVariablePatternMatcher}} class has a > bug in the {{compilePattern(String)}} method. The purpose of the method is to > compile patterns such as {{"action/\{foo}"}} to a regular expression Pattern > and extract the variable names that match each group in the regex. In the > example given and the 2.2.1 code base, the pattern will be compiled as > {{{}"action/([^/]+)"{}}}. However, if the pattern includes characters that > have special meaning to Java's regular expression engine, they are currently > not being escaped. > For example, the pattern {{"action.\{format}"}} is being compiled to > {{"action.([^/]{+})"{+}}} which correctly matches {{"action.html"}} but also > {{"actionK.html"}} or any other character because the {{'.'}} is not escaped. > The bug really bites when a pattern like {{"\{name}.\{format}"}} is used. > This will be compiled to {{"([^/]).([^/]+)"}} which will match > {{"cars.html"}} but not the way you expect. Because of greediness, it will > set {{name = "cars.ht"}} and {{{}format = "l"{}}}. > I will submit a patch to fix this behavior on the next screen. -- This message was sent by Atlassian Jira (v8.20.10#820010)