feat(eql): add Rust text encryption and queries - #971
Draft
coderdan wants to merge 3 commits into
Draft
Conversation
Use Stack Encrypt declarations and native readers for TextEq and TextEqQuery. The stored identifier supplies context; Vitamin C owns plaintext encoding and equality input. Encode only encrypted output. Exercise canonical cross-opening, validation before KMS, batching, query-only operation and PostgreSQL equality/index use. Registry CI requires the unpublished suite crates and a refreshed registry lock. Refs cipherstash/cipherstash-suite#2215
🦋 Changeset detectedLatest commit: 545c700 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 |
The workflow's custom bash shell omits errexit, so a successful final command could hide an earlier failure. Enable fail-fast behavior in both new checks and document the internal test crate in the repository map and security scope. Refs #971
Make successful encryption discoverable alongside the type contracts. Execute the displayed example in the encryption test crate so its runtime and fake key source stay out of the bindings' default tests. Generate plaintext/context descriptions and EQL reference links with the Rust types so regeneration preserves them. Refs #971
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rust callers can now encrypt text, find exact matches in PostgreSQL, and decrypt retrieved values through Stack Encrypt, CipherStash's Rust encryption engine.
TextEqandTextEqQueryproduce the stored-value and search payloads required by EQL (Encrypt Query Language), the database library for encrypted queries. The change reuses Vitamin C, Stack Encrypt's cryptography library, for plaintext encoding.Changes
TextEqandTextEqQuery; the table and column identifier supplies context and is stored ini. Decryption rejects empty or unexpected identifiers before requesting keys.eql-codegenand refresh the shared ciphertext description in TypeScript types and JSON schemas. Payload shapes stay the same.Stringplaintext contract and link to the corresponding CipherStash EQL reference; docs.rs enables the encryption feature. Add a helper for the unpublished dependency, a minor changeset for@cipherstash/eql, and the internal test crate/example inventory inAGENTS.mdandSECURITY.md.Verification
Rust checks used toolchain
1.90.0and the suite checkout atcbb3e000009b5974e90ec7da98d015b4b19a7270. Cargo test/build commands used--offline --lockedwith temporary dependency overrides supplied bybash tasks/dev/with-stack-encrypt.sh <suite-checkout>. Commands below run frompackages/eql, except the pnpm commands, which run from the repository root.cargo test -p eql-encryption-tests --test text_eq_examplecargo test -p eql-encryption-tests --test text_eq -- --include-ignored=,<>, retrieval/decryption, and equality-index use.cargo test -p eql-bindings --features stack-encryptandcargo test -p eql-bindings --no-default-featurescargo test -p eql-codegen -p eql-bindings --features eql-bindings/stack-encrypttext_eq_example, as described above.cargo test -p eql-codegen -p eql-domainscargo clippy -p eql-bindings -p eql-encryption-tests -p eql-codegen --all-features --all-targets -- -D warningscargo fmt --all -- --check;RUSTDOCFLAGS='-D warnings' cargo doc -p eql-bindings --no-depswith--features stack-encryptand with--no-default-featurescargo check -p eql-bindings --features stack-encrypt --target wasm32-wasip1node packages/eql/scripts/sync-generated.mjs --check; compare generated files with Gitcargo metadata --locked --format-version 1 --filter-platform aarch64-apple-darwininpackages/protect-ffipnpm run code:fixpnpm --filter @cipherstash/eql buildandpnpm --filter @cipherstash/eql testpnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-run-fail-fast.test.mjs scripts/__tests__/eql-suite-ci.test.mjs scripts/__tests__/eql-workflow-filters.test.mjsCI has not passed. The Rust workspace job failed because crates.io has no
stack-encryptpackage yet. The Node 22 job also rejected lockfile entries for local suite crates that are absent in a clean checkout, and found the workflow fail-fast issue fixed in this update. Publish the prerequisite crates and regeneratepackages/eql/Cargo.lockwithout local overrides before merging. The local checks above do not replace that registry-based CI validation.Related
Refs cipherstash/cipherstash-suite#2215 — the architecture decision and Stack Encrypt API this companion PR consumes.
Review notes
packages/eql/crates/eql-bindings/src/encryption.rs, then the generated derives insrc/v3/text.rsandtests/encryption/tests/text_eq.rs.