Primary finding
maybeRestoreCredsFromBackup silently aborts on corrupt creds.json and never restores from backup
- src/web/auth-store.ts:56-62
- src/web/auth-store.ts:76-80
If creds.json exists but is corrupted (JSON.parse throws), the exception is caught by the outer catch and the function returns without attempting to restore from backup. The intent (per the warning message) is to restore corrupted creds from backup, but current control flow prevents that on parse errors.
Recommendation
Change control flow so that a JSON parse failure falls through to the backup-restore path instead of being swallowed. For example: - Wrap only the JSON.parse(raw) in a try/catch; on failure, continue to check and restore backup. - Or use a parsedOk flag: if (!rawParsedOk) then attempt backup. Also avoid a broad outer catch that swallows parse errors and restoration errors without logging.