Repository navigation
Commit c71dcd8
committed
refactor(eql): rebuild the v4 migration codec on Stack Encrypt's typed API
The codec went through `eql_bindings::encryption::targets`, the by-name
dispatch for bindings that have no Rust type to name. That made it carry a
plaintext-kind table, `ValueFrame` conversions, index-key parsing and
`Pending::all` over raw bytes. A Rust program can name the types, and with
#1587 (owned `EncryptTarget`/`DecryptSource` on every v4 type) and #1588
(`Encryption::context_from`) now on `next`, it uses the path a Rust
application migrating its own data would.
A legacy value decrypts with its column. One generic `Shim<T>` encrypts it
as any v4 type, stored or query, under that column, through
`context_from`. Each item's `type` is read into a serde enum, which also
types the plaintext, so a plaintext of the wrong kind and an unknown type
are refused while the request is read, before any key is requested.
serde's own message for a wrong kind quotes the value, so only messages
that name nothing but fields and types are passed on.
Each list is still one ZeroKMS call, whatever mix of types it holds,
because every item maps to a `Pending<Value>` and `Pending::all` merges
them. The wire format is unchanged, so `tests/v4-codec.ts` and both
migration suites need no change beyond comments.
The tests now cover a mixed-type batch (one generate, one retrieve, order
kept), a query operand matching its stored value, a payload read under
another column, and a payload from another producer refused by name, as
the suites' relabel tests expect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Q6HAQrFBLJvRQ1y1xmsxv1 parent 1bcbdd6 commit c71dcd8
2 files changed
Lines changed: 478 additions & 312 deletions
File tree
- languages/typescript/packages/protect-ffi/integration-tests/tests
- packages/eql/tests/encryption/examples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
0 commit comments