Skip to content

Commit

Permalink
Force to download xml and xsig files to prevent XSS attacks.
Browse files Browse the repository at this point in the history
------
Forzamos la descarga de archivos xml y xsig para evitar ataques XSS.
  • Loading branch information
NeoRazorX committed May 16, 2022
1 parent 7f3b156 commit f1ca50d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Core/App/AppRouter.php
Expand Up @@ -206,8 +206,10 @@ private function download(string $filePath)
ob_end_flush();
}

// force to download svg files to prevent XSS attacks
if (strpos($filePath, '.svg') !== false) {
// force to download svg, xml and xsig files to prevent XSS attacks
$info = pathinfo($filePath);
$extension = strtolower($info['extension']);
if (in_array($extension, ['svg', 'xml', 'xsig'])) {
header('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
}

Expand Down

0 comments on commit f1ca50d

Please sign in to comment.