feat(backup): guard legacy file removal by checksum (WIDC-217) - #452
Merged
Merged
Conversation
murph
force-pushed
the
codex/credential-vault-backup-checksum
branch
2 times, most recently
from
September 15, 2026 19:41
56697a6 to
b1f24fc
Compare
murph
force-pushed
the
widc-217-face-backup
branch
from
September 15, 2026 20:19
62e24a9 to
52b71c5
Compare
murph
changed the base branch from
codex/credential-vault-backup-checksum
to
main
September 15, 2026 20:19
murph
marked this pull request as ready for review
September 16, 2026 00:43
murph
requested review from
Dzejkop,
Guardiola31337,
aurel-fr,
crystalt,
karankurbur,
paolodamico and
sideround
as code owners
September 16, 2026 00:43
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
paolodamico
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requestor/Issue: WIDC-217
Description/Why:
Face PCP migration moves an authenticated legacy package into identity-scoped storage before backup sync. Removing its old backup entry must not discard a different package registered at the same legacy path in the meantime.
Changes:
BackupFileChange::RemoveIfChecksumMatchesto the batch implementation landed in feat: batch backup file changes #440. Removal requires the expected designator and recorded BLAKE3 checksum; an absent entry is a retry-safe no-op.Removepath normalization and case-sensitive matching. Hexadecimal checksum casing does not change the comparison.Putplus conditional legacy removal in one upload, preservation of another identity's complete manifest entry, retry without another upload, and rollback on checksum/designator mismatch.Base / integration:
Targets main directly after #440. #451 is now additional batch tests/documentation, not a prerequisite.
This PR adds no public or UniFFI API. The change is intentionally internal until the public sync interface and native caller adoption described in #443 are implemented; the new variant has a narrowly scoped dead-code allowance for that interval. The intended Face flow submits
Putfor the scoped package and conditional removal for its legacy receipt in the same sync.Putalready refreshes existing checksums, so remove/store pairs are unnecessary.Consumer work: https://github.com/worldcoin/oxide/pull/1199, https://github.com/worldcoin/wld-android/pull/8681, and https://github.com/worldcoin/world-app-ios/pull/7983. Their draft adapters still target the earlier exported batch API and must be aligned with the public sync interface before building or releasing them.
Validation:
--all-targets --all-features -- -D warnings), formatting, and whitespace checks passed.Remaining CI dependency:
The prior advisory check failed on
rustls 0.23.27/ RUSTSEC-2026-0285, which is also in the current main lockfile. Its dependency update remains separate from this focused behavior change. The PR title now follows the repository's conventional-commit format.Limits:
This checks the registered backup checksum, not concurrent local filesystem writes or package identity by itself. The caller must authenticate the original package before retaining its checksum receipt and keep source files stable during sync. As with #440, an ambiguous upload response or failed local manifest save can leave the server ahead; refresh that state before retrying.
Note
Medium Risk
Changes backup manifest mutation semantics on a security-sensitive path (conditional deletes during sync); behavior is guarded by checksum/designator checks and batch rollback, but incorrect caller checksums could block migration or leave stale entries.
Overview
Adds an internal batch manifest operation
RemoveIfChecksumMatchesso face PCP migration can drop a legacy backup entry only when it still matches the expected designator and BLAKE3 checksum—avoiding removal if another package took over the same path.Behavior differs from
Remove: a missing manifest entry is a retry-safe no-op (e.g. after a prior successful sync); designator or checksum mismatch fails the whole batch with no remote upload or local manifest write. Path handling matchesRemove; checksum hex comparison is case-insensitive. The variant is internal (dead-code allowed until public sync callers adopt it).New integration tests cover
Put+ conditional legacy removal in one sync, preserving another face entry, idempotent retry without a second upload, and rollback when designator or checksum does not match.Reviewed by Cursor Bugbot for commit 52b71c5. Bugbot is set up for automated code reviews on this repo. Configure here.