AntFleet

Disagreement · 5bbcd2d3-anthropic-4

maybeRestoreCredsFromBackup races with concurrent reads of creds.json

solo Opus
repo 5149da9d·PR #3·reviewed 2 days ago

Opus finding

maybeRestoreCredsFromBackup races with concurrent reads of creds.json

lowconcurrencylow
  • src/web/auth-store.ts:51-79
Restoration uses copyFileSync directly to creds.json rather than write-and-rename, leaving a window where creds.json is partially written. If another process (e.g., the baileys runtime) reads creds.json mid-copy, it could see truncated content. Since this runs during webAuthExists, it is on a hot path during startup; concurrent processes touching the same auth dir could observe corruption. Likelihood is low under normal single-process usage but the recommended pattern is rename-after-write.

Recommendation

Copy backup to a temp path (e.g., creds.json.restore), chmod, then fsSync.renameSync over creds.json for an atomic swap.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.