mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 10:18:20 +00:00
fix(security): validate application domains safely
Use shared domain validation and normalization for application, service, and preview domains so unsafe host input is rejected consistently. Cover command-substitution payloads in application domain tests.
This commit is contained in:
1 parent
cc4f666ba2
commit
c6c7ec1c31
6 files changed
+72
-38
No files matched your search
@@ -2,6 +2,40 @@
|
||||
|
||||
use App\Livewire\Project\Application\General;
|
||||
|
||||
it('uses safe domain validation rules in the application general form', function () {
|
||||
$component = new General;
|
||||
$method = new ReflectionMethod($component, 'rules');
|
||||
$rules = $method->invoke($component);
|
||||
|
||||
$validator = validator([
|
||||
'fqdn' => 'http://$(whoami).example.com',
|
||||
], [
|
||||
'fqdn' => $rules['fqdn'],
|
||||
]);
|
||||
|
||||
expect($validator->fails())->toBeTrue()
|
||||
->and($validator->errors()->has('fqdn'))->toBeTrue();
|
||||
});
|
||||
|
||||
it('uses safe docker compose service domain validation rules in the application general form', function () {
|
||||
$component = new General;
|
||||
$method = new ReflectionMethod($component, 'rules');
|
||||
$rules = $method->invoke($component);
|
||||
|
||||
$validator = validator([
|
||||
'parsedServiceDomains' => [
|
||||
'app' => [
|
||||
'domain' => 'http://$(whoami).example.com',
|
||||
],
|
||||
],
|
||||
], [
|
||||
'parsedServiceDomains.*.domain' => $rules['parsedServiceDomains.*.domain'],
|
||||
]);
|
||||
|
||||
expect($validator->fails())->toBeTrue()
|
||||
->and($validator->errors()->has('parsedServiceDomains.app.domain'))->toBeTrue();
|
||||
});
|
||||
|
||||
it('uses safe docker registry image validation rules in the application general form', function () {
|
||||
$component = new General;
|
||||
$method = new ReflectionMethod($component, 'rules');
|
||||
|
||||
Reference in new issue
Block a user