Skip to content

Commit

Permalink
Merge pull request #114 from stephenc/jenkins-40652
Browse files Browse the repository at this point in the history
[JENKINS-40652] Minimal fix for trusted revision
  • Loading branch information
stephenc committed Jan 27, 2017
2 parents df02d73 + 93d81cf commit 5607e40
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -984,6 +984,11 @@ private void checkout(GitSCM scm, Run<?,?> build, GitClient git, TaskListener li
public SCMRevision getTrustedRevision(SCMRevision revision, TaskListener listener)
throws IOException, InterruptedException {
if (revision instanceof PullRequestSCMRevision) {
PullRequestSCMHead head = (PullRequestSCMHead) revision.getHead();
if (repoOwner.equals(head.getSourceRepo()) && repository.equals(head.getSourceRepo())) {
// origin PR
return revision;
}
/*
* Evaluates whether this pull request is coming from a trusted source.
* Quickest is to check whether the author of the PR
Expand Down Expand Up @@ -1050,7 +1055,6 @@ public SCMRevision getTrustedRevision(SCMRevision revision, TaskListener listene
}
}
}
PullRequestSCMHead head = (PullRequestSCMHead) revision.getHead();
if (!collaboratorNames.contains(head.getSourceOwner())) {
PullRequestSCMRevision rev = (PullRequestSCMRevision) revision;
listener.getLogger().format("Loading trusted files from base branch %s at %s rather than %s%n",
Expand Down

0 comments on commit 5607e40

Please sign in to comment.