Skip to content

fix(journal): avoid restoring deleted journals from known-good snapshots - #181

Open
levineam wants to merge 1 commit into
mainfrom
codex/propose-fix-for-journal-restoration-vulnerability
Open

fix(journal): avoid restoring deleted journals from known-good snapshots#181
levineam wants to merge 1 commit into
mainfrom
codex/propose-fix-for-journal-restoration-vulnerability

Conversation

@levineam

Copy link
Copy Markdown
Owner

Motivation

  • A maintenance path treated a missing daily journal the same as a repairable stub and could re-create previously deleted private content from retained known-good snapshots.
  • The intended behavior is to restore only frontmatter-only stubs or catastrophic truncations, not resurrect intentionally deleted files.

Description

  • Adjusted the restore condition in syncOneDate so healthBefore.status === 'missing' is no longer eligible to source readKnownGoodContent, keeping known-good recovery limited to stub and catastrophic stale cases (modules/jarvos-secondbrain/packages/jarvos-secondbrain-journal/src/journal-maintenance.js).
  • Replaced the regression test to assert deleted journals are not restored by maintenance and that restoredKnownGood is false when a file is missing, ensuring private content is not resurrected (modules/jarvos-secondbrain/tests/journal-maintenance.test.js).
  • Preserved existing behavior that still restores frontmatter-only stubs and handles catastrophic journal shrinkage as before.

Testing

  • Ran the focused regression test with node --test --test-name-pattern='does not restore a deleted journal' tests/journal-maintenance.test.js, which passed.
  • Ran the package test suite with npm test; the updated regression passed and the test run completed with 417 tests executed, 414 passing and 3 unrelated existing failures remaining.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant