mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 18:18:29 +00:00
fix(applications): harden image validation
This commit is contained in:
1 parent
4d0be415c8
commit
d72c1e2a47
10 files changed
+392
-35
No files matched your search
@@ -157,8 +157,8 @@ class General extends Component
|
||||
'portsMappings' => ValidationPatterns::portMappingRules(),
|
||||
'customNetworkAliases' => 'nullable',
|
||||
'dockerfile' => 'nullable',
|
||||
'dockerRegistryImageName' => 'nullable',
|
||||
'dockerRegistryImageTag' => 'nullable',
|
||||
'dockerRegistryImageName' => ValidationPatterns::dockerImageNameRules(),
|
||||
'dockerRegistryImageTag' => ValidationPatterns::dockerImageTagRules(),
|
||||
'dockerfileLocation' => ValidationPatterns::filePathRules(),
|
||||
'dockerComposeLocation' => ValidationPatterns::filePathRules(),
|
||||
'dockerCompose' => 'nullable',
|
||||
@@ -848,7 +848,7 @@ class General extends Component
|
||||
}
|
||||
if ($this->buildPack === 'dockerimage') {
|
||||
$this->validate([
|
||||
'dockerRegistryImageName' => 'required',
|
||||
'dockerRegistryImageName' => ValidationPatterns::dockerImageNameRules(required: true),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Livewire\Project\New;
|
||||
use App\Models\Application;
|
||||
use App\Models\Project;
|
||||
use App\Services\DockerImageParser;
|
||||
use App\Support\ValidationPatterns;
|
||||
use Livewire\Component;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
@@ -81,8 +82,8 @@ class DockerImage extends Component
|
||||
public function submit()
|
||||
{
|
||||
$this->validate([
|
||||
'imageName' => ['required', 'string'],
|
||||
'imageTag' => ['nullable', 'string', 'regex:/^[a-z0-9][a-z0-9._-]*$/i'],
|
||||
'imageName' => ValidationPatterns::dockerImageNameRules(required: true),
|
||||
'imageTag' => ValidationPatterns::dockerImageTagRules(),
|
||||
'imageSha256' => ['nullable', 'string', 'regex:/^[a-f0-9]{64}$/i'],
|
||||
]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user