Skip to content

fix(eql-bindings): leave labels and stored bytes out of refusals - #2001

Open
auxesis wants to merge 2 commits into
nextfrom
fix/eql-bindings-context-label
Open

auxesis wants to merge 2 commits into
nextfrom
fix/eql-bindings-context-label

Conversation

@auxesis

@auxesis auxesis commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two errors in the eql-bindings Rust 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 reads the 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 starts the query's label is not an EQL column identifier. A typed query returns this error inside stack_encrypt::Error::Other.
  • Both types now write Debug by hand and show the label as <redacted>. Debug reaches logs through unwrap and {:?}. TargetError prints every other variant as the derived Debug did.
  • Both variants keep their label field, so code that builds or matches them still compiles.
  • encryption::targets::TargetError::Stored: the message and Debug now 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. The source field and source() still return the parser's error. An encryption test that read the refused version from the message now reads it from source.
  • Tests: one for each label error checks that the message and Debug leave out a known label (tenant-acme). One checks that Stored leaves out a known stored string. One checks that Debug is unchanged for other variants.
  • A changeset for @cipherstash/eql (patch), and an entry in the crate's CHANGELOG.md.

On the data path, TargetError::Context becomes stack-encrypt's TargetError::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:encryption mise task. I ran them directly because mise run test:encryption stopped while mise installed sqlx-cli, a tool this task does not use. The doctests needed TMPDIR set 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

  • Changed
    • Sensitive labels and stored data are no longer included in certain encryption error messages or debug output.
    • Stored-data errors still show the parser error type and location, while retaining the underlying error as a source.
    • Error messages for column-related issues continue to show the label where applicable.

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
@auxesis auxesis added bug Something isn't working Rust Pull requests that update Rust code SDK labels Nov 27, 2026
@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 72b9514

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@cipherstash/eql Patch
stash Patch
@cipherstash/stack-prisma Patch
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/prisma-example Patch
@cipherstash/stack-drizzle Patch
@cipherstash/stack-supabase Patch
@cipherstash/stack Patch
@cipherstash/wizard Patch
@cipherstash/bench Patch
@cipherstash/test-kit Patch

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

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Error formatting now omits context labels from QueryLabelError::NotAColumn and TargetError::Context. TargetError::Stored messages and Debug output show parser error kind and location instead of parser text. The label fields and parser error source remain available.

Changes: Error formatting

Layer / File(s) Summary
Redact labels in error output
packages/eql/crates/eql-bindings/src/encryption/query.rs, packages/eql/crates/eql-bindings/src/encryption/targets.rs, packages/eql/crates/eql-bindings/CHANGELOG.md, .changeset/*
QueryLabelError::NotAColumn and TargetError::Context retain their label fields but omit label values from messages and Debug output. Tests verify the output and retained fields. Release notes document the changes.
Sanitize stored parser errors
packages/eql/crates/eql-bindings/src/encryption/targets.rs, packages/eql/tests/encryption/tests/targets.rs, packages/eql/crates/eql-bindings/CHANGELOG.md
TargetError::Stored messages and Debug output show the parser error kind, line, and column. The parser error remains available as the source. Tests check the formatted prefix and inspect the source error for the version detail.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Issue 1981 concerns label disclosure in stack-encrypt’s TargetError::Column. This change does not alter that variant.

Suggested reviewers: coderdan

Merge Risk: Minimal · up to 72b95

This change stops error messages and Debug output from revealing field labels and stored parser text, while keeping the label fields and parser sources available to callers. No merge-blocking risk was found. The data-path TargetError::Column still shows its label until #1983 lands, which the PR states openly.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: error messages and Debug output for eql-bindings refusals no longer expose labels or stored bytes. The Conventional Commits prefix 'fix(eql-bindings):' matches the sco…
Linked Issues check Passed Only #1999 is directly linked and open, so its coding requirements apply. #1981 and #1983 are related work, not requirements for this PR. The whole-PR summary shows these changes for #1999: (1) Target…
Out of Scope Changes check Passed The changes to targets.rs, query.rs, their tests, the changeset, and the CHANGELOG.md entry map to #1999. The PR does not change stack-encrypt's TargetError::Column, which #1981 and #1983 cover. The T…
Full details: Title check

Explanation

The title names the main change: error messages and Debug output for eql-bindings refusals no longer expose labels or stored bytes. The Conventional Commits prefix 'fix(eql-bindings):' matches the scope. The title is concise, specific, and matches the linked issue #1999 and the PR objectives.

Full details: Linked Issues check

Explanation

Only #1999 is directly linked and open, so its coding requirements apply. #1981 and #1983 are related work, not requirements for this PR. The whole-PR summary shows these changes for #1999: (1) TargetError::Context in targets.rs no longer includes the label in its message; (2) QueryLabelError::NotAColumn in query.rs no longer includes the label in Display; (3) both types write a manual Debug that prints the label as <redacted>; (4) both variants keep their label field; (5) each error has a unit test that checks a known label (tenant-acme) is absent from the message and Debug output; (6) a patch changeset for @cipherstash/eql is added, plus a CHANGELOG.md entry. The summary does not show the raw source. The Debug output for other TargetError variants is supported by the summary and by a test that checks it. No unmet coding requirement is shown.

Full details: Out of Scope Changes check

Explanation

The changes to targets.rs, query.rs, their tests, the changeset, and the CHANGELOG.md entry map to #1999. The PR does not change stack-encrypt's TargetError::Column, which #1981 and #1983 cover. The TargetError::Stored change (message and Debug show only parser error kind, line, and column; source and source() are kept; one encryption test reads the refused version from source) is not named in #1999. It is a related redaction change in the same file and theme, it is documented in the PR description and CHANGELOG, and it is covered by a test. It does not show a concrete unrelated change, so it is not marked out of scope. Reviewers may still confirm that this adjacent hardening is wanted in this PR. No other unrelated change appears in the summary.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ac15e28d-d25a-4511-9706-79c643d27b35
Commits

Reviewing files that changed from the base of the PR and between 82d873e and 72b9514.

Files selected for processing: 4

  • .changeset/eql-bindings-context-label-redacted.md
  • packages/eql/crates/eql-bindings/CHANGELOG.md
  • packages/eql/crates/eql-bindings/src/encryption/targets.rs
  • packages/eql/tests/encryption/tests/targets.rs
Files skipped from review as they are similar to previous changes: 2

  • .changeset/eql-bindings-context-label-redacted.md
  • packages/eql/crates/eql-bindings/CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@auxesis
auxesis marked this pull request as ready for review November 27, 2026 14:09
@auxesis
auxesis requested a review from a team as a code owner November 27, 2026 14:09
@auxesis

auxesis commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cipherstash-agent cipherstash-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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's TargetError::Column (message at stack-encrypt/src/dynamic/target.rs:397, derived Debug, payload label key). A plan hits it first at dynamic/record.rs:770; a direct EqlTargets call hits it here. #1999 leaves this to #1981/#1983, so it is not a regression in this PR; land #1983 and update the resolver.rs pass-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
@auxesis auxesis changed the title fix(eql-bindings): leave the label out of column refusals fix(eql-bindings): leave labels and stored bytes out of refusals Nov 27, 2026
@auxesis

auxesis commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@auxesis
auxesis requested a review from coderdan November 28, 2026 05:07

@coderdan coderdan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This will change when the new refinements stuff lands but its a good improvement in the meantime.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Rust Pull requests that update Rust code SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eql-bindings: TargetError::Context and QueryLabelError put a context label in their message

3 participants