Files
coolify/tests/Unit/GitlabOAuthRedactionTest.php
Mike ChongandAndras Bacsai a26091de0a feat: self-hosted GitLab Apps OAuth integration
Adds self-hosted GitLab OAuth sources so Coolify can connect to a self-managed GitLab instance, list private repositories, clone over an OAuth token, and deploy (the GitLab counterpart to GitHub Apps).

Hardening: authenticated, one-time team-bound OAuth callback state; token redaction in deploy logs; custom host port/path kept in clone and ls-remote URLs; submodule OAuth auth; system-wide source selection. Covered by unit and feature tests.

cosigned by OpenAI Codex at M1 Max
2026-07-20 23:21:40 +02:00

28 lines
944 B
PHP

<?php
it('redacts oauth2 tokens from deployment logs', function () {
$fakeOAuthToken = str_repeat('a', 30); // ggignore
$text = "git clone https://oauth2:{$fakeOAuthToken}@gitlab.example.com/group/repo.git /app";
$result = remove_iip($text);
expect($result)->not->toContain($fakeOAuthToken);
expect($result)->toContain('oauth2:');
});
it('redacts x-access-token from logs', function () {
$fakeToken = str_repeat('x', 40); // ggignore
$text = "git clone https://x-access-token:{$fakeToken}@github.com/org/repo.git /app";
$result = remove_iip($text);
expect($result)->not->toContain($fakeToken);
expect($result)->toContain('x-access-token:');
});
it('redacts gitlab personal access tokens', function () {
$fakeToken = 'glpat-'.str_repeat('y', 20); // ggignore
$text = "Authorization: Bearer {$fakeToken}";
$result = remove_iip($text);
expect($result)->not->toContain($fakeToken);
});