Skip to content

Commit 489c275

Browse files
committed
fix(eql): build the stack-encrypt feature against the in-repo stack-encrypt
#971 was written against stack-encrypt as cipherstash-suite#2215 had it on 2026-09-12. stack-encrypt now lives here and has moved on in two ways this crate touches: - vitaminc 0.5 gives a context one view, `IntoContext`, and derives the AAD and the PRF context from it. `Identifier` implements that, over the same (table, column) pair, instead of `IntoAad` and `IntoPrfContext` separately. - `EncryptFrom::encryption()` no longer takes the context; it is supplied when the description runs, and `Encryption` carries its type. eql-bindings now depends on stack-encrypt by path and version, and the test crate by path, so the temporary-patch helper `tasks/dev/with-stack-encrypt.sh` has nothing left to do and is gone, with the README section and workflow comment that pointed at it. Refs #971
1 parent 9d95d5e commit 489c275

4 files changed

Lines changed: 25 additions & 59 deletions

File tree

‎.github/workflows/test-eql.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ jobs:
561561
rustup component add --toolchain "${active_rust_toolchain}" rustfmt clippy
562562
mise run test:crates
563563
564-
# Registry builds require the unpublished Stack Encrypt crates from
565-
# cipherstash-suite#2215 to be published before this change merges.
566564
- name: Test Rust text equality with PostgreSQL
567565
env:
568566
PGPASSWORD: postgres

‎packages/eql/crates/eql-bindings/README.md‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ The generated API docs include a complete, executable example in the
110110
[source](src/encryption/example.rs) is also run by the encryption test crate:
111111

112112
```bash
113-
# From packages/eql, using the unpublished suite checkout:
114-
bash tasks/dev/with-stack-encrypt.sh /path/to/cipherstash-suite \
115-
test -p eql-encryption-tests --test text_eq_example
113+
# From packages/eql:
114+
cargo test -p eql-encryption-tests --test text_eq_example
116115
```
117116

118117
With an initialized cipher, the essential calls are:
@@ -149,25 +148,20 @@ these payloads through the existing `public.eql_v3_text_eq` and
149148
`eql_v3.query_text_eq` domains and their equality extractor index. Writers and
150149
query producers for these values must use this same profile.
151150

152-
### Developing against the unpublished crates
151+
### Developing the `stack-encrypt` feature
153152

154-
Stack Encrypt and its runtime prerequisites must be published before the normal
155-
registry-based build, CI, and `eql-bindings` publication can succeed. Regenerate
156-
`Cargo.lock` without local overrides once they are published, before merging.
157-
During development, use a checkout containing
158-
[cipherstash-suite#2215](https://github.com/cipherstash/cipherstash-suite/pull/2215)
159-
(tested with commit `cbb3e000009b5974e90ec7da98d015b4b19a7270`):
153+
Stack Encrypt lives in this repository (`packages/stack-encrypt`), and the
154+
feature depends on it by path and version: in-tree builds use the path, and the
155+
published `eql-bindings` resolves the version from crates.io. Publish the
156+
matching `stack-encrypt` before releasing an `eql-bindings` that needs it.
160157

161158
```bash
162-
# From packages/eql. Generates a temporary Cargo patch; no local paths are committed.
163-
bash tasks/dev/with-stack-encrypt.sh /path/to/cipherstash-suite \
164-
test -p eql-encryption-tests
165-
bash tasks/dev/with-stack-encrypt.sh /path/to/cipherstash-suite \
166-
test -p eql-bindings --features stack-encrypt
159+
# From packages/eql:
160+
cargo test -p eql-encryption-tests
161+
cargo test -p eql-bindings --features stack-encrypt
167162

168163
# Against a disposable PostgreSQL database, using fresh encryption and a fake KMS:
169164
psql "$EQL_TEST_DATABASE_URL" -v ON_ERROR_STOP=1 \
170165
-f crates/eql-bindings/sql/cipherstash-encrypt.sql
171-
bash tasks/dev/with-stack-encrypt.sh /path/to/cipherstash-suite \
172-
test -p eql-encryption-tests --test text_eq -- --ignored
166+
cargo test -p eql-encryption-tests --test text_eq -- --ignored
173167
```

‎packages/eql/crates/eql-bindings/src/encryption.rs‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ use stack_encrypt::sem::EqualityTerm;
7272
use stack_encrypt::target::transcode::{Reader, Transcode, Visitor};
7373
use stack_encrypt::target::{self, AeadContext, CallerContext};
7474
use stack_encrypt::{
75-
Aad, AadPiece, CipherText, Decrypt, DecryptField, DecryptInto, Decryptable, Decryption,
76-
Encrypt, EncryptFrom, Encryption, Error, IntoAad, IntoPrfContext, MaybeEmpty, NonEmpty,
77-
PrfContext, SealedValue, StackCipherText,
75+
CipherText, ContextPiece, Decrypt, DecryptField, DecryptInto, Decryptable, Decryption, Encrypt,
76+
EncryptFrom, Encryption, Error, IntoContext, MaybeEmpty, NonEmpty, SealedValue,
77+
StackCipherText,
7878
};
7979
use vitaminc_prf::PrfValue;
8080

@@ -110,17 +110,13 @@ impl MaybeEmpty for Identifier {
110110
self.t.is_empty() || self.c.is_empty()
111111
}
112112
}
113-
impl<'a> IntoAad<'a> for Identifier {
114-
fn into_aad(self) -> Aad<'a> {
115-
(self.t, self.c).into_aad()
116-
}
117-
fn into_aad_piece(self) -> AadPiece<'a> {
118-
(self.t, self.c).into_aad_piece()
119-
}
120-
}
121-
impl<'a> IntoPrfContext<'a> for Identifier {
122-
fn into_prf_context(self) -> PrfContext<'a> {
123-
(self.t, self.c).into_prf_context()
113+
// One context view serves both derivations: vitaminc's `IntoAad` and
114+
// `IntoPrfContext` are blankets over `IntoContext`, so the ciphertext AAD, the
115+
// ZeroKMS descriptor and the equality term's PRF context all see the same
116+
// (table, column) pair.
117+
impl<'a> IntoContext<'a> for Identifier {
118+
fn into_context(self) -> ContextPiece<'a> {
119+
(self.t, self.c).into_context()
124120
}
125121
}
126122

@@ -154,11 +150,11 @@ impl Reader for Ciphertext {
154150

155151
impl<S: Encrypt + Clone> EncryptFrom<S> for Ciphertext {
156152
type Context = AeadContext;
157-
fn encryption<'s, K: 'static>(context: Self::Context) -> Encryption<'s, S, Self, K>
153+
fn encryption<'s, K: 'static>() -> Encryption<'s, S, Self, K, Self::Context>
158154
where
159155
S: 's,
160156
{
161-
target::ciphertext(context).transcode()
157+
target::ciphertext().transcode()
162158
}
163159
}
164160

@@ -208,11 +204,11 @@ impl Transcode for Hmac256 {
208204
}
209205
impl<S: PrfValue + Clone> EncryptFrom<S> for Hmac256 {
210206
type Context = CallerContext;
211-
fn encryption<'s, K: 'static>(context: Self::Context) -> Encryption<'s, S, Self, K>
207+
fn encryption<'s, K: 'static>() -> Encryption<'s, S, Self, K, Self::Context>
212208
where
213209
S: 's,
214210
{
215-
target::equality(context).transcode()
211+
target::equality().transcode()
216212
}
217213
}
218214
impl Decryptable for Hmac256 {

‎packages/eql/tasks/dev/with-stack-encrypt.sh‎

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)