Skip to content

stack-encrypt: dynamic::record::decrypt returns passthrough fields next to decrypted ones without saying they are not authenticated #1121

Closed

Description

@coderdan

Background

In a stack-encrypt record plan, a field can be passthrough. That means it is stored as it is, unencrypted, so the record stays whole. The Output::Passthrough docs in packages/stack-encrypt/src/dynamic/record.rs say it is "unsealed and unauthenticated".

Problem

dynamic::record::decrypt puts passthrough values and decrypted values into one flat object, in plan order. A decrypted value is authenticated: if someone changes its stored bytes, decryption fails. A passthrough value is not. Anyone who can write to the database can change it, and decrypt still succeeds. record_row checks only its type.

The decrypt docs say that passthrough outputs take part, but not that their values are unauthenticated. So a caller can believe that every field in the result was checked.

(This affected Go's DecryptRecord when #1093 was reviewed. Further up that stack, Go keeps passthrough values on the Go side, so the gap that remains is in the Rust dynamic::record API and any binding that uses it.)

Proposal

  1. Add this text to the docs of dynamic::record::decrypt: "A passthrough field comes back exactly as the store holds it. Anyone who can write to the store can change it, and decrypt does not detect the change."
  2. Consider returning passthrough fields in their own map, so the type tells a caller which values are authenticated.

Found in the review of #1093.

Activity

  1. added
    documentationImprovements or additions to documentation
    rustPull requests that update Rust code
    on Oct 7, 2026
  2. coderdan commented on Oct 7, 2026

    @coderdan
    ContributorAuthor

    From the #1093 review thread: #1093 (comment)

  3. added
    StagedDone in the next branch; closes when next merges into main
    on Oct 18, 2026
  4. self-assigned this
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

SDKStagedDone in the next branch; closes when next merges into maindocumentationImprovements or additions to documentationrustPull requests that update Rust code

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions