Skip to content

Commit

Permalink
[SECURITY-3300]
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell authored and car-roll committed Feb 28, 2024
1 parent e4f044c commit 6aa2a23
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,16 @@ public TrustTeamForks() {
@Override
protected boolean checkTrusted(@NonNull BitbucketSCMSourceRequest request, @NonNull PullRequestSCMHead head)
throws IOException, InterruptedException {
if (!head.getOrigin().equals(SCMHeadOrigin.DEFAULT)) {
SCMHeadOrigin origin = head.getOrigin();
if (!origin.equals(SCMHeadOrigin.DEFAULT)) {
if(origin instanceof SCMHeadOrigin.Fork) {
String forkOwner = ((SCMHeadOrigin.Fork) origin).getName();
int index = forkOwner.lastIndexOf('/');
if (index > 0) { //hasn't happened yet in my testing, so this might be wrong
forkOwner = forkOwner.substring(0, index);
}
return request.getRepoOwner().equalsIgnoreCase(forkOwner);
}
return head.getRepoOwner().equalsIgnoreCase(request.getRepoOwner());
}
return false;
Expand Down

0 comments on commit 6aa2a23

Please sign in to comment.