Skip to content

migration: verify proves the store matches its own manifest, not the source, so a short source read verifies clean #1306

Backlog

Description

@chappie-daemon

Found by job 045's security lens (row 5 of #868) at 8488bf13.

The migration's verify pass proves the store matches the manifest, not the source.

The manifest's rows and checksum are folded from the same batches the store receives (crates/nostream-cli/src/commands/migrate.rs:236-258), and verify_with reads only the target (migrate.rs:294-350). A store truncated after the copy fails (row count or checksum), and a store replaced beside the manifest is refused up front (held.is_empty() probe at migrate.rs:183-201).

What no check covers is a source read that ends a table early: the table is marked complete on count < batch_size (the trait's end marker, crates/nostream-storage/src/migration.rs:228), so a short page is indistinguishable from end-of-table — and the manifest records the short total as the complete one. ADR 0013 D4 says "any added, removed or altered row moves it" and calls the check a completeness proof; that is true of the target against the manifest it wrote, not of the store against the source.

Acceptance

  • Either the verify pass reads both sides (source and target) and compares them, or the manifest records the source's own count per table and the verification names which claim it makes.
  • ADR 0013 D4 states what the checksum proves and what it does not.
  • A case where the source ends a page early (a short read) is detected, or the gap is recorded as accepted risk with the reason.

Record: docs/rewrite/reviews/2026-11-30-relay-storage.md — finding F18, lens security, tree 8488bf13. Site: crates/nostream-cli/src/commands/migrate.rs:254.

Activity

  1. added
    bug
    rewrite
    rust
    factory
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfactoryrewriterust

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions