fix: web-components-extractor escape shell arguments in find command

- Updated the find command in WebComponentsExtractor to use escapeshellarg for both base path and manifest name to prevent command injection vulnerabilities.
This commit is contained in:
Zack Spear
2025-03-27 15:17:41 -07:00
parent 14e0fed12a
commit 23861c1219

View File

@@ -13,7 +13,9 @@ class WebComponentsExtractor
private function findManifestFiles(string $manifestName): array
{
$basePath = '/usr/local/emhttp' . self::PREFIXED_PATH;
$command = "find {$basePath} -name {$manifestName}";
$escapedBasePath = escapeshellarg($basePath);
$escapedManifestName = escapeshellarg($manifestName);
$command = "find {$escapedBasePath} -name {$escapedManifestName}";
exec($command, $files);
return $files;
}