[JIRA] (JENKINS-57464) Edge case in AdminFilePathFilterTest

3 views
Skip to first unread message

wfollonier@cloudbees.com (JIRA)

unread,
May 14, 2019, 11:34:02 AM5/14/19
to jenkinsc...@googlegroups.com
Wadeck Follonier created an issue
 
Jenkins / Bug JENKINS-57464
Edge case in AdminFilePathFilterTest
Issue Type: Bug Bug
Assignee: Unassigned
Components: core
Created: 2019-05-14 15:33
Environment: Windows
Priority: Minor Minor
Reporter: Wadeck Follonier

When running under Windows (to trigger this code), and when you are unlucky enough to have a rootPath starting with E, the regex will contains two
E
, where only one is expected to close the
Q
for the quoting. This is visible in every tests from jenkins.security.s2m.AdminFilePathFilterTest.

Stacktrace:

Invalid filter rule line: deny all \QC:\Jenkins\workspace\ENKINS-56575_rest_client_restart\test\target\j h499499801099785285\E\\secrets($|\\.*)
java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 67
\QC:\Jenkins\workspace\ENKINS-56575_rest_client_restart\test\target\j h499499801099785285\E\\secrets($|\\.*)
                                                                   ^
 at java.util.regex.Pattern.error(Pattern.java:1957)
 at java.util.regex.Pattern.escape(Pattern.java:2473)
 at java.util.regex.Pattern.atom(Pattern.java:2200)
 at java.util.regex.Pattern.sequence(Pattern.java:2132)
 at java.util.regex.Pattern.expr(Pattern.java:1998)
 at java.util.regex.Pattern.compile(Pattern.java:1698)
 at java.util.regex.Pattern.<init>(Pattern.java:1351)
 at java.util.regex.Pattern.compile(Pattern.java:1028)
 at jenkins.security.s2m.FilePathRuleConfig.parse(FilePathRuleConfig.java:57)
 at jenkins.security.s2m.FilePathRuleConfig.parse(FilePathRuleConfig.java:22)
 at jenkins.security.s2m.ConfigDirectory.load(ConfigDirectory.java:50)
 at jenkins.security.s2m.ConfigFile.get(ConfigFile.java:111)
 at jenkins.security.s2m.FilePathRuleConfig.checkFileAccess(FilePathRuleConfig.java:81)
 at jenkins.security.s2m.AdminWhitelistRule.checkFileAccess(AdminWhitelistRule.java:158)
 at jenkins.security.s2m.AdminFilePathFilterTest.matchBuildDir(AdminFilePathFilterTest.java:63)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
 at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:554)
 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
 at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 at java.lang.Thread.run(Thread.java:748)
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

wfollonier@cloudbees.com (JIRA)

unread,
May 14, 2019, 11:35:02 AM5/14/19
to jenkinsc...@googlegroups.com
Wadeck Follonier updated an issue
Change By: Wadeck Follonier
When running under Windows (to trigger [this code|https://github.com/jenkinsci/jenkins/blob/264980c707c6cafc01369378b1e90d247561df78/core/src/main/java/jenkins/security/s2m/FilePathRuleConfig.java#L49]), and when you are unlucky enough to have a rootPath starting with {{E}}, the [regex|https://github.com/jenkinsci/jenkins/blob/264980c707c6cafc01369378b1e90d247561df78/core/src/main/java/jenkins/security/s2m/FilePathRuleConfig.java#L45] will contains two {{\\E}}, where only one is expected to close the {{\\Q}} for the quoting. This is visible in every tests from {{jenkins.security.s2m.AdminFilePathFilterTest}}.

This occured in https://github.com/jenkinsci/jenkins/pull/3972.

Stacktrace:
{code:java}
{code}
Reply all
Reply to author
Forward
0 new messages