fix(vikon): switch validateFileTypes from blacklist to whitelist

Based on actual file analysis of sveden/abitur/vsoko modules:
- html, css, js, map (content + assets)
- png, jpg, gif, svg, ico, bmp (images)
- ttf, woff, woff2, eot (fonts)
- pdf, doc, docx (documents)
- vikon (module-specific)

No PHP/ASP/executables in allowed list — any non-whitelisted file is blocked.
This commit is contained in:
F4ilji
2026-07-04 13:21:54 +05:00
parent f4f8bc8e77
commit ba99b2a093
@@ -66,17 +66,22 @@ class FilesystemTask
public function validateFileTypes(string $directory): array
{
$blocked = [
'php', 'php3', 'php4', 'php5', 'php7', 'php8', 'phtml', 'phps',
'asp', 'aspx', 'jsp', 'jspx', 'cfm',
'pl', 'py', 'rb', 'cgi', 'sh', 'bash', 'bat', 'cmd', 'exe',
'ps1', 'htaccess', 'htpasswd',
$allowed = [
'html', 'htm',
'css', 'js', 'map',
'json', 'xml', 'txt',
'png', 'jpg', 'jpeg', 'gif', 'svg', 'svgz', 'webp', 'ico', 'bmp',
'ttf', 'woff', 'woff2', 'eot', 'otf',
'pdf', 'doc', 'docx', 'xls', 'xlsx',
'zip',
'vikon',
];
$found = [];
foreach (File::allFiles($directory) as $file) {
$ext = strtolower($file->getExtension());
if (in_array($ext, $blocked, true)) {
if (!in_array($ext, $allowed, true)) {
$found[] = str_replace(base_path() . '/', '', $file->getPathname());
}
}