Repository navigation
Conversation
A field's label is an encryption context, and the SDKs promise that an
error never shows the value of a context. TargetError::Context and
QueryLabelError::NotAColumn put the label in their message, and their
derived Debug printed it too, so unwrap and {:?} logged it.
Both messages now say "the field's label" or "the query's label" in
place of the label. Both types write Debug by hand and print the label
as <redacted>; TargetError prints every other variant as the derived
Debug did. The label field stays, so code that builds or matches the
variants still compiles. This follows the stack-encrypt fix in #1983.
Refs #1999
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk
🦋 Changeset detectedLatest commit: 72b9514 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@coderabbitai review |
Action performed
|
cipherstash-agent
left a comment
There was a problem hiding this comment.
Review attestation
Reviewed 82d873e0 · posted from Claude Code · claude-opus-5-5 · effort medium
Sources: code-review · claude-opus-5-5; rust-security agent · claude-opus-5-5; mattpocock code-review · claude-opus-5-5
Skills: code-review, company-skills:rust-security, mattpocock-skills:code-review, company-skills:review-cross-check
Findings (3): 3 minor — 2 inline, 1 below.
packages/eql/crates/eql-bindings/src/encryption/resolver.rs:169(outside diff) minor · pre-existing The label still reaches callers through stack-encrypt'sTargetError::Column(message atstack-encrypt/src/dynamic/target.rs:397, derivedDebug, payloadlabelkey). A plan hits it first atdynamic/record.rs:770; a directEqlTargetscall hits it here. #1999 leaves this to #1981/#1983, so it is not a regression in this PR; land #1983 and update theresolver.rspass-through test.
One further finding (hand-written Debug can drift silently) was refuted: every arm names its fields without .., so a new field fails with E0027. Tests and clippy pass with --features targets.
Generated by Claude Code
TargetError::Stored put serde_json's own message in its Display and Debug. That message quotes the string the parser refused, and the input is stored ciphertext. targets::decrypt returns this error to a direct Rust caller. The data path already describes it by kind and position (resolver.rs, describe_json_error). The message and Debug now use describe_json_error too. The source field and source() still return the parser's error, so a caller who needs the detail can still read it. The encryption test that read "version 3" from the message now reads it from source. The changeset and CHANGELOG no longer say that every error leaves out a context: stack-encrypt's TargetError::Column still shows the label on the data path until #1983 lands. Refs #1999 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk
|
@coderabbitai review |
Action performed
|
coderdan
left a comment
There was a problem hiding this comment.
LGTM. This will change when the new refinements stuff lands but its a good improvement in the meantime.
Summary
Two errors in the
eql-bindingsRust crate no longer show a field's label. A label is an encryption context, such as a tenant name, that a value is bound to. The SDKs promise that an error never shows the value of a context. The errors still say what was wrong: the label is not a column (two segments, table then column).Changes
encryption::targets::TargetError::Context: the message now readsthe field's label is not an EQL column identifier: expected two segments, table and column. It used to start with the label in quotes.encryption::query::QueryLabelError::NotAColumn: the message now startsthe query's label is not an EQL column identifier. A typed query returns this error insidestack_encrypt::Error::Other.Debugby hand and show the label as<redacted>.Debugreaches logs throughunwrapand{:?}.TargetErrorprints every other variant as the derivedDebugdid.labelfield, so code that builds or matches them still compiles.encryption::targets::TargetError::Stored: the message andDebugnow show only the kind, line, and column of the JSON parser's error. The parser's own message could quote the stored ciphertext it refused. Thesourcefield andsource()still return the parser's error. An encryption test that read the refused version from the message now reads it fromsource.Debugleave out a known label (tenant-acme). One checks thatStoredleaves out a known stored string. One checks thatDebugis unchanged for other variants.@cipherstash/eql(patch), and an entry in the crate'sCHANGELOG.md.On the data path,
TargetError::Contextbecomesstack-encrypt'sTargetError::Column. That error still shows the label in its message,Debug, and payload until #1983 lands. This PR does not change it.Verification
Run against the EQL workspace (
packages/eql):cargo test --locked -p eql-bindings --features targets: all unit tests and doctests pass.cargo test --locked -p eql-bindings -p eql-encryption-tests --features eql-bindings/stack-encrypt: passes.cargo test --locked -p eql-bindings -p eql-encryption-tests --all-features: passes.cargo clippy --locked -p eql-bindings -p eql-encryption-tests --all-features --all-targets -- -D warnings: clean.cargo clippy --locked -p eql-bindings --features stack-encrypt --all-targets -- -D warnings: clean.cargo fmt --all -- --check: clean.These are the commands in the
test:encryptionmise task. I ran them directly becausemise run test:encryptionstopped while mise installedsqlx-cli, a tool this task does not use. The doctests neededTMPDIRset to a directory on disk, because the linker crashed while writing to a full/tmp. Neither problem is related to this change.Related
Closes #1999
Refs #1981, #1983
🤖 Generated with Claude Code
https://claude.ai/code/session_01CtEQzxj55RUn35dkbhdwQk
Summary by CodeRabbit