From 901162c0335841d408b737e9275f798350c8da02 Mon Sep 17 00:00:00 2001 From: James Nord Date: Wed, 15 Nov 2023 12:04:47 +0000 Subject: [PATCH] Revert "Do not enforce GitHub app to comes from the same org as the repo org. The GH app can come from another org as log as it is installed in the org with the target git repo there is no security issue (#744)" This reverts commit 4c250951d4602ef4cc33dea61377834aa61fdccb. --- .../plugins/github_branch_source/GitHubAppCredentials.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java b/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java index 4eead6687..c4f45cf6b 100644 --- a/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java +++ b/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java @@ -326,6 +326,9 @@ public String getUsername() { @NonNull public synchronized GitHubAppCredentials withOwner(@NonNull String owner) { if (this.owner != null) { + if (!owner.equals(this.owner)) { + throw new IllegalArgumentException("Owner mismatch: " + this.owner + " vs. " + owner); + } return this; } if (byOwner == null) {