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:
Andras Bacsai
2026-07-20 23:21:40 +02:00
parent a26091de0a
commit 6f557cf17f
6 changed files with 326 additions and 6 deletions
@@ -7,11 +7,14 @@ use App\Models\GitlabApp;
use App\Models\Project;
use App\Rules\ValidGitBranch;
use App\Support\ValidationPatterns;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class GitlabPrivateRepository extends Component
{
use AuthorizesRequests;
public $current_step = 'gitlab_apps';
public $gitlab_apps;
@@ -158,6 +161,8 @@ class GitlabPrivateRepository extends Component
public function submit()
{
try {
$this->authorize('create', Application::class);
$validator = validator([
'selected_repository_path' => $this->selected_repository_path,
'selected_branch_name' => $this->selected_branch_name,