Paired-backup verifier now checks more than the manifest hash

This commit is contained in:
2026-10-21 02:39:02 -04:00
parent 0ac2073038
commit 8b0e2287a5
6 changed files with 144 additions and 16 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import { createCoordinatedCustodyBackup, verifyCoordinatedCustodyBackup } from '
const [action, ...args] = process.argv.slice(2);
if (action !== 'create' && action !== 'verify') throw new Error('Expected create or verify');
const allowed = new Set(['--source', '--destination', '--consent']);
const allowed = new Set(['--source', '--destination', '--consent', '--pg-restore-binary']);
for (let index = 0; index < args.length; index++) {
if (!allowed.has(args[index]) || (args[index] !== '--consent' && (!args[index + 1] || args[index + 1].startsWith('--')))) {
throw new Error('Invalid coordinated backup arguments');
@@ -19,8 +19,8 @@ try {
if (!destination || !args.includes('--consent')) throw new Error('Create requires --destination and explicit --consent');
result = await createCoordinatedCustodyBackup(source, destination);
} else {
if (value('--destination') || args.includes('--consent')) throw new Error('Verify accepts only --source');
result = await verifyCoordinatedCustodyBackup(source);
if (value('--destination') || args.includes('--consent')) throw new Error('Verify accepts --source and optional --pg-restore-binary');
result = await verifyCoordinatedCustodyBackup(source, value('--pg-restore-binary'));
}
console.log(JSON.stringify(result, null, 2));
} catch {