security(vault,recovery,config): harden Vault keyfile/seal, strip recovery passwords, guard config & symlinks

This commit is contained in:
tyuXX 2026-11-27 22:22:59 +00:00
parent 005c82e6bf
commit e3f716d24f
12 changed files with 504 additions and 207 deletions

View file

@ -250,6 +250,9 @@ describe('Configurable Re-Auth Strictness, Multi-Auth Factors & Emergency Secret
expect(anyLogin.status).toBe(200);
// Switch settings.json to strict multi-factor 'all' + 'every-action' + password step-up
expect(
(await api.call('/api/auth/step-up', { method: 'POST', body: { code: totp1.generate() } })).status,
).toBe(200);
const rawSettings = await api.call('/api/config/file?path=settings.json');
expect(rawSettings.status).toBe(200);
const parsedSettings = JSON.parse(String(rawSettings.data.rawContent)) as Record<
@ -431,7 +434,7 @@ describe('Configurable Re-Auth Strictness, Multi-Auth Factors & Emergency Secret
const bundle = JSON.parse(fs.readFileSync(bundlePath, 'utf8')) as EmergencySecretsBundle;
expect(bundle.vaultMasterKeyHex).toBe(masterKeyHex);
expect(bundle.admin.username).toBe('admin');
expect(bundle.admin.passwords.some((p) => p.plaintextPassword === password)).toBe(true);
expect(bundle.admin.passwords.some((p) => p.label === 'Primary Password' && !('plaintextPassword' in p))).toBe(true);
expect(bundle.admin.totps.some((t) => t.secretBase32 === secretBase32)).toBe(true);
expect(bundle.admin.recoveryCodes).toEqual(recoveryCodes);
expect(bundle.vaultCredentials['backup-key']).toBeDefined();