Prevent catastrophic boot failure in wings when a server egg has bad data; closes #3055

This commit is contained in:
Dane Everitt 2021-03-03 21:02:11 -08:00
parent 19279644df
commit 1943c7a98b
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -98,6 +98,16 @@ class EggConfigurationService
// Normalize the output of the configuration for the new Wings Daemon to more // Normalize the output of the configuration for the new Wings Daemon to more
// easily ingest, as well as make things more flexible down the road. // easily ingest, as well as make things more flexible down the road.
foreach ($configs as $file => $data) { foreach ($configs as $file => $data) {
// Try to head off any errors relating to parsing a set of configuration files
// or other JSON data for the egg. This should probably be blocked at the time
// of egg creation/update, but it isn't so this check will at least prevent a
// 500 error which would crash the entire Wings boot process.
//
// @see https://github.com/pterodactyl/panel/issues/3055
if (!is_object($data) || !isset($data->find)) {
continue;
}
$append = array_merge((array) $data, ['file' => $file, 'replace' => []]); $append = array_merge((array) $data, ['file' => $file, 'replace' => []]);
foreach ($this->iterate($data->find, $structure) as $find => $replace) { foreach ($this->iterate($data->find, $structure) as $find => $replace) {