mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 00:16:42 +00:00
fix(security): enforce GitLab App authorization parity with GitHub
GitlabAppPolicy previously allowed any authenticated user to update, delete, and create GitLab sources. Align it with GithubAppPolicy, require Application create authorization on the private-repo wizard, and reject OAuth callbacks from non-admins so members cannot escalate privileges.
This commit is contained in:
1 parent
a26091de0a
commit
6f557cf17f
6 files changed
+326
-6
No files matched your search
@@ -105,4 +105,25 @@ describe('GitLab OAuth callback state validation', function () {
|
||||
|
||||
$response->assertRedirect(route('login'));
|
||||
});
|
||||
|
||||
test('rejects a callback from a team member who cannot administer the source', function () {
|
||||
Http::fake();
|
||||
|
||||
$member = User::factory()->create();
|
||||
$this->team->members()->attach($member->id, ['role' => 'member']);
|
||||
$this->actingAs($member);
|
||||
session(['currentTeam' => $this->team]);
|
||||
|
||||
$state = 'member-state';
|
||||
Cache::put(GitlabSource::oauthStateCacheKey($state), [
|
||||
'gitlab_app_id' => $this->gitlabApp->id,
|
||||
'team_id' => $this->team->id,
|
||||
], now()->addMinutes(60));
|
||||
|
||||
$response = $this->get('/webhooks/source/gitlab/redirect?code=any&state='.$state);
|
||||
|
||||
$response->assertRedirect(route('source.all'));
|
||||
Http::assertNothingSent();
|
||||
expect($this->gitlabApp->refresh()->access_token)->toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user