Skip to content

stack-encrypt: TargetError::Column puts a context label in its message and payload #1981

In review

Description

@auxesis

Background

stack-encrypt is the Rust crate in packages/stack-encrypt that encrypts values. The Go SDK runs it inside a WebAssembly guest. It is also published to crates.io for Rust users. The SDKs promise that an error never contains the values of an encryption context. A context is a label, such as a tenant name, that a value is bound to.

Problem

TargetError::Column, in packages/stack-encrypt/src/dynamic/target.rs line 396 on next, puts a context label in its message. The same label is also in its label payload field, at line 489.

  • The label comes from a field's declared context= tag in the program's source, not from a row.
  • The Go SDK refuses that case first, with an error that has no value, since fix(golang): keep encryption context values out of error text #1974. So Go users do not get this message.
  • Rust users of stack-encrypt, and any other SDK built on it, can still get it.

So the promise is not true for every SDK. Nothing catches this, because no test checks that this error leaves out the label.

Proposal

  1. Remove the label from the message and the payload of TargetError::Column. Keep the column or field name.
  2. Update the test at packages/stack-encrypt/src/dynamic/record.rs line 7206. That test checks the old text.
  3. Add a test that the error leaves out a known label.
  4. Add a CHANGELOG entry for stack-encrypt, because the error text and payload change for Rust callers.

Evidence

Metadata

Metadata

Assignees

Labels

RustSDKbug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions