From cc6f98c0fd4ac9e23a5fcb102f2f0e4eec5ea490 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 26 Sep 2020 16:29:26 -0700 Subject: [PATCH] Replace all instances of 255 as a max length with 191; ref #2421 --- app/Http/Requests/Admin/Egg/EggFormRequest.php | 6 +++--- app/Http/Requests/Admin/Egg/EggVariableFormRequest.php | 4 ++-- app/Http/Requests/Admin/Nest/StoreNestFormRequest.php | 2 +- app/Http/Requests/Admin/Node/AllocationFormRequest.php | 2 +- .../Admin/Settings/AdvancedSettingsFormRequest.php | 4 ++-- .../Admin/Settings/BaseSettingsFormRequest.php | 2 +- .../Admin/Settings/MailSettingsFormRequest.php | 6 +++--- .../Application/Allocations/StoreAllocationRequest.php | 2 +- .../Api/Client/Servers/Backups/StoreBackupRequest.php | 2 +- .../Client/Servers/Subusers/StoreSubuserRequest.php | 2 +- app/Models/DatabaseHost.php | 2 +- app/Models/Egg.php | 6 +++--- app/Models/EggVariable.php | 4 ++-- app/Models/Location.php | 2 +- app/Models/Mount.php | 2 +- app/Models/Nest.php | 2 +- app/Models/Schedule.php | 2 +- app/Models/Server.php | 4 ++-- app/Models/Setting.php | 2 +- app/Models/User.php | 10 +++++----- .../components/server/backups/CreateBackupButton.tsx | 2 +- .../components/server/users/EditSubuserModal.tsx | 5 ++++- resources/views/admin/locations/index.blade.php | 2 +- resources/views/admin/mounts/index.blade.php | 2 +- 24 files changed, 41 insertions(+), 38 deletions(-) diff --git a/app/Http/Requests/Admin/Egg/EggFormRequest.php b/app/Http/Requests/Admin/Egg/EggFormRequest.php index 6fe577cac..bda0e8c4d 100644 --- a/app/Http/Requests/Admin/Egg/EggFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggFormRequest.php @@ -19,12 +19,12 @@ class EggFormRequest extends AdminFormRequest public function rules() { $rules = [ - 'name' => 'required|string|max:255', + 'name' => 'required|string|max:191', 'description' => 'nullable|string', - 'docker_image' => 'required|string|max:255', + 'docker_image' => 'required|string|max:191', 'startup' => 'required|string', 'config_from' => 'sometimes|bail|nullable|numeric', - 'config_stop' => 'required_without:config_from|nullable|string|max:255', + 'config_stop' => 'required_without:config_from|nullable|string|max:191', 'config_startup' => 'required_without:config_from|nullable|json', 'config_logs' => 'required_without:config_from|nullable|json', 'config_files' => 'required_without:config_from|nullable|json', diff --git a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php index 933bf8348..d52fe94d2 100644 --- a/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php +++ b/app/Http/Requests/Admin/Egg/EggVariableFormRequest.php @@ -15,9 +15,9 @@ class EggVariableFormRequest extends AdminFormRequest public function rules() { return [ - 'name' => 'required|string|min:1|max:255', + 'name' => 'required|string|min:1|max:191', 'description' => 'sometimes|nullable|string', - 'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES, + 'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . EggVariable::RESERVED_ENV_NAMES, 'options' => 'sometimes|required|array', 'rules' => 'bail|required|string', 'default_value' => 'present', diff --git a/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php b/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php index 333723578..2f01dfe9e 100644 --- a/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php +++ b/app/Http/Requests/Admin/Nest/StoreNestFormRequest.php @@ -19,7 +19,7 @@ class StoreNestFormRequest extends AdminFormRequest public function rules() { return [ - 'name' => 'required|string|min:1|max:255', + 'name' => 'required|string|min:1|max:191', 'description' => 'string|nullable', ]; } diff --git a/app/Http/Requests/Admin/Node/AllocationFormRequest.php b/app/Http/Requests/Admin/Node/AllocationFormRequest.php index 777d3033f..3c580c026 100644 --- a/app/Http/Requests/Admin/Node/AllocationFormRequest.php +++ b/app/Http/Requests/Admin/Node/AllocationFormRequest.php @@ -20,7 +20,7 @@ class AllocationFormRequest extends AdminFormRequest { return [ 'allocation_ip' => 'required|string', - 'allocation_alias' => 'sometimes|nullable|string|max:255', + 'allocation_alias' => 'sometimes|nullable|string|max:191', 'allocation_ports' => 'required|array', ]; } diff --git a/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php index a80d8dab9..8568e5013 100644 --- a/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/AdvancedSettingsFormRequest.php @@ -15,8 +15,8 @@ class AdvancedSettingsFormRequest extends AdminFormRequest { return [ 'recaptcha:enabled' => 'required|in:true,false', - 'recaptcha:secret_key' => 'required|string|max:255', - 'recaptcha:website_key' => 'required|string|max:255', + 'recaptcha:secret_key' => 'required|string|max:191', + 'recaptcha:website_key' => 'required|string|max:191', 'pterodactyl:guzzle:timeout' => 'required|integer|between:1,60', 'pterodactyl:guzzle:connect_timeout' => 'required|integer|between:1,60', 'pterodactyl:console:count' => 'required|integer|min:1', diff --git a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php index 777761b67..208c15b10 100644 --- a/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php @@ -16,7 +16,7 @@ class BaseSettingsFormRequest extends AdminFormRequest public function rules() { return [ - 'app:name' => 'required|string|max:255', + 'app:name' => 'required|string|max:191', 'pterodactyl:auth:2fa_required' => 'required|integer|in:0,1,2', 'app:locale' => ['required', 'string', Rule::in(array_keys($this->getAvailableLanguages()))], 'app:analytics' => 'nullable|string', diff --git a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php index 92a23272f..728283af4 100644 --- a/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php +++ b/app/Http/Requests/Admin/Settings/MailSettingsFormRequest.php @@ -18,10 +18,10 @@ class MailSettingsFormRequest extends AdminFormRequest 'mail:host' => 'required|string', 'mail:port' => 'required|integer|between:1,65535', 'mail:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])], - 'mail:username' => 'nullable|string|max:255', - 'mail:password' => 'nullable|string|max:255', + 'mail:username' => 'nullable|string|max:191', + 'mail:password' => 'nullable|string|max:191', 'mail:from:address' => 'required|string|email', - 'mail:from:name' => 'nullable|string|max:255', + 'mail:from:name' => 'nullable|string|max:191', ]; } diff --git a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php index f795a114e..1e68b82e5 100644 --- a/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php +++ b/app/Http/Requests/Api/Application/Allocations/StoreAllocationRequest.php @@ -24,7 +24,7 @@ class StoreAllocationRequest extends ApplicationApiRequest { return [ 'ip' => 'required|string', - 'alias' => 'sometimes|nullable|string|max:255', + 'alias' => 'sometimes|nullable|string|max:191', 'ports' => 'required|array', 'ports.*' => 'string', ]; diff --git a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php index e6dd2ad43..4ca892155 100644 --- a/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Backups/StoreBackupRequest.php @@ -21,7 +21,7 @@ class StoreBackupRequest extends ClientApiRequest public function rules(): array { return [ - 'name' => 'nullable|string|max:255', + 'name' => 'nullable|string|max:191', 'ignored' => 'nullable|string', ]; } diff --git a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php index effc3bf3a..0848770f9 100644 --- a/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php +++ b/app/Http/Requests/Api/Client/Servers/Subusers/StoreSubuserRequest.php @@ -20,7 +20,7 @@ class StoreSubuserRequest extends SubuserRequest public function rules(): array { return [ - 'email' => 'required|email', + 'email' => 'required|email|between:1,191', 'permissions' => 'required|array', 'permissions.*' => 'string', ]; diff --git a/app/Models/DatabaseHost.php b/app/Models/DatabaseHost.php index 016702141..750ca0de9 100644 --- a/app/Models/DatabaseHost.php +++ b/app/Models/DatabaseHost.php @@ -50,7 +50,7 @@ class DatabaseHost extends Model * @var array */ public static $validationRules = [ - 'name' => 'required|string|max:255', + 'name' => 'required|string|max:191', 'host' => 'required|string', 'port' => 'required|numeric|between:1,65535', 'username' => 'required|string|max:32', diff --git a/app/Models/Egg.php b/app/Models/Egg.php index 143fe95a8..4aa33beff 100644 --- a/app/Models/Egg.php +++ b/app/Models/Egg.php @@ -93,13 +93,13 @@ class Egg extends Model public static $validationRules = [ 'nest_id' => 'required|bail|numeric|exists:nests,id', 'uuid' => 'required|string|size:36', - 'name' => 'required|string|max:255', + 'name' => 'required|string|max:191', 'description' => 'string|nullable', 'author' => 'required|string|email', - 'docker_image' => 'required|string|max:255', + 'docker_image' => 'required|string|max:191', 'startup' => 'required|nullable|string', 'config_from' => 'sometimes|bail|nullable|numeric|exists:eggs,id', - 'config_stop' => 'required_without:config_from|nullable|string|max:255', + 'config_stop' => 'required_without:config_from|nullable|string|max:191', 'config_startup' => 'required_without:config_from|nullable|json', 'config_logs' => 'required_without:config_from|nullable|json', 'config_files' => 'required_without:config_from|nullable|json', diff --git a/app/Models/EggVariable.php b/app/Models/EggVariable.php index c6cc45b56..2adc35134 100644 --- a/app/Models/EggVariable.php +++ b/app/Models/EggVariable.php @@ -73,9 +73,9 @@ class EggVariable extends Model */ public static $validationRules = [ 'egg_id' => 'exists:eggs,id', - 'name' => 'required|string|between:1,255', + 'name' => 'required|string|between:1,191', 'description' => 'string', - 'env_variable' => 'required|regex:/^[\w]{1,255}$/|notIn:' . self::RESERVED_ENV_NAMES, + 'env_variable' => 'required|regex:/^[\w]{1,191}$/|notIn:' . self::RESERVED_ENV_NAMES, 'default_value' => 'string', 'user_viewable' => 'boolean', 'user_editable' => 'boolean', diff --git a/app/Models/Location.php b/app/Models/Location.php index 17ba7e24a..74fed1812 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -41,7 +41,7 @@ class Location extends Model */ public static $validationRules = [ 'short' => 'required|string|between:1,60|unique:locations,short', - 'long' => 'string|nullable|between:1,255', + 'long' => 'string|nullable|between:1,191', ]; /** diff --git a/app/Models/Mount.php b/app/Models/Mount.php index 023243f93..b69c0c78d 100644 --- a/app/Models/Mount.php +++ b/app/Models/Mount.php @@ -56,7 +56,7 @@ class Mount extends Model */ public static $validationRules = [ 'name' => 'required|string|min:2|max:64|unique:mounts,name', - 'description' => 'nullable|string|max:255', + 'description' => 'nullable|string|max:191', 'source' => 'required|string', 'target' => 'required|string', 'read_only' => 'sometimes|boolean', diff --git a/app/Models/Nest.php b/app/Models/Nest.php index 5def1c833..770c5baf7 100644 --- a/app/Models/Nest.php +++ b/app/Models/Nest.php @@ -44,7 +44,7 @@ class Nest extends Model */ public static $validationRules = [ 'author' => 'required|string|email', - 'name' => 'required|string|max:255', + 'name' => 'required|string|max:191', 'description' => 'nullable|string', ]; diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index bc214f27d..d737edd2c 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -103,7 +103,7 @@ class Schedule extends Model */ public static $validationRules = [ 'server_id' => 'required|exists:servers,id', - 'name' => 'required|string|max:255', + 'name' => 'required|string|max:191', 'cron_day_of_week' => 'required|string', 'cron_day_of_month' => 'required|string', 'cron_hour' => 'required|string', diff --git a/app/Models/Server.php b/app/Models/Server.php index f6de3516c..13fcb931a 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -103,7 +103,7 @@ class Server extends Model public static $validationRules = [ 'external_id' => 'sometimes|nullable|string|between:1,191|unique:servers', 'owner_id' => 'required|integer|exists:users,id', - 'name' => 'required|string|min:1|max:255', + 'name' => 'required|string|min:1|max:191', 'node_id' => 'required|exists:nodes,id', 'description' => 'string', 'memory' => 'required|numeric|min:0', @@ -118,7 +118,7 @@ class Server extends Model 'egg_id' => 'required|exists:eggs,id', 'startup' => 'required|string', 'skip_scripts' => 'sometimes|boolean', - 'image' => 'required|string|max:255', + 'image' => 'required|string|max:191', 'installed' => 'in:0,1,2', 'database_limit' => 'present|nullable|integer|min:0', 'allocation_limit' => 'sometimes|nullable|integer|min:0', diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 1a91a578e..458248628 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -25,7 +25,7 @@ class Setting extends Model * @var array */ public static $validationRules = [ - 'key' => 'required|string|between:1,255', + 'key' => 'required|string|between:1,191', 'value' => 'string', ]; } diff --git a/app/Models/User.php b/app/Models/User.php index d2761bd72..24ef981f4 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -137,11 +137,11 @@ class User extends Model implements */ public static $validationRules = [ 'uuid' => 'required|string|size:36|unique:users,uuid', - 'email' => 'required|email|unique:users,email', - 'external_id' => 'sometimes|nullable|string|max:255|unique:users,external_id', - 'username' => 'required|between:1,255|unique:users,username', - 'name_first' => 'required|string|between:1,255', - 'name_last' => 'required|string|between:1,255', + 'email' => 'required|email|between:1,191|unique:users,email', + 'external_id' => 'sometimes|nullable|string|max:191|unique:users,external_id', + 'username' => 'required|between:1,191|unique:users,username', + 'name_first' => 'required|string|between:1,191', + 'name_last' => 'required|string|between:1,191', 'password' => 'sometimes|nullable|string', 'root_admin' => 'boolean', 'language' => 'string', diff --git a/resources/scripts/components/server/backups/CreateBackupButton.tsx b/resources/scripts/components/server/backups/CreateBackupButton.tsx index 9218b68ec..f6af35ca0 100644 --- a/resources/scripts/components/server/backups/CreateBackupButton.tsx +++ b/resources/scripts/components/server/backups/CreateBackupButton.tsx @@ -87,7 +87,7 @@ export default () => { onSubmit={submit} initialValues={{ name: '', ignored: '' }} validationSchema={object().shape({ - name: string().max(255), + name: string().max(191), ignored: string(), })} > diff --git a/resources/scripts/components/server/users/EditSubuserModal.tsx b/resources/scripts/components/server/users/EditSubuserModal.tsx index 482a6b86b..d81d15f08 100644 --- a/resources/scripts/components/server/users/EditSubuserModal.tsx +++ b/resources/scripts/components/server/users/EditSubuserModal.tsx @@ -250,7 +250,10 @@ export default ({ subuser, ...props }: Props) => { permissions: subuser?.permissions || [], } as Values} validationSchema={object().shape({ - email: string().email('A valid email address must be provided.').required('A valid email address must be provided.'), + email: string() + .max(191, 'Email addresses must not exceed 191 characters.') + .email('A valid email address must be provided.') + .required('A valid email address must be provided.'), permissions: array().of(string()), })} > diff --git a/resources/views/admin/locations/index.blade.php b/resources/views/admin/locations/index.blade.php index 53bd3cd71..3d5128db2 100644 --- a/resources/views/admin/locations/index.blade.php +++ b/resources/views/admin/locations/index.blade.php @@ -70,7 +70,7 @@
-

A longer description of this location. Must be less than 255 characters.

+

A longer description of this location. Must be less than 191 characters.

diff --git a/resources/views/admin/mounts/index.blade.php b/resources/views/admin/mounts/index.blade.php index da554cd04..309dc3c17 100644 --- a/resources/views/admin/mounts/index.blade.php +++ b/resources/views/admin/mounts/index.blade.php @@ -84,7 +84,7 @@
-

A longer description for this mount, must be less than 255 characters.

+

A longer description for this mount, must be less than 191 characters.