Skip to content

stack-encrypt: a Serde value that fails part-way through decoding leaves the decoded parts unwiped #1676

Open

Description

@coderdan

Background

Stack Encrypt (packages/stack-encrypt) is the Rust encryption engine that every CipherStash language SDK runs on. Decrypted plaintext must not stay in freed memory. Collections, records and OpaqueBlob already wipe what they decoded before a later failure.

Problem

A value decoded through Serde (an OpaqueBlob<T> or a JSON document, for example) can fail after some of its fields were built. Those fields are dropped without being wiped. #1503 recorded this as a known gap (the native-partial-decode-fields limit in conformance/stack-encrypt/lifecycle-contract.md). #1468, which this was grouped with, is closed without it. Plan item: Wipe plaintext in the remaining cases.

Proposal

  1. Decode into storage that is wiped on drop, or wipe each built field on the error path.
  2. Move the native-partial-decode-fields limit into the lifecycle profile as a requirement, with a heap test that fails today.
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

    SDKrustPull requests that update Rust code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions