Skip to content

Commit

Permalink
[Settings] Validate SVG uploads for branding
Browse files Browse the repository at this point in the history
  • Loading branch information
brusch committed Jan 17, 2022
1 parent d8377fc commit 35d1853
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bundles/AdminBundle/Controller/Admin/SettingsController.php
Expand Up @@ -109,6 +109,12 @@ public function uploadCustomLogoAction(Request $request)
throw new \Exception('Unsupported file format');
}

if($fileExt === 'svg') {
if(strpos(file_get_contents($_FILES['Filedata']['tmp_name']), '<script')) {
throw new \Exception('Scripts in SVG files are not supported');
}
}

$storage = Tool\Storage::get('admin');
$storage->writeStream(self::CUSTOM_LOGO_PATH, fopen($_FILES['Filedata']['tmp_name'], 'rb'));

Expand Down

0 comments on commit 35d1853

Please sign in to comment.