Skip to content

[2/3] refactor(eql): adopt the cipherstash-client 0.42.0 representation#423

Open
freshtonic wants to merge 4 commits into
queue/eql-v3/setup-skillsfrom
queue/eql-v3/upgrade-deps
Open

[2/3] refactor(eql): adopt the cipherstash-client 0.42.0 representation#423
freshtonic wants to merge 4 commits into
queue/eql-v3/setup-skillsfrom
queue/eql-v3/upgrade-deps

Conversation

@freshtonic

@freshtonic freshtonic commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

📚 eql-v3 PR  ·  2 of 3

Part of a queue. The PRs merge in FIFO order — the numbered order below, #1 first. Merging one supersedes the PRs after it until the author runs git queue sync (rebases the rest onto the merged base) and git queue submit (retargets their PRs).

⏳🟢 #422 queue/eql-v3/setup-skillsmain
⏳🟢 #423 queue/eql-v3/upgrade-depsqueue/eql-v3/setup-skills  👈 this PR
⏳🟢 #424 queue/eql-v3/typecheckqueue/eql-v3/upgrade-deps

✅ approved · ♻️ changes requested · ⏳ review pending  |  🟣 merged · 🟢 open · ⚫ closed  —  status as of the last git queue submit.
🥞 Managed by git-queue — do not edit this list by hand.

About this queue

Migrates CipherStash Proxy from EQL v2 to EQL v3 (cipherstash-client 0.34.1-alpha.4 → 0.42.0, EQL 2.3.0-pre.3 → 3.0.2), replacing the opaque eql_v2_encrypted composite type with 53 typed jsonb domains that encode both scalar type and searchable capability in the column type itself.

About this branch

Upgrade cipherstash-client & eql-bindings to latest.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 29600d7f-9c6f-4e57-ab7a-37387f80c462

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch queue/eql-v3/upgrade-deps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Knowingly leaves the workspace not compiling. Fixing the fallout is
deliberately deferred.

- cipherstash-client / cipherstash-config / cts-common: 0.34.1-alpha.4 -> 0.42.0
- CS_EQL_VERSION: eql-2.3.0-pre.3 -> eql-3.0.1 (major, breaking)
- Drop the CIP-3159 vendored stack-auth patch: 0.42.0 requires
  stack-auth ^0.42.0, which carries the CancelGuard fix upstream.

vendor/stack-auth is left in place but is now unreferenced.

Stable-Commit-Id: q-0c7qhchxzewgy0q472w3vcps2t
Switch the encrypt path to cipherstash-client 0.42.0's encrypt_eql_v3 and
make v3 the only wire envelope Proxy speaks. Still does not compile;
threading the new types through the protocol layer is deferred.

- lib.rs re-exports the V3 types under the old names and deliberately does
  NOT re-export the v2 ones, so any remaining v2 use fails to resolve
  rather than silently writing v2 payloads.
- EQL_SCHEMA_VERSION 2 -> 3; startup gate now queries eql_v3.version()
  (eql_v2 schema no longer exists in EQL 3).
- Decrypt is now local: there is no decrypt_eql_v3 in the client, but a
  scalar payload's 'c' is an EncryptedRecord and EncryptedRecord is
  Decryptable, so it goes straight to the cipher.
- SteVec (jsonb) decrypt returns SteVecV3DecryptUnsupported: v3 stores the
  key header once at the document root with raw AEAD bytes per entry, and
  reassembling that here would hard-code the envelope layout.

Stable-Commit-Id: q-4n8w7v1b7dadsf27c98sz33kk1
Follows the approach protect-ffi uses (encrypted_record_from_value /
v3_root_record): skip decrypt_eql entirely and hand an EncryptedRecord
straight to the cipher.

Replaces the SteVecV3DecryptUnsupported error added in the previous
commit, which was wrong -- KeyHeader::record_with_selector is public and
does exactly the reassembly needed.

Scalar and SteVec records are NOT interchangeable, hence the V3Record
enum: RecordWithNonce unconditionally reports a nonce override and an AAD
selector, so wrapping a scalar record in one would decrypt against a
nonce the value was never encrypted with.

Note protect-ffi's SteVec branch does not port directly: it pins
cipherstash-client =0.41.1, where sv entries are self-describing
mp_base85 records. 0.42.0 moved to an envelope -- key material once in
the document's 'h' header, raw AEAD bytes per entry, nonce and AAD
derived from the entry selector.

Stable-Commit-Id: q-2jsj9wjxvdj9s21xzpmp838x93
Completes the v3 move. The workspace compiles again; cargo fmt and
clippy are clean.

The load-bearing change is in data_row.rs. EQL v2's eql_v2_encrypted was
a COMPOSITE type, so reads stripped a ('...') wrapper in text and a
12-byte rowtype header in binary. EQL v3's types are DOMAINS over jsonb
(95 CREATE DOMAIN, zero composites), and a domain is wire-identical to
its base type -- so both of those strips were wrong. Reads now take the
jsonb representation: bare JSON in text, a 1-byte version header plus
JSON in binary.

Also:
- Encrypt now carries EqlOutput, not EqlCiphertext, through the literal
  and param paths: a query operand is not a ciphertext. Both v3 enums
  are #[serde(untagged)], so the serialized wire form is unchanged.
- backend/bind/data_row imported cipherstash_client::eql::EqlCiphertext
  directly, bypassing the crate alias and silently keeping the v2 type.
  They now use crate::EqlCiphertext.
- EqlCiphertext::identifier is a method in 0.42.0, not a field.
- Map the new EqlError variants. UnsupportedSteVecOreInV3 gets its own
  customer-facing error: v3 has no oc representation, so a ste_vec column
  left in Standard (CLLW-ORE) mode cannot be written at all.
- cipherstash-config gained IndexType::SteVec { mode }. SteVecMode::Compat
  (CLLW-OPE) is the default and the v3-compatible mode; Standard is
  documented upstream as the legacy v2 protocol.
- CouldNotDecryptDataForKeyset gained a #[source]; Proxy's variant does
  not carry it, so the chain stops at that boundary (noted in place).

Stable-Commit-Id: q-48c15nyszqvw09e8m6gydxqvfd
@freshtonic
freshtonic force-pushed the queue/eql-v3/setup-skills branch from 3010414 to ad36391 Compare July 21, 2026 13:06
@freshtonic
freshtonic force-pushed the queue/eql-v3/upgrade-deps branch from 479744c to 86a8731 Compare July 21, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant