Ignore shfs inodes, add low-priority jobs, fix retention grouping and CSRF; release 2026.11.22.r001
- Pass --ignore-inode for sources below /mnt/user and /mnt/user0. shfs hands out new inode numbers after every reboot, which made Restic re-read all data on the first run after a restart. - Add a per-job lowPriority option that starts Restic and Rsync through ionice (idle) and nice 19 via the new internal/procprio package. - Run restic forget with --group-by host,tags. Grouping by paths split a job into a new group whenever its sources changed, and keep-within never expired the old group's snapshots. - Verify the Unraid CSRF token in webgui/api.php for POST, PUT and DELETE and reject other methods; Unraid's own check only covers form posts. - Set $urbmVersion in URBM.page during the package build and fail the build if it does not match, so the page always loads the packaged JS asset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a7dbd77492
commit
ac055497b7
16 files changed
+317
-28
No files matched your search
+24
-1
@@ -21,11 +21,34 @@ function urbm_json_error(int $status, string $message): void
|
||||
exit;
|
||||
}
|
||||
|
||||
// The Unraid session CSRF token. Unraid's own check only covers form posts
|
||||
// ($_POST), not the JSON bodies this bridge forwards, so it is verified here.
|
||||
function urbm_csrf_token(): string
|
||||
{
|
||||
$file = getenv('URBM_VAR_INI') ?: '/var/local/emhttp/var.ini';
|
||||
$var = @parse_ini_file($file);
|
||||
$token = is_array($var) ? ($var['csrf_token'] ?? '') : '';
|
||||
return is_string($token) ? $token : '';
|
||||
}
|
||||
|
||||
$socket = '/run/urbm/urbm.sock';
|
||||
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
|
||||
$method = strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? 'GET'));
|
||||
$path = $_GET['path'] ?? '/v1/health';
|
||||
$isSnapshotFileRequest = preg_match('#/snapshots/[^/]+/files(?:\?|$)#', $path) === 1;
|
||||
|
||||
if (!in_array($method, ['GET', 'POST', 'PUT', 'DELETE'], true)) {
|
||||
urbm_json_error(405, 'method not allowed');
|
||||
}
|
||||
|
||||
if ($method !== 'GET') {
|
||||
$expected = urbm_csrf_token();
|
||||
$provided = $_SERVER['HTTP_X_CSRF_TOKEN'] ?? '';
|
||||
if ($expected === '' || !is_string($provided) || !hash_equals($expected, $provided)) {
|
||||
urbm_bridge_log('warn', 'rejected request without valid CSRF token', ['path' => $path, 'method' => $method]);
|
||||
urbm_json_error(403, 'Ungültiges oder fehlendes CSRF-Token. Bitte die Seite neu laden.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!preg_match('#^/v1/[A-Za-z0-9_./?=&%:-]*$#', $path) || str_contains($path, '..')) {
|
||||
urbm_bridge_log('warn', 'invalid API path', ['path' => $path]);
|
||||
urbm_json_error(400, 'invalid API path');
|
||||
|
||||
Reference in new issue
Block a user