fix(vikon): exclude non-writable dirs from access check (vendor, build, vikon_core)
This commit is contained in:
@@ -57,9 +57,18 @@ class CheckAccessAction
|
||||
private function findNonWritable(string $path, int $depth = 0): array
|
||||
{
|
||||
if ($depth > 3 || !is_dir($path)) return [];
|
||||
if (!is_writable($path)) {
|
||||
return [str_replace(base_path() . '/', '', $path)];
|
||||
|
||||
$relative = str_replace(base_path() . '/', '', $path);
|
||||
|
||||
$excluded = ['vendor', 'node_modules', 'storage', '.git', 'bootstrap/cache'];
|
||||
foreach ($excluded as $ex) {
|
||||
if (str_starts_with($relative, $ex)) return [];
|
||||
}
|
||||
|
||||
if (!is_writable($path)) {
|
||||
return [$relative];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
foreach (File::directories($path) as $dir) {
|
||||
$result = array_merge($result, $this->findNonWritable($dir, $depth + 1));
|
||||
|
||||
Reference in New Issue
Block a user