File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/main/java/com/cloudbees/jenkins/plugins/bitbucket Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,16 @@ public TrustTeamForks() {
301301 @ Override
302302 protected boolean checkTrusted (@ NonNull BitbucketSCMSourceRequest request , @ NonNull PullRequestSCMHead head )
303303 throws IOException , InterruptedException {
304- if (!head .getOrigin ().equals (SCMHeadOrigin .DEFAULT )) {
304+ SCMHeadOrigin origin = head .getOrigin ();
305+ if (!origin .equals (SCMHeadOrigin .DEFAULT )) {
306+ if (origin instanceof SCMHeadOrigin .Fork ) {
307+ String forkOwner = ((SCMHeadOrigin .Fork ) origin ).getName ();
308+ int index = forkOwner .lastIndexOf ('/' );
309+ if (index > 0 ) { //hasn't happened yet in my testing, so this might be wrong
310+ forkOwner = forkOwner .substring (0 , index );
311+ }
312+ return request .getRepoOwner ().equalsIgnoreCase (forkOwner );
313+ }
305314 return head .getRepoOwner ().equalsIgnoreCase (request .getRepoOwner ());
306315 }
307316 return false ;
You can’t perform that action at this time.
0 commit comments