Skip to content
Permalink
Browse files

[JENKINS-40652] Minimal fix for trusted revision

  • Loading branch information
stephenc committed Jan 27, 2017
1 parent df02d73 commit 93d81cf26e8b46afdedf91c617c342b278257b4b
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
@@ -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
@@ -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",

0 comments on commit 93d81cf

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