fix: harden residual route and restore checks

This commit is contained in:
jb
2026-09-19 10:01:23 -04:00
parent cb86497724
commit 01b8b4642b
7 changed files with 45 additions and 11 deletions
+2
View File
@@ -2,6 +2,7 @@ import { expect, test } from 'bun:test';
import {
parseRestoreMarkerPhase,
RESTORE_MARKER_CONFIRMATION,
SYNTHETIC_CHARACTER_ID_MIN,
validateRestoreMarkerTarget,
validateRestoreMarkerWrite,
} from '../src/lib/server/restore-marker';
@@ -16,6 +17,7 @@ test('restore marker rejects non-loopback targets before any backend call', () =
expect(() => validateRestoreMarkerTarget('https://production.example.test')).toThrow('loopback');
expect(() => validateRestoreMarkerTarget('http://192.0.2.10:3210')).toThrow('loopback');
expect(validateRestoreMarkerTarget('http://127.0.0.1:3210').hostname).toBe('127.0.0.1');
expect(SYNTHETIC_CHARACTER_ID_MIN).toBeGreaterThan(2_000_000_000);
});
test('restore marker requires explicit disposable confirmation for writes', () => {