Skip to content

Commit ba40d80

Browse files
authored
Merge pull request #473 from cipherstash/protect-ffi-0-22-0
feat: upgrade protect-ffi to 0.23.0
2 parents 4743908 + 50547b4 commit ba40d80

46 files changed

Lines changed: 15835 additions & 8256 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/protect-ffi-0-23-0.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
"@cipherstash/protect": major
3+
"@cipherstash/stack": minor
4+
"@cipherstash/schema": major
5+
"@cipherstash/protect-dynamodb": patch
6+
"@cipherstash/prisma-next": minor
7+
"stash": minor
8+
---
9+
10+
Upgrade `@cipherstash/protect-ffi` to `0.23.0` and the bundled CipherStash EQL extension to `eql-2.3.1`.
11+
12+
Breaking upstream changes adopted in this release:
13+
14+
- **Encrypt-config schema version**: `buildEncryptConfig` now emits `{ v: 1, ... }` (was `{ v: 2, ... }`). protect-ffi `0.22.0` started validating this field and rejects any value other than `1` with the new `UNSUPPORTED_CONFIG_VERSION` error code.
15+
- **Storage and query payloads are now distinct types** (protect-ffi `0.23.0`): the previously-conflated `Encrypted` type splits into `Encrypted` (storage-only, `c` required) and a new `EncryptedQuery` (search terms — scalar `unique`/`match`/`ore` lookups and `ste_vec_selector` JSON path queries; no `c`). JSON containment queries (`ste_vec_term`) still return a storage-shaped `Encrypted` payload. `encryptQuery` / `encryptQueryBulk` now return `Encrypted | EncryptedQuery`, and the stack's `EncryptedSearchTerm` / `EncryptedQueryResult` unions widen to match. `decrypt` rejects query payloads at the type level. The DynamoDB `SearchTermsOperation` narrows via `'hm' in term` rather than `term.hm`.
16+
- **SteVec encoding default flipped**: protect-ffi's default `mode` for `ste_vec` indexes changed from `compat` to `standard`. The two encodings are not cross-compatible. Existing JSON-searchable data that was indexed under `compat` will need to be re-encrypted to be queryable. The stack adopts the new `standard` default — there is no longer a way to pin `compat` from the SDK.
17+
- **EQL extension bumped to `eql-2.3.1`**: the new SteVec `standard` encoding requires matching support in the database EQL extension. The CLI's bundled SQL (`packages/cli/src/sql/*.sql`) and the `@cipherstash/prisma-next` install bundle (`migrations/20260601T0000_install_eql_bundle/ops.json` + `eql-install.generated.ts`) are updated to `eql-2.3.1`. Databases installed with an older EQL extension must be reinstalled (`stash db install`) before containment / contained-by queries against SteVec columns will work. `eql-2.3.1` ships the `_encrypted_check_c` fix for SteVec storage payloads ([cipherstash/encrypt-query-language#232](https://github.com/cipherstash/encrypt-query-language/issues/232)).
18+
- **New error codes**: `ProtectErrorCode` (re-exported from `@cipherstash/protect-ffi`) gains `MATCH_REQUIRES_TEXT` and `UNSUPPORTED_CONFIG_VERSION`. Exhaustive switches over `ProtectErrorCode` will need additional cases.
19+
- **`match` index validation**: protect-ffi now rejects `match` indexes on columns whose `cast_as` is not text-family (`'text'` / `'string'`) with `MATCH_REQUIRES_TEXT`. The stack's `freeTextSearch()` builder is unaffected because it only targets string-typed columns.
20+
- **`Encrypted` ciphertext shape**: protect-ffi's `Encrypted` type is now a discriminated union keyed on `k` (`'ct'` for scalars, `'sv'` for SteVec). SteVec storage payloads now place the root document ciphertext at `sv[0].c`. The stack's `isEncryptedPayload` runtime check continues to work because storage payloads still carry `c` (scalar) or `sv` (SteVec). The DynamoDB helpers (`toEncryptedDynamoItem`, `SearchTermsOperation`) now narrow on `k` before reading variant-only fields.
21+
- **Config-validation error message wording**: error messages for config-validation failures now come from upstream `ConfigError`. `ProtectError.code` values are preserved; consumers that string-match on `err.message` for config-validation errors must update.

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515

1616
# Postgres + EQL for the integration tests. Official EQL image —
1717
# PostgreSQL 17 with EQL pre-installed via /docker-entrypoint-initdb.d.
18-
# Pinned to eql-2.2.1 to match the EQL payload format the code emits
19-
# (protect-ffi 0.21.x); bump in lockstep with the protect-ffi upgrade.
18+
# Pinned to eql-2.3.1 to match the EQL payload format the code emits
19+
# (protect-ffi 0.23.x); bump in lockstep with the protect-ffi upgrade.
2020
services:
2121
postgres:
22-
image: ghcr.io/cipherstash/postgres-eql:17-2.2.1
22+
image: ghcr.io/cipherstash/postgres-eql:17-2.3.1
2323
env:
2424
POSTGRES_USER: cipherstash
2525
POSTGRES_PASSWORD: password

examples/prisma/migrations/cipherstash/20260601T0000_install_eql_bundle/migration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@
116116
"applied": [],
117117
"plannerVersion": "2.0.0"
118118
},
119-
"migrationHash": "sha256:9b44ccc4d0753b364e546297857dcd8dd1ea0c16d2d09579ddb3c8d0e5fc3115"
119+
"migrationHash": "sha256:76923a92561cdad65c64088ce999bf7afe853b80aac0b787b0d271b0e623abbc"
120120
}

examples/prisma/migrations/cipherstash/20260601T0000_install_eql_bundle/ops.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

local/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
postgres: &postgres
33
# PostgreSQL 17 with CipherStash EQL pre-installed (official image).
44
# Pinned by tag — bump in lockstep with the EQL version the code targets.
5-
image: ghcr.io/cipherstash/postgres-eql:17-2.2.1
5+
image: ghcr.io/cipherstash/postgres-eql:17-2.3.1
66
environment:
77
PGPORT: 5432
88
POSTGRES_DB: "cipherstash"

packages/cli/src/installer/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import pg from 'pg'
44

55
// EQL release, pinned to match the EQL payload format this package emits.
66
// Bump in lockstep with @cipherstash/protect-ffi.
7-
const EQL_VERSION = 'eql-2.2.1'
7+
const EQL_VERSION = 'eql-2.3.1'
88
const EQL_INSTALL_URL =
99
`https://github.com/cipherstash/encrypt-query-language/releases/download/${EQL_VERSION}/cipherstash-encrypt.sql`
1010
const EQL_INSTALL_NO_OPERATOR_FAMILY_URL =

0 commit comments

Comments
 (0)