fix(vikon): add file type validation and temp cleanup in UpdatePartAction
This commit is contained in:
@@ -87,13 +87,22 @@ class UpdatePartAction
|
|||||||
$zip->close();
|
$zip->close();
|
||||||
File::delete($zipFile);
|
File::delete($zipFile);
|
||||||
|
|
||||||
|
// Validate extracted file types
|
||||||
|
$blocked = $this->fs->validateFileTypes($tempPath);
|
||||||
|
if (!empty($blocked)) {
|
||||||
|
File::deleteDirectory($tempPath);
|
||||||
|
throw new \RuntimeException('Blocked files in ZIP: ' . implode(', ', $blocked));
|
||||||
|
}
|
||||||
|
|
||||||
$modulePath = $this->basePath . '/' . $config['path'];
|
$modulePath = $this->basePath . '/' . $config['path'];
|
||||||
|
|
||||||
// Step 5: Apply
|
try {
|
||||||
$syncedCount = $this->applyPart($part, $tempPath, $modulePath, $moduleId, $config);
|
// Step 5: Apply
|
||||||
|
$syncedCount = $this->applyPart($part, $tempPath, $modulePath, $moduleId, $config);
|
||||||
// Step 6: Clean temp
|
} finally {
|
||||||
File::deleteDirectory($tempPath);
|
// Step 6: Clean temp (always runs, even on exception)
|
||||||
|
File::deleteDirectory($tempPath);
|
||||||
|
}
|
||||||
|
|
||||||
Log::info('Vikon: part update complete', ['module' => $moduleId, 'part' => $part, 'synced' => $syncedCount]);
|
Log::info('Vikon: part update complete', ['module' => $moduleId, 'part' => $part, 'synced' => $syncedCount]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user