An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(api): add volume name validation to storage API endpoints
Andras Bacsaif9a9dc80aa85
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.phpindex b081069b77..ad1f50ea29 100644--- a/app/Http/Controllers/Api/ApplicationsController.php+++ b/app/Http/Controllers/Api/ApplicationsController.php@@ -20,6 +20,7 @@ use App\Models\Service;use App\Rules\ValidGitBranch;use App\Rules\ValidGitRepositoryUrl;use App\Services\DockerImageParser;+use App\Support\ValidationPatterns;use Illuminate\Http\JsonResponse;use Illuminate\Http\Request;use Illuminate\Support\Facades\Http;@@ -4096,7 +4097,7 @@ class ApplicationsController extends Controller'id' => 'integer','type' => 'required|string|in:persistent,file','is_preview_suffix_enabled' => 'boolean',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'string','host_path' => 'string|nullable','content' => 'string|nullable',@@ -4274,7 +4275,7 @@ class ApplicationsController extends Controller$validator = customApiValidator($request->all(), ['type' => 'required|string|in:persistent,file',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'required|string','host_path' => 'string|nullable','content' => 'string|nullable',diff --git a/app/Http/Controllers/Api/DatabasesController.php b/app/Http/Controllers/Api/DatabasesController.phpindex f9e171eee9..660ed4529a 100644--- a/app/Http/Controllers/Api/DatabasesController.php+++ b/app/Http/Controllers/Api/DatabasesController.php@@ -19,6 +19,7 @@ use App\Models\S3Storage;use App\Models\ScheduledDatabaseBackup;use App\Models\Server;use App\Models\StandalonePostgresql;+use App\Support\ValidationPatterns;use Illuminate\Http\JsonResponse;use Illuminate\Http\Request;use Illuminate\Support\Facades\DB;@@ -3467,7 +3468,7 @@ class DatabasesController extends Controller$validator = customApiValidator($request->all(), ['type' => 'required|string|in:persistent,file',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'required|string','host_path' => 'string|nullable','content' => 'string|nullable',@@ -3665,7 +3666,7 @@ class DatabasesController extends Controller'id' => 'integer','type' => 'required|string|in:persistent,file','is_preview_suffix_enabled' => 'boolean',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'string','host_path' => 'string|nullable','content' => 'string|nullable',diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.phpindex 89635875c8..fbf4b9e56f 100644--- a/app/Http/Controllers/Api/ServicesController.php+++ b/app/Http/Controllers/Api/ServicesController.php@@ -13,6 +13,7 @@ use App\Models\LocalPersistentVolume;use App\Models\Project;use App\Models\Server;use App\Models\Service;+use App\Support\ValidationPatterns;use Illuminate\Http\JsonResponse;use Illuminate\Http\Request;use Illuminate\Support\Facades\Validator;@@ -2015,7 +2016,7 @@ class ServicesController extends Controller$validator = customApiValidator($request->all(), ['type' => 'required|string|in:persistent,file','resource_uuid' => 'required|string',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'required|string','host_path' => 'string|nullable','content' => 'string|nullable',@@ -2224,7 +2225,7 @@ class ServicesController extends Controller'id' => 'integer','type' => 'required|string|in:persistent,file','is_preview_suffix_enabled' => 'boolean',- 'name' => 'string',+ 'name' => ['string', 'regex:'.ValidationPatterns::VOLUME_NAME_PATTERN],'mount_path' => 'string','host_path' => 'string|nullable','content' => 'string|nullable',