fix(sources): restrict system-wide Git sources to instance admins (#12164)

This commit is contained in:
Andras Bacsai
2026-10-14 14:07:54 +02:00
committed by GitHub
parent d080bf35e6
commit 23a22e7970
15 changed files with 385 additions and 10 deletions
@@ -247,6 +247,10 @@ class GithubController extends Controller
], 422);
}
if (! isCloud() && $request->boolean('is_system_wide')) {
$this->authorize('makeSystemWide', GithubApp::class);
}
try {
// Verify the private key belongs to the team
$privateKey = PrivateKey::where('uuid', $request->input('private_key_uuid'))
@@ -663,6 +667,10 @@ class GithubController extends Controller
$payload['api_url'] = githubApiUrlFromHtmlUrl($payload['html_url']);
}
if (! isCloud() && filter_var($payload['is_system_wide'] ?? false, FILTER_VALIDATE_BOOLEAN) && ! $githubApp->is_system_wide) {
$this->authorize('makeSystemWide', GithubApp::class);
}
// Handle private_key_uuid -> private_key_id conversion
if (isset($payload['private_key_uuid'])) {
$privateKey = PrivateKey::where('team_id', $teamId)