security hardening

This commit is contained in:
Philipp committed 2026-05-21 14:09:08 +02:00
1 parent 3103aba972
commit 0046156e58
16 files changed
+205 -43

No files matched your search

+15
View File
@@ -74,6 +74,21 @@ export function runRestic(args, options = {}) {
});
}
export async function resticSnapshotFileSize(snapshotId, filename) {
const result = await runRestic(['ls', '--json', snapshotId]);
const wanted = `/${filename}`;
for (const line of result.stdout.split('\n')) {
if (!line.trim()) continue;
const entry = JSON.parse(line);
if (entry.type === 'file' && (entry.path === filename || entry.path === wanted || entry.path?.endsWith(wanted))) {
return Number(entry.size);
}
}
const error = new Error(`Could not verify Restic file size for ${filename} in snapshot ${snapshotId}.`);
error.status = 500;
throw error;
}
export function createProgressStream(totalBytes, onProgress) {
let currentBytes = 0;
return new Transform({