8000 fix(sync): ledger MAC follow-ups from the #332 review (M-1, M-2) by ahmet-cetinkaya · Pull Request #334 · ahmet-cetinkaya/whph · GitHub
[go: up one dir, main page]

Skip to content

fix(sync): ledger MAC follow-ups from the #332 review (M-1, M-2) - #334

Merged
ahmet-cetinkaya merged 1 commit into
feat/reliable-secure-lan-syncfrom
feat/sync-p3-16-ledger-mac-followups
Oct 29, 2026
Merged

ahmet-cetinkaya merged 1 commit into
feat/reliable-secure-lan-syncfrom
feat/sync-p3-16-ledger-mac-followups

Conversation

@ahmet-cetinkaya
Copy link
Copy Markdown
Owner

What

Efe's three MINORs from the #332 review.

  • M-1: _decodeLedger decoded each record's MAC unguarded, so a non-base64 or non-string mac made the whole ledger unreadable (origins, epoch counter and HLC high-waters treated as missing). Each record is now decoded inside a guard and a malformed one is skipped, as the code comment always said.
  • M-2: a MACed record that could not be checked because the key file was unreadable was dropped at the next ledger write. It is now kept as read (unverifiedRevocations) and written back unchanged, so a later load with the key still sees it. persistRevocations and clearRevocations also clear it.
  • M-3 (docs, not in this diff): the plan sync-ledger-mac.md and the F5 design note now record the actual design: no groupId salt, with the reason (pairing persists records before the key file knows the group id; the record's own signature binds the group; group exit clears records).

Tests

  • file_sync_key_store_test.dart: malformed MAC ('!!!not-base64!!!', 12345, 'AAA') skips only that record and keeps the origin; key file removed -> ledger written -> key restored -> record verifies again.
  • Mutation-checked: dropping the re-emit fails 1 test; narrowing the guard fails 3.
  • dart analyze clean; app sync + persistence/sync 225 pass. No soak (store code only, engine untouched).

… cannot be checked without the key file stay on disk (#332 follow-ups M-1, M-2)
@ahmet-cetinkaya
ahmet-cetinkaya merged commit a10794d into feat/reliable-secure-lan-sync Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0