Skip to content

tech-debt(fula-mcp): unify read.rs decrypt cores to call the shared fula_crypto::sharing cores (drift surface) #88

Description

@ehsan6sha

Follow-up from the A6b recipient-bindings review (PR #87, GLM finding F3).

Today there are TWO byte-identical copies of the owner-file (encType:fula) decrypt logic:

  • native private crates/fula-mcp/src/read.rs: decrypt_single_block / assemble_chunked
  • shared public crates/fula-crypto/src/sharing.rs: decrypt_accepted_single_block / assemble_accepted_chunked (called by the fula-js wasm recipient bindings the hosted Worker uses)

They are kept in lockstep by the #[cfg(test)] no-drift cross-check native_and_shared_owner_file_cores_are_byte_identical in read.rs, which (as of #87) covers all three version arms (Some(>=4) / Some(<4) / None) plus the chunked path.

This is correct today but is a latent footgun. Cleanup: refactor read.rs to delegate to the shared sharing:: cores and delete the private copies, eliminating the drift surface entirely.

Deferred from #87 deliberately: the production read path was left untouched to minimize risk to the already-merged local MCP, and the no-drift gate makes deferral safe. Non-blocking / low priority.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions