Skip to content
Permalink
Browse files

[FiXED JENKINS-27055] <BUILDID> should now also match numeric build IDs.

  • Loading branch information
jglick committed Mar 24, 2015
1 parent 9ac2257 commit 20c458d9933b5d25fc472f84ba8dbbf4eae5edee
@@ -40,7 +40,7 @@ protected FilePathRule parse(String line) {
if (line.isEmpty()) return null;

line = line.replace("<BUILDDIR>","<JOBDIR>/builds/<BUILDID>");
line = line.replace("<BUILDID>","[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9]");
line = line.replace("<BUILDID>","(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9]|[0-9]+)");
line = line.replace("<JOBDIR>","<JENKINS_HOME>/jobs/.+");
line = line.replace("<JENKINS_HOME>","\\Q"+Jenkins.getInstance().getRootDir().getPath()+"\\E");

@@ -33,7 +33,6 @@

import jenkins.security.s2m.AdminWhitelistRule;
import jenkins.security.s2m.DefaultFilePathFilter;
import jenkins.security.s2m.MasterKillSwitchConfiguration;
import org.jenkinsci.remoting.RoleChecker;
import org.junit.Before;
import org.junit.Test;
@@ -42,6 +41,7 @@
import org.jvnet.hudson.test.JenkinsRule;

import javax.inject.Inject;
import org.jvnet.hudson.test.Issue;

public class DefaultFilePathFilterTest {

@@ -111,4 +111,12 @@ public void checkRoles(RoleChecker checker) throws SecurityException {
throw new NoSuchMethodError(); // simulate legacy Callable impls
}
}

@Issue("JENKINS-27055")
@Test public void matchBuildDir() throws Exception {
File f = new File(r.buildAndAssertSuccess(r.createFreeStyleProject()).getRootDir(), "whatever");
rule.setMasterKillSwitch(false);
assertTrue(rule.checkFileAccess("write", f));
}

}

0 comments on commit 20c458d

Please sign in to comment.
You can’t perform that action at this time.