panel icon indicating copy to clipboard operation
panel copied to clipboard

Variable validation: Using ';;' syntax to support regex validation containing pipes '|' will lead to validation errors

Open aurasalexander opened this issue 1 year ago • 0 comments

Current Behavior

Defining an egg variable with an input rule required;;string;;regex:/^(latest|\d{1,4}\.\d{1,4}\.\d{1,4})$/ (to allow for "latest" OR versions like "1.0.0") will lead to an error 500 upon giving that field a value and saving it in server admin startup tab.

Expected Behavior

Field should save successfully or display a validation error, depending on the given input value.

Steps to Reproduce

  • Create or edit an egg
  • Create or edit a variable in that egg
  • Give required;;string;;regex:/^(latest|\d{1,4}\.\d{1,4}\.\d{1,4})$/ or similar as input rule
  • Create a new server instance from that egg or navigate to a server instance that uses the egg in admin panel
  • Navigate to the startup tab
  • Locate the variable with the test input rule and enter a value, press enter to trigger a save

Relevant:

  • https://github.com/pterodactyl/panel/commit/49dee28eb8a15b2e072cfbea3a86d2e7d84f0522
  • https://github.com/pterodactyl/panel/issues/1960

Panel Version

1.10.1

Wings Version

1.7.0

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

[2022-09-04 12:50:58] production.ERROR: Method Illuminate\Validation\Validator::validateRequired;;string;;regex does not exist. {"userId":1,"exception":"[object] (BadMethodCallException(code: 0): Method Illuminate\\Validation\\Validator::validateRequired;;string;;regex does not exist. at /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:1532)
[stacktrace]
#0 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(610): Illuminate\\Validation\\Validator->__call()
#1 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(416): Illuminate\\Validation\\Validator->validateAttribute()
#2 /var/www/pterodactyl/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(447): Illuminate\\Validation\\Validator->passes()
#3 /var/www/pterodactyl/app/Services/Servers/VariableValidatorService.php(61): Illuminate\\Validation\\Validator->fails()
#4 /var/www/pterodactyl/app/Services/Servers/StartupModificationService.php(51): Pterodactyl\\Services\\Servers\\VariableValidatorService->handle()


### Is there an existing issue for this?

- [X] I have searched the existing issues before opening this issue.
- [X] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
- [X] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.

aurasalexander avatar Sep 04 '22 11:09 aurasalexander