feat: Option „Ganzes System (ab /)“

- Neue Einstellung zeigt zusätzlich zu /mnt/user das Dateisystem ab /
  (Bestätigungsdialog beim Aktivieren, U_NAV_ROOTS hat Vorrang).
- Geschützt vor Löschen/Verschieben/Rechteänderung: Wurzeln, Ordner
  direkt unter /, Mountpunkte unter /mnt.
- /proc, /sys, /dev, /run: nur anzeigen; keine Jobs, Downloads,
  Vorschau oder Rekursion hinein.
- Größe von Systemordnern nur auf Knopfdruck (weckt sonst alle Disks).
- Pfade unter / ohne doppelten Schrägstrich; kaputte Symlinks erzeugen
  keine PHP-Warnungen mehr in der Antwort.
- Paket 2026.11.21.r005.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikei386andClaude Opus 5.5 committed 2026-11-21 13:33:28 +01:00
1 parent a7e8325853
commit 0592a02c8e
17 files changed
+196 -43

No files matched your search

+24 -1
View File
@@ -20,7 +20,7 @@ file_put_contents($mnt . '/cache/media/movies/b.mkv', 'y');
file_put_contents($outside . '/secret.txt', 'secret');
$env = [
'U_NAV_ROOTS' => $user,
'U_NAV_DEFAULT_ROOT' => $user,
'U_NAV_READ_ONLY' => '0',
'U_NAV_SETTINGS_FILE' => $base . '/settings.json',
'U_NAV_JOB_DIR' => $base . '/jobs',
@@ -179,6 +179,21 @@ check('raw svg is sandboxed', (bool)preg_grep('/^Content-Security-Policy: sandbo
$r = call('POST', 'config.php', ['favorites' => json_encode([$share, $outside, $share . '/missing'])]);
check('favorites keep only folders inside roots', ($r['json']['favorites'] ?? null) === [$share], json_encode($r['json']['favorites'] ?? null));
// whole system root (opt-in)
$r = call('GET', 'list.php?path=/');
check('system root is hidden by default', $r['status'] === 403);
$r = call('POST', 'config.php', ['systemRoot' => '1']);
check('system root can be enabled', ($r['json']['systemRoot'] ?? null) === true && in_array('/', array_column($r['json']['roots'] ?? [], 'path'), true));
$r = call('GET', 'list.php?path=/');
check('system root lists /', $r['status'] === 200 && in_array('usr', array_column($r['json']['entries'] ?? [], 'name'), true), $r['status'] . ' ' . substr($r['body'], 0, 300));
$r = job('size', ['source' => '/dev']);
check('pseudo filesystems are rejected for jobs', $r['status'] === 400);
$r = call('GET', 'download.php?path=' . urlencode('/dev/null'));
check('pseudo filesystem files cannot be downloaded', $r['status'] === 400);
$r = job('copy', ['source' => $share . '/alpha.txt', 'destination' => $share . '/alpha-sys.txt']);
check('shares still work with system root', ($r['json']['status'] ?? '') === 'completed');
call('POST', 'config.php', ['systemRoot' => '0']);
// cancellation (worker in-process with a pre-set cancel marker)
require_once $apiDir . '/job_worker.php';
$big = $share . '/big.bin';
@@ -188,6 +203,14 @@ unav_job_write(['id' => $jobId, 'type' => 'copy', 'status' => 'queued', 'source'
touch(unav_job_cancel_path($jobId));
unav_run_job($jobId);
$cancelled = unav_job_read($jobId);
putenv('U_NAV_SETTINGS_FILE=' . $base . '/settings-system.json');
file_put_contents($base . '/settings-system.json', json_encode(['systemRoot' => true]));
unav_roots(true);
check('top-level system folders are protected', unav_is_protected('/usr') && unav_is_protected('/boot') && unav_is_protected('/') && !unav_is_protected('/usr/local'));
check('Unraid mount points are protected', unav_is_protected($mnt . '/disk1') && unav_is_protected($user) && unav_is_protected($mnt) && !unav_is_protected($share));
check('pseudo filesystems are protected', unav_is_protected('/proc/1') && unav_is_pseudo_fs('/sys/kernel') && !unav_is_pseudo_fs('/system'));
putenv('U_NAV_SETTINGS_FILE=' . $base . '/settings.json');
unav_roots(true);
check('cancelled copy leaves nothing behind', $cancelled['status'] === 'cancelled' && !file_exists($share . '/big-copy.bin') && !glob($share . '/.u-nav-*'), json_encode($cancelled));
echo "\n$count checks, $failures failed\n";