Skip to content

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.

fix(api): encoding checks (#7944)

🏔️ Peak3ff2743e015b
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php
index 099b3d1242..60fd45ef45 100644
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@ -1044,7 +1044,7 @@ class ApplicationsController extends Controller
], 422);
}
$customNginxConfiguration = base64_decode($customNginxConfiguration);
- if (mb_detect_encoding($customNginxConfiguration, 'ASCII', true) === false) {
+ if (mb_detect_encoding($customNginxConfiguration, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1597,7 +1597,7 @@ class ApplicationsController extends Controller
], 422);
}
$dockerFile = base64_decode($request->dockerfile);
- if (mb_detect_encoding($dockerFile, 'ASCII', true) === false) {
+ if (mb_detect_encoding($dockerFile, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1813,7 +1813,7 @@ class ApplicationsController extends Controller
], 422);
}
$dockerComposeRaw = base64_decode($request->docker_compose_raw);
- if (mb_detect_encoding($dockerComposeRaw, 'ASCII', true) === false) {
+ if (mb_detect_encoding($dockerComposeRaw, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -2346,7 +2346,7 @@ class ApplicationsController extends Controller
], 422);
}
$customNginxConfiguration = base64_decode($request->custom_nginx_configuration);
- if (mb_detect_encoding($customNginxConfiguration, 'ASCII', true) === false) {
+ if (mb_detect_encoding($customNginxConfiguration, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -3615,7 +3615,7 @@ class ApplicationsController extends Controller
], 422);
}
$customLabels = base64_decode($request->custom_labels);
- if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
+ if (mb_detect_encoding($customLabels, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
diff --git a/app/Http/Controllers/Api/DatabasesController.php b/app/Http/Controllers/Api/DatabasesController.php
index c8e68b1e67..15d182db29 100644
--- a/app/Http/Controllers/Api/DatabasesController.php
+++ b/app/Http/Controllers/Api/DatabasesController.php
@@ -389,7 +389,7 @@ class DatabasesController extends Controller
], 422);
}
$postgresConf = base64_decode($request->postgres_conf);
- if (mb_detect_encoding($postgresConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($postgresConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -429,7 +429,7 @@ class DatabasesController extends Controller
], 422);
}
$redisConf = base64_decode($request->redis_conf);
- if (mb_detect_encoding($redisConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($redisConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -456,7 +456,7 @@ class DatabasesController extends Controller
], 422);
}
$keydbConf = base64_decode($request->keydb_conf);
- if (mb_detect_encoding($keydbConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($keydbConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -486,7 +486,7 @@ class DatabasesController extends Controller
], 422);
}
$mariadbConf = base64_decode($request->mariadb_conf);
- if (mb_detect_encoding($mariadbConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mariadbConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -515,7 +515,7 @@ class DatabasesController extends Controller
], 422);
}
$mongoConf = base64_decode($request->mongo_conf);
- if (mb_detect_encoding($mongoConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mongoConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -546,7 +546,7 @@ class DatabasesController extends Controller
], 422);
}
$mysqlConf = base64_decode($request->mysql_conf);
- if (mb_detect_encoding($mysqlConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mysqlConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1701,7 +1701,7 @@ class DatabasesController extends Controller
], 422);
}
$postgresConf = base64_decode($request->postgres_conf);
- if (mb_detect_encoding($postgresConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($postgresConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1756,7 +1756,7 @@ class DatabasesController extends Controller
], 422);
}
$mariadbConf = base64_decode($request->mariadb_conf);
- if (mb_detect_encoding($mariadbConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mariadbConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1815,7 +1815,7 @@ class DatabasesController extends Controller
], 422);
}
$mysqlConf = base64_decode($request->mysql_conf);
- if (mb_detect_encoding($mysqlConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mysqlConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1871,7 +1871,7 @@ class DatabasesController extends Controller
], 422);
}
$redisConf = base64_decode($request->redis_conf);
- if (mb_detect_encoding($redisConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($redisConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -1957,7 +1957,7 @@ class DatabasesController extends Controller
], 422);
}
$keydbConf = base64_decode($request->keydb_conf);
- if (mb_detect_encoding($keydbConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($keydbConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -2051,7 +2051,7 @@ class DatabasesController extends Controller
], 422);
}
$mongoConf = base64_decode($request->mongo_conf);
- if (mb_detect_encoding($mongoConf, 'ASCII', true) === false) {
+ if (mb_detect_encoding($mongoConf, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.php
index 4025898b9b..b61c7417b5 100644
--- a/app/Http/Controllers/Api/ServicesController.php
+++ b/app/Http/Controllers/Api/ServicesController.php
@@ -385,7 +385,7 @@ class ServicesController extends Controller
], 422);
}
$dockerComposeRaw = base64_decode($request->docker_compose_raw);
- if (mb_detect_encoding($dockerComposeRaw, 'ASCII', true) === false) {
+ if (mb_detect_encoding($dockerComposeRaw, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [
@@ -715,7 +715,7 @@ class ServicesController extends Controller
], 422);
}
$dockerComposeRaw = base64_decode($request->docker_compose_raw);
- if (mb_detect_encoding($dockerComposeRaw, 'ASCII', true) === false) {
+ if (mb_detect_encoding($dockerComposeRaw, 'UTF-8', true) === false) {
return response()->json([
'message' => 'Validation failed.',
'errors' => [