Supabase and PostgresNetwork access and auditreference
CipherStash on Supabase: EQL grants, the supabase-js wrapper and ZeroKMS
What CipherStash’s Encrypt Query Language (EQL) and its key service, ZeroKMS, need from a Supabase project, what the supabase-js wrapper does with them under RLS (row-level security), what it costs per request, and where it fits next to client-side encryption of large objects in Storage. For anyone adding field-level encryption to a Supabase schema, or deciding which part of a customer-held-key design CipherStash can carry.
Everything marked measured comes from the cipherstash-eql experiment in supabase-lab, run on 2026-10-19 in two parts:
- CE01-CE05, without ZeroKMS, on two targets: a local Docker rig (
supabase/postgres:17.11.0.004, whosepostgresrole is not a superuser, andpostgrest/postgrest:v14.17), and one managed Pro-org micro project inap-southeast-1, created and deleted by the run script, with SQL (Structured Query Language) over the direct connection and requests through the project’s API (application programming interface) gateway. Every CE01-CE05 value matched between the two targets apart from plan costs and the length of one encoded URL (Uniform Resource Locator); where this page gives one figure it holds for both. The ciphertext is real EQL v3, produced by CipherStash’s own Rust engine (stack-encrypt, cipherstash/stack commit66092fe) over an in-memory test key source (FakeDataKeySource), so no CipherStash account and no ZeroKMS took part. - ZK01-ZK07, with ZeroKMS, through CipherStash’s TypeScript SDK (software development kit) (
@cipherstash/stack1.2.1) and its supabase-js wrapper (@cipherstash/stack-supabase1.2.1,encryptedSupabase), authenticated by the CipherStash CLI (command-line interface)‘s device session against a workspace inap-southeast-2(Sydney), on two managed Pro-org micro projects inap-southeast-1(run 1 and run 2, one each, deleted), plus a follow-up (ZK06b, ZK07b) on run 1’s project after its issuer was registered by hand in the CipherStash workspace dashboard. The vantage is one laptop in Singapore.
Each check ran once per run (n = 1 per target for CE, two runs for ZK); results and the run notes are in the RUNLOG. Statements cited to CipherStash or Supabase documentation were not run, and source-read means read from code, not measured.
TL;DR:
- EQL 3.0.6 installed from its release SQL as
postgres(superuser=false, psql exit 0) on the local rig and on managed. The installer skipped the ORE (order-revealing encryption) operator class, which needs a superuser, and reported 20 ORE-backed domains disabled; the equality domain worked. - The installer grants nothing, per its permissions doc,1 and both EQL schemas had no privileges for other roles after the install. With an EQL functional index on a table,
authenticatedwithout the EQL grants failed even plaintext-only SELECTs on that table in a fresh connection:permission denied for schema eql_v3_internal, contextSQL function "eq_term" during inlining. Granting USAGE oneql_v3andeql_v3_internalplus EXECUTE on all their functions fixed it. The same plaintext reads succeeded without any grant in a connection wherepostgreshad planned against the table first, so a grant check in a reused connection can pass while fresh connections fail. - Through PostgREST, equality works with a full stored envelope as the
eq.operand, and RLS still scoped rows per owner (A[1], B[3]); the term-only query envelope failed the column’s domain check (400,23514). - With ZeroKMS keys, the wrapper’s equality,
in,neq, range and ordering filters ontext_eq,text_ord,integer_ordanddate_ordcolumns matched the expected plaintext result in 19 of 19 checks per run (9 with an encrypted operand), under RLS on managed. Unsupported combinations are refused in the client in 2 ms or less, too fast for a network request. - Every encrypt or decrypt is a round trip to ZeroKMS (inferred from latency; requests not counted): p50 255-269 ms per operation from Singapore to Sydney. A wrapper select with an encrypted filter took p50 554-562 ms against 43-47 ms for the same plain supabase-js select; a one-row wrapper insert 297-312 ms against 44 ms.
- With ZeroKMS unreachable, every encrypted read and write failed, a value encrypted just before the outage included: within milliseconds when refused, after 10.0 s when black-holed. Plaintext columns, Postgres and PostgREST kept working, and the client recovered on its own.
- The managed API gateway’s
edge_logskeep the encrypted filter operand of each logged request (ciphertext, equality or ordering term, identifier) for GET, PATCH and DELETE;postgres_logsheld none. - Federated encrypt and decrypt worked with each user’s Supabase access token, and the lock context bound a value to its user: a second user’s federated decrypt was refused (
Forbidden). CipherStash’s docs say lock context needs a Business or Enterprise plan; it worked on this newly created workspace, whose plan was not read. - The installer created 52 EQL domains in 11 families, none of them binary, and CipherStash’s docs say it does not replace object encryption, so large objects stay with client-side encryption in Storage. EQL covers the catalogue fields and a ciphertext copy of each object’s data key.
Topology
Section titled “Topology”- The application encrypts each value, and each query operand, before it leaves; CipherStash’s docs describe ZeroKMS returning a key seed that only the application’s client key turns into a data key.2 In CE the in-memory test key source stands in for both halves; in ZK the SDK reached ZeroKMS at
ap-southeast-2.aws.viturhosted.netand the token service atap-southeast-2.aws.cts.cipherstashmanaged.net(proxy log, both runs). - The request passes the project’s API gateway, which logs it, including the query string, then PostgREST runs it as the caller’s role, so that role needs the EQL schema grants, and RLS applies as usual.
- Postgres stores EQL payloads (JSON (JavaScript Object Notation) with ciphertext and index terms) in EQL domains and compares index terms, never plaintext. The wrapper decrypts the returned rows, another ZeroKMS round trip.
Which do I pick
Section titled “Which do I pick”| You need | Use | Why |
|---|---|---|
| Encrypted columns that stay searchable by equality | An _eq EQL domain plus a functional index on eql_v3.eq_term(col) | Equality over SQL and PostgREST returned A [1], B [3] (CE03); EXPLAIN can use the index (CE05); eq, in, neq through the wrapper matched plaintext (ZK02) |
| Ordering or ranges on Supabase | _ord or _ord_ope domains (both OPE),3 not _ord_ore | The installer disabled 20 ORE-backed domains without a superuser; gte/lt/gt and order on integer_ord, text_ord and date_ord matched plaintext through the wrapper (ZK02) |
| Equality through PostgREST or supabase-js | The encryptedSupabase wrapper, which sends a full stored envelope as the filter operand | The term-only query envelope failed the domain check, 400 23514 (CE03); the wrapper’s operands matched plaintext in all 9 cases with an encrypted operand, per run (ZK02)4 |
| A per-object data key stored with the catalogue row | A storage-only eql_v3_text column | One 32-byte key round-tripped through PostgREST with the test key source (CE04) and through the wrapper under ZeroKMS keys (ZK03) |
| Decryption bound to the signed-in user | Federation (OidcFederationStrategy) plus a lock context on the user’s sub | A second user’s valid federated session could not decrypt the locked value (ZK07b); the docs list a Business or Enterprise plan for lock context5 |
| Many values encrypted at once | Bulk calls or multi-row inserts; per CipherStash’s docs a bulk call makes one ZeroKMS call6 | 500 values encrypted in one call in 581 and 1066 ms (run 2, run 1), against 257-269 ms p50 for one value (ZK04; requests not counted) |
| The large objects themselves encrypted under your key | Client-side chunked encryption in Storage, as in one envelope-encrypted app | None of the 11 installed domain families is binary; CipherStash’s docs say it does not replace object encryption7 |
Install as the non-superuser role
Section titled “Install as the non-superuser role”The release ships one SQL file, cipherstash-encrypt.sql, and there is no separate Supabase build;8 it needs pgcrypto in extensions or public and a superuser only for the optional block-ORE operator class.1 On the local rig and on the three managed projects (CE, ZK run 1, ZK run 2), psql as postgres installed 3.0.6 with exit 0. On the local rig and the CE managed project, where the install record holds more than the version and exit status, pgcrypto was already in extensions and the installer created 52 EQL domains in public, in 11 families: bigint, boolean, date, double, integer, json, numeric, real, smallint, text, timestamp.
The installer printed two notices (install-notices.txt): it skipped eql_v3_internal.ore_block_256_operator_class (“requires superuser”) and reported “20 ORE-backed domains disabled and will raise on use”, pointing to the _ord_ope (ordering) and _eq (equality) domains, with OPE (order-preserving encryption) ordering domains unaffected. The disabled ORE domains were not exercised; the _ord (OPE) domains were, in ZK02.
CipherStash’s stash init --supabase installs EQL with the grants Supabase’s anon, authenticated and service_role roles need, per its quickstart;9 this rig used the raw SQL file, which grants nothing (eql_schema_acl null on both schemas after the install), to see what the grants do. The ZK schema then applied those grants itself. With EQL installed that way, the CipherStash dashboard’s readiness check for run 1’s project showed “EQL installed” and “Encrypted columns detected” as not done, while eql_v3.version() returned 3.0.6 and the tables held six encrypted columns; the dashboard suggests stash db install --supabase --migration instead (observed in the dashboard during the follow-up, screenshot not archived, cause not checked).
The grants, and what fails without them
Section titled “The grants, and what fails without them”The installer issues no GRANT, per CipherStash’s permissions page, which lists the opt-in grants: USAGE on eql_v3 and eql_v3_internal, EXECUTE on all functions in both, USAGE on extensions.1 CE03 applied the first four, not USAGE on extensions. Every SQL check below ran in its own new connection as authenticated. The first result column is the installer’s state with the EQL functional index on app.assets (CE02), the second the same with the index dropped inside a rolled-back transaction (CE02), the third after the four grants (CE03):
Query as authenticated | No grants | No grants, index dropped | After four grants |
|---|---|---|---|
| Equality on the encrypted column | permission denied for schema eql_v3 | not run | A [1], B [3] |
SELECT count(*) (plaintext only) | permission denied for schema eql_v3_internal | 2 | 2 |
... WHERE id = 1 (plaintext only) | permission denied for schema eql_v3_internal | 1 | 1 |
... ORDER BY id (plaintext only) | permission denied for schema eql_v3_internal | 2 | 2 |
PostgREST select=id&order=id | 403 42501 permission denied for schema eql_v3_internal | not run | [1, 2] |
The plaintext failures carry the context SQL function "eq_term" during inlining. The planner inlines the index expression eql_v3.eq_term, whose body calls eql_v3_internal.hmac_256, and the permission check on that schema fails while the query is planned, before any column is read (EQL 3.0.6 SQL, source-read). A role that can SELECT the table and holds no EQL grant, eql_probe_reader, failed the same three plaintext queries the same way after authenticated had its grants (CE03). By that mechanism anon, service_role or a reporting role would fail the same way without the grants; those roles, and writes, were not run without grants.
Equality through PostgREST under RLS
Section titled “Equality through PostgREST under RLS”The CE catalogue was app.assets (id, owner uuid, subject_ref eql_v3_text_eq, wrapped_dek eql_v3_text) with RLS owner = auth.uid() for authenticated. Owner A held rows 1 (S-001) and 2 (S-002), owner B rows 3 (S-001) and 4 (S-003). After the grants (CE03):
| Request | Result |
|---|---|
SQL, subject_ref = <term-only query envelope>::eql_v3.query_text_eq, as A / as B | [1] / [3] |
PostgREST subject_ref=eq.<freshly encrypted full stored envelope of S-001>, as A / as B | [1] (200) / [3] (200) |
PostgREST subject_ref=eq.<term-only query envelope>, as A | 400 23514 value for domain eql_v3_text_eq violates check constraint "eql_v3_text_eq_check" |
| PostgREST unfiltered, as A | [1, 2] (200) |
The term-only query envelope was 116 bytes, the full stored envelope 275 bytes, and the percent-encoded PostgREST path and query string carrying it 427 bytes on the local rig and 429 on managed (419 to 435 in earlier, unarchived local runs on 2026-10-19, as the ciphertext changes). CipherStash’s supabase-js guide describes the same constraint (“PostgREST cannot cast a term-only query envelope”) and asks for application and proxy logs not to keep query strings, since the operand carries ciphertext and every index term for the value.4 On the local rig, PostgREST 14.17 at its default log level wrote one request line in the final run, the rig’s start-up check (GET /, 503), and none for the 200, 400 or 403 responses; in an earlier, unarchived run the same day it logged requests carrying the operand, full query string included, when it answered them 503 (schema cache not loaded). On managed, the gateway’s edge_logs keep the operand: see what the gateway logs keep.
The guide, written for EQL 3.0.4 (the rig ran 3.0.6), also lists what the wrapper cannot do through PostgREST: encrypted free-text and encrypted JSON queries, and .csv().4 .csv() was refused in ZK02; free text and encrypted JSON were not run.
A data key in an encrypted column
Section titled “A data key in an encrypted column”Each CE row’s wrapped_dek held a 32-byte key read from /dev/urandom, base64, encrypted as a storage-only eql_v3_text. The 4 rows were inserted over SQL as postgres; the stored column text contained none of the four keys (base64 form) and none of the subject references (CE01), and row 1 as PostgREST returned it to A decrypted to the original key, 32 bytes, and to S-001 (CE04). stack-encrypt at commit 66092fe derives no EncryptFrom for the storage-only domain, so the probe sealed natively and wrapped the payload, as CipherStash’s own tests do for the equality domain (source-read).
Under ZeroKMS keys the same shape held through the wrapper (ZK03, both runs): a 32-byte key inserted into wrapped_dek came back intact, and Postgres held only a payload with keys c, i, v, without the key. With ZeroKMS each value gets its own derived data key, the client key stays with the application and ZeroKMS holds the authority key, per CipherStash’s docs;2 in ZK the client key was the CLI’s device session on this laptop. ZeroKMS as the key service of the envelope-encrypted app, in its upload and ranged-read paths, was not run.
With ZeroKMS: the wrapper on managed
Section titled “With ZeroKMS: the wrapper on managed”The ZK schema put the tables in public, which encryptedSupabase introspects: public.records (id, owner uuid default auth.uid(), subject eql_v3_text_eq, label eql_v3_text_ord, score eql_v3_integer_ord, seen eql_v3_date_ord, wrapped_dek eql_v3_text, note text), with functional indexes, RLS owner = auth.uid() for select, insert, update and delete, and the EQL grants to anon, authenticated and service_role. User A inserted 6 rows and user B 3, one wrapper call each (714 and 413 ms in run 1, 615 and 390 ms in run 2).
What Postgres stores (ZK01)
Section titled “What Postgres stores (ZK01)”Read as postgres, bypassing RLS: 9 rows (A 6, B 3), no plaintext value of any encrypted column in the stored text. Payload keys per domain, the same in both runs:
| Domain | Stored keys | What the extra keys are |
|---|---|---|
eql_v3_text_eq | c, hm, i, v | hm: equality term |
eql_v3_text_ord | c, hm, i, op, v | hm and op: equality and ordering terms |
eql_v3_integer_ord, eql_v3_date_ord | c, i, op, v | op: ordering term |
eql_v3_text | c, i, v | none: storage only |
i names the table and column ({"t":"records","c":"subject"}). The three rows with subject S-001 (two of A’s, one of B’s) carried the same hm and different c: equal values are linkable by their equality term across users, while the ciphertext differs, which is the searchable-encryption trade-off CipherStash documents.4
Filters, ranges and ordering under RLS (ZK02)
Section titled “Filters, ranges and ordering under RLS (ZK02)”Each case ran through the wrapper, as A unless marked, and was compared with the same filter applied in the probe to the plaintext rows it inserted; all 19 checks (18 reads plus the update below) matched in both runs:
| Case | Domains |
|---|---|
select all as A, as B (RLS: 6 rows, 3 rows); all six decrypted values equal what A inserted (score a number, seen a Date) | all |
eq as A and as B, in, neq on subject | text_eq |
gte and lt on score; eq on score | integer_ord |
gt on label | text_ord |
gte on seen | date_ord |
order ascending and descending on score, ascending on label, descending on seen; order plus range(0,1) | OPE domains |
an encrypted and a plaintext filter together; is(subject, null); a plaintext-only select | mixed |
Through the wrapper, A updated a row’s score and label and read back 11 and alpha2; B deleted its own row by an encrypted filter (["b2"]); B’s update filtered on a subject only A held changed 0 rows. Queries with an encrypted filter operand that selected only the plaintext note (so no decrypt) took 282-371 ms; orderings that selected only a plaintext column took 33-85 ms.
Refused by the wrapper in 2 ms or less, too fast for a network request (.csv() threw and was not timed):
| Request | Message |
|---|---|
eq on wrapped_dek (eql_v3_text) | “does not support equality queries” |
order on subject (eql_v3_text_eq) | “cannot order by encrypted column … it carries no ordering term to sort by” |
gt on subject (eql_v3_text_eq) | “does not support orderAndRange queries” |
.csv() | “unavailable on encrypted queries because PostgREST serializes rows before the adapter can decrypt them” |
What each ZeroKMS round trip costs
Section titled “What each ZeroKMS round trip costs”ZK04, ms, one laptop in Singapore, ZeroKMS in Sydney, the project in Singapore. SDK single operations n = 20 per run; wrapper and plain supabase-js n = 10 per run, one row, same user and project. p95 is the largest of the n samples:
| Measurement | Run 1 p50 / p95 | Run 2 p50 / p95 |
|---|---|---|
| SDK encrypt, one value | 257 / 321 | 269 / 335 |
| SDK decrypt, one value | 255 / 358 | 269 / 359 |
Wrapper insert, one row with one text_eq column | 312 / 419 | 297 / 313 |
| supabase-js insert, plaintext table | 44 / 93 | 44 / 96 |
Wrapper select with an encrypted eq filter | 562 / 580 | 554 / 620 |
supabase-js select with a plaintext eq filter | 43 / 82 | 47 / 83 |
Bulk calls, one call per size per run, encrypt / decrypt ms:
| Values | Run 1 | Run 2 |
|---|---|---|
| 10 | 261 / 359 | 273 / 272 |
| 100 | 766 / 2918 | 896 / 280 |
| 500 | 1066 / 813 | 581 / 312 |
Client initialisation (Encryption()) took 773 and 1056 ms; the wrapper’s (encryptedSupabase(), database introspection included) 1521 and 1286 ms.
The wrapper select is about one encrypt (the operand) plus one decrypt (the rows) on top of the plain request, which fits the per-operation figures. The 2918 ms bulk decrypt in run 1 did not recur in run 2 (280 ms); with one call per size per run it is reported as observed. The distances dominate these numbers (reasoned, not varied): Singapore to Sydney for ZeroKMS, Singapore to Singapore for the project. A ZeroKMS region next to the application, another vantage and concurrency were not run; the docs list seven ZeroKMS regions, the nearest to ap-southeast-1 being Sydney.12
When ZeroKMS is unreachable
Section titled “When ZeroKMS is unreachable”ZK05 sent the SDK’s traffic through a local proxy (HTTPS_PROXY), with the Supabase hosts excluded (NO_PROXY; the proxy logged no Supabase host), and switched it after the wrapper and SDK had initialised and served a query. Time to result, ms, run 1 / run 2:
| Operation | Refused | Black-holed | Result |
|---|---|---|---|
| Wrapper insert | 2 / 5 | 10005 / 10003 | EncryptionError “ZeroKMS error ‘Unexpected error (SendRequest: Failed to send request)’” |
| Wrapper select of encrypted columns | 63 / 47 | 10047 / 10059 | DecryptionError “Failed to retrieve key” |
| Wrapper select, plaintext columns only | 39 / 47 | 60 / 55 | 7 rows, no error |
Wrapper select with an encrypted eq filter | 2 / 4 | 10003 / 10004 | EncryptionError |
| SDK decrypt of a value encrypted before the outage | 2 / 3 | 10003 / 10004 | DecryptionError |
| supabase-js select of the same table | 37 / 40 | 46 / 58 | 7 rows, no error |
After the proxy passed traffic again, the first wrapper query succeeded in 903 and 838 ms with no re-initialisation. Nothing encrypted could be read or written during the outage, including a value the SDK encrypted just before it and the rows inserted in ZK01, so no cached key served these calls (SDK source not read); CipherStash’s docs say the same of an outage.13 A black-holed connection failed after 10.0 s per operation in every case, which fits a 10 s request timeout in the client (not source-read). Postgres, PostgREST and plaintext columns were unaffected.
What the gateway logs keep
Section titled “What the gateway logs keep”The wrapper sends each encrypted filter operand in the query string; ZK06 then read the project’s logs through the Management API logs endpoint. The S-001 equality GET carried a 250-byte operand (keys c, hm, i, v) in a 478 / 466-byte URL. edge_logs rows carrying its hm slice: 2 / 3, each with the query string in request.search (the row read: 421 / 410 characters). In run 2 the decoded operand’s c and hm equal the ones sent (storedOperandMatchesSent: true). In run 1 the sampled GET itself had no row, so the row read belonged to another S-001 request, whose c differs because each operand is encrypted afresh. ZK06b decoded every logged /rest/v1/records request with an eq. parameter on run 1’s project: 8 rows (GET 5, PATCH 2, DELETE 1), 6 written out. 4 of those 6 carried an encrypted operand with its full key set: subject with c (130 characters), hm (64) and i, and the equality filter on score with c (132), op and i; ZK06b recorded keys and lengths, not a comparison with what was sent. 8 of the 10 eq. requests sent to that path had a row when read; range, in and neq operands were not decoded. postgres_logs held neither operand in either run; 6 logged statements mentioned the table, and the 3 written out are DDL (data definition language) run over psql.
Federation and the lock context
Section titled “Federation and the lock context”ZK07 attempted federation before the project’s issuer was registered: OidcFederationStrategy.create returned a strategy, and creating the federated client and encrypting threw [encryption]: Server error: 401: Authorization failed: No OIDC provider found for issuer, followed by the issuer URL (both runs). Before the follow-up, https://<ref>.supabase.co/auth/v1 was registered by hand as an OIDC (OpenID Connect) provider in the CipherStash workspace dashboard; ZK07b then used two new Auth users, A and B, each with their own Supabase access token as the federated identity:
| Operation | Result |
|---|---|
| A encrypts, A decrypts | ok |
| B decrypts A’s value (no lock context) | ok |
A encrypts with { identityClaim: ["sub"] } | ok |
| A decrypts the locked value with the same context | ok |
| B decrypts the locked value | DecryptionError “Failed to retrieve key: Failed to send request: Forbidden: Request forbidden” |
That is what CipherStash’s Supabase Auth page describes: federation authenticates as the user, and the lock context makes ZeroKMS refuse another identity, enforced by ZeroKMS and not by application code.5 The same page says lock context “requires a Business or Enterprise workspace plan”; on this workspace, created the same day, it worked, and its plan was not read. Lock context cannot be used with access-key credentials, per the same page; that was not tested.
What EQL does not cover
Section titled “What EQL does not cover”The 11 domain families the installer created on the rig are integers of three sizes, numerics, two float types, dates, timestamps, text, booleans and JSON, which matches CipherStash’s core concepts page;3 the TypeScript SDK’s plaintext types are string, number, boolean, bigint, date and JSON, with no bytes type (js_plaintext.rs, source-read). CipherStash’s comparison with AWS (Amazon Web Services) KMS (key management service) states that it “does not replace disk, volume, object, or backup encryption”.7 For an object store holding large binary records under a customer-held key, the objects stay with client-side encryption in Storage, as measured on the envelope-encrypted app page; EQL can carry the searchable fields of the catalogue and a ciphertext copy of each object’s data key.
Reading the numbers
Section titled “Reading the numbers”- CE ran once per target: one local rig and one managed project, both Postgres 17.11. ZK ran twice, each time on a fresh managed micro instance in
ap-southeast-1. An older project, another region or a different compute size was not run. - The latency figures are one vantage, sequential calls, no concurrency, and ZeroKMS in a different region (Sydney) from both the laptop and the project (Singapore). They measure one sequential round trip on that path; throughput was not measured.
- The CE ciphertext came from the in-memory test key source; the ZK ciphertext from ZeroKMS. The domain and PostgREST behaviour matched across both; the grant results come only from CE, and the key handling (authorisation, outage, lock context) only from ZK.
- The plaintext-read failure depends on a functional index existing and on the connection being fresh: with the index dropped, the same reads returned 2, 1 and 2 rows before any grant (CE02). Equality on a table with EQL columns and no index was not tested.
What to do about it
Section titled “What to do about it”| Practice | Evidence | Module |
|---|---|---|
| Grant readers USAGE on both EQL schemas and EXECUTE on their functions. | Without the grants, authenticated and a SELECT-only role failed plaintext-only reads (permission denied for schema eql_v3_internal); after the grants authenticated counted 2, 1 and 2 rows. | CE02, CE03 |
| Check EQL grants from a fresh connection, not a reused one. | A connection where postgres planned first let the same reads pass before any grant. | CE02 |
Use _eq, _ord or _ord_ope domains on Supabase, not _ord_ore. | Without a superuser the installer disabled 20 ORE-backed domains; the _ord domains filtered and ordered correctly. | install, ZK02 |
Query encrypted columns through encryptedSupabase, not hand-built operands. | The term-only query envelope failed the domain check, 400 23514; the wrapper’s stored envelopes matched plaintext in all 9 cases with an encrypted operand, per run. | CE03, ZK02 |
Treat the project’s edge_logs as holding encrypted operands; limit log access. | Every logged filtered GET, PATCH and DELETE held its operand, ciphertext and terms included; 8 of the 10 eq. requests sent on run 1’s project had a row when read. | ZK06, ZK06b |
| Budget a ZeroKMS round trip per encrypted write and per filtered read. | Encrypt and decrypt p50 255-269 ms to Sydney; wrapper eq select p50 554-562 ms against 43-47 ms. | ZK04 |
| Batch encryption with multi-row inserts or bulk calls. | 6 rows in one insert took 615 and 714 ms; 500 values in one bulk call took 581 and 1066 ms to encrypt. | ZK01, ZK04 |
| Keep fields needed during a ZeroKMS outage in plaintext columns. | Encrypted reads and writes failed (10.0 s when black-holed); plaintext-only reads kept working. | ZK05 |
| Lock per-user fields with a lock context under federation. | B’s federated decrypt of A’s locked value: Forbidden; an unlocked value was readable by the other federated user. | ZK07b |
| Keep RLS predicates on plaintext ownership columns. | owner = auth.uid() scoped encrypted-column reads and writes per owner; CipherStash’s docs give the same advice.14 | CE03, ZK02 |
| Encrypt large objects client-side; use EQL for catalogue fields. | None of the 11 installed EQL domain families is binary; a 32-byte key in eql_v3_text round-tripped. | install, CE04, ZK03 |
Install GoTrue’s auth.uid() on a bare Postgres plus PostgREST test rig. | The image’s version reads only request.jwt.claim.sub; earlier, unarchived run: RLS matched no rows. | RUNLOG |
“Keep fields needed during a ZeroKMS outage in plaintext columns” and “Batch encryption” follow from the measurements and were not measured as practices; a ZeroKMS region next to the application was not run.
Not measured
Section titled “Not measured”- The self-hosted compose stack: the local rig was bare
supabase/postgresplus PostgREST. - Supavisor (session or transaction mode); the managed SQL checks used the direct connection. Through a pooler, the fresh-connection result above may not hold.
- CipherStash access-key and client-key credentials; ZK used the CLI device session only.
- A ZeroKMS region next to the project, another vantage, concurrency, and ZeroKMS cost.
- Free-text match, encrypted JSON (the Drizzle and Prisma paths), and the disabled ORE domains.
- Writes by a role without the EQL grants, and the roles
anonandservice_rolewithout grants. - How long
edge_logskeep the operands, and whether request bodies (an RPC (remote procedure call) call’s filter) are logged. - The SDK inside an Edge Function (the WebAssembly build).
Evidence, by module
Section titled “Evidence, by module”| Claim | How it was checked | Module |
|---|---|---|
Installs as postgres; grants nothing; ORE class skipped; 20 ORE domains disabled; 52 domains in 11 families | psql of the release SQL; exit status, notices, EQL schema ACLs (access control lists) and the installed domains recorded | local install.txt, install-notices.txt; managed install.txt |
| CipherStash’s own store, query, index and decrypt test passes on both databases | tests/text_eq.rs with its ignored database test, as postgres: 9 passed on each | local vendor-text_eq.txt, managed vendor-text_eq.txt |
| No plaintext in stored rows | 4 rows counted; stored column text searched for each reference and key | CE01 |
| Grants: what fails without them, a warm connection, the index | three plaintext SQL shapes per state, each in a new connection; PostgREST plaintext read | CE02, CE03 |
| PostgREST operands under RLS | stored and term-only envelopes as eq. operands, per owner | CE03 |
| Data key round trip | decrypt of the PostgREST response for row 1 | CE04 |
| Index usable | EXPLAIN as postgres, enable_seqscan = off: Bitmap Index Scan on assets_subject_ref_idx | CE05 |
| Stored shape under ZeroKMS keys | wrapper inserts as two users; stored text read as postgres and searched for every plaintext value; payload keys per domain | ZK01 |
| Filters, ranges, ordering, RLS, misuse | 18 wrapper reads and an update compared with results computed from the inserted plaintext; delete, cross-owner update; four refused requests | ZK02 |
| Data key under ZeroKMS | wrapper insert and read of a 32-byte key in eql_v3_text; stored keys | ZK03 |
| Latency | sequential SDK calls (n = 20), bulk calls, wrapper against plain supabase-js (n = 10) | ZK04 |
| Outage | local CONNECT proxy refusing, then black-holing, ZeroKMS after init | ZK05 |
| Logs | Management API logs endpoint, edge_logs and postgres_logs, operand decoded from request.search | ZK06, ZK06b |
| Federation, lock context | OidcFederationStrategy per user before and after registering the issuer; lock context on sub | ZK07, ZK07b |
The result objects are ce-local.json and ce-managed.json for CE, zk-managed-run1.json, zk-managed.json (run 2) and zk-followup-run1.json for ZK; the local PostgREST log is pgrst.log. Run 1’s own ZK06 ciphertext check (rowHasCiphertextSlice: false) compared the sent operand with a row from a different request, since the sampled GET had no row; run 2 decodes the stored query string and compares it with the request sent.
Modules
Section titled “Modules”| Module | Experiment | Test | Artifact |
|---|---|---|---|
| CE01 | cipherstash-eql | supabase_probe.rs | out/2026-10-19 |
| CE02 | cipherstash-eql | supabase_probe.rs | out/2026-10-19 |
| CE03 | cipherstash-eql | supabase_probe.rs | out/2026-10-19 |
| CE04 | cipherstash-eql | supabase_probe.rs | out/2026-10-19 |
| CE05 | cipherstash-eql | supabase_probe.rs | out/2026-10-19 |
| ZK01-ZK07 | cipherstash-eql | zk/probe.ts, zk/schema.sql, run-zk-managed.sh | out/2026-10-19-zk |
| ZK06b, ZK07b | cipherstash-eql | zk/followup.ts, run-zk-followup.sh | out/2026-10-19-zk |
| install | cipherstash-eql | run-local.sh, run-managed.sh | out/2026-10-19, out/2026-10-19-managed |
| RUNLOG | cipherstash-eql | the earlier, unarchived run, recorded in the RUNLOG only | none published |
The CE probe runs outside the lab’s test harness (pvlab), from a checkout of cipherstash/stack at commit 66092fe (the GitHub source archive of that commit); run-local.sh and run-managed.sh copy it in and write the artifacts. CE01-CE05 artifacts for managed are in out/2026-10-19-managed. The ZK probe runs with bun from zk/, pinned in zk/package.json and zk/bun.lock.
Related docs
Section titled “Related docs”- One envelope-encrypted app on managed and self-hosted Supabase - the client-side encryption of large objects and the operator key service that EQL would sit beside for the catalogue.
- Supabase Storage large objects - SSE-C (server-side encryption with customer-provided keys) headers accepted and ignored, and the Management API key surface, the reasons objects are encrypted on the client.
- Self-hosted Supabase Docker defaults in 2026 - the compose stack this rig stands in for, which runs GoTrue’s migrations.
- Supabase Auth end to end -
where the JWT (JSON Web Token) claims that
auth.uid()reads come from, and the access tokens federation hands to ZeroKMS.
References
Section titled “References”-
CipherStash, “EQL permissions & grants,” encrypt-query-language on GitHub. https://github.com/cipherstash/encrypt-query-language/blob/9f45c275c4531cabe70321018533c74b66bd1f16/docs/reference/permissions.md ↩ ↩2 ↩3
-
CipherStash, “Key management,” CipherStash Docs. https://cipherstash.com/docs/concepts/key-management ↩ ↩2
-
CipherStash, “EQL core concepts,” CipherStash Docs. https://cipherstash.com/docs/reference/eql/core-concepts ↩ ↩2
-
CipherStash, “supabase-js,” CipherStash Docs (Supabase integration). https://cipherstash.com/docs/integrations/supabase/supabase-js ↩ ↩2 ↩3 ↩4 ↩5
-
CipherStash, “Supabase Auth,” CipherStash Docs (Supabase integration). https://cipherstash.com/docs/integrations/supabase/auth ↩ ↩2
-
CipherStash, “Bulk operations,” CipherStash Docs. https://cipherstash.com/docs/stack/cipherstash/encryption/bulk-operations ↩
-
CipherStash, “CipherStash vs AWS KMS,” CipherStash Docs. https://cipherstash.com/docs/concepts/compare/aws-kms ↩ ↩2
-
CipherStash, “SUPABASE.md,” encrypt-query-language on GitHub. https://github.com/cipherstash/encrypt-query-language/blob/9f45c275c4531cabe70321018533c74b66bd1f16/SUPABASE.md ↩
-
CipherStash, “Quickstart,” CipherStash Docs (Supabase integration). https://cipherstash.com/docs/integrations/supabase/quickstart ↩
-
PostgREST, “Authentication,” PostgREST 14 documentation. https://docs.postgrest.org/en/v14/references/auth.html ↩
-
Supabase, “20220224000811_update_auth_functions.up.sql,” supabase/auth on GitHub. https://github.com/supabase/auth/blob/e062eeae0079a6b1a70d5d5da9e5ac5cb8c21194/migrations/20220224000811_update_auth_functions.up.sql ↩
-
CipherStash, “Data residency,” CipherStash Docs. https://cipherstash.com/docs/solutions/data-residency ↩
-
CipherStash, “Disaster recovery,” CipherStash Docs. https://cipherstash.com/docs/stack/cipherstash/kms/disaster-recovery ↩
-
CipherStash, “Overview,” CipherStash Docs (Supabase integration). https://cipherstash.com/docs/integrations/supabase ↩