Skip to content

Commit 3874bbf

Browse files
committed
fix: Use updated eql_v1_encrypted column type
1 parent e06e751 commit 3874bbf

7 files changed

Lines changed: 18 additions & 28 deletions

File tree

docs/errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ For example:
314314

315315
## Unknown Column <a id='encrypt-unknown-column'></a>
316316

317-
The column has an encrypted type (PostgreSQL `cs_encrypted_v1` type ) with no encryption configuration.
317+
The column has an encrypted type (PostgreSQL `eql_v1_encrypted` type ) with no encryption configuration.
318318

319319
Without the configuration, Cipherstash Proxy does not know how to encrypt the column.
320320
Any data is unprotected and unencrypted.
@@ -341,7 +341,7 @@ Column 'column_name' in table 'table_name' has no Encrypt configuration
341341

342342
## Unknown Table <a id='encrypt-unknown-table'></a>
343343

344-
The table has one or more encrypted columns (PostgreSQL `cs_encrypted_v1` type ) with no encryption configuration.
344+
The table has one or more encrypted columns (PostgreSQL `eql_v1_encrypted` type ) with no encryption configuration.
345345

346346
Without the configuration, Cipherstash Proxy does not know how to encrypt the column.
347347
Any data is unprotected and unencrypted.

docs/getting-started/schema-example.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ TRUNCATE TABLE public.eql_v1_configuration;
44
DROP TABLE IF EXISTS users;
55
CREATE TABLE users (
66
id SERIAL PRIMARY KEY,
7-
encrypted_email cs_encrypted_v1,
8-
encrypted_dob cs_encrypted_v1,
9-
encrypted_salary cs_encrypted_v1
7+
encrypted_email eql_v1_encrypted,
8+
encrypted_dob eql_v1_encrypted,
9+
encrypted_salary eql_v1_encrypted
1010
);
1111

1212
SELECT cs_add_index_v1(

docs/how-to.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,22 @@ This will output the version of EQL installed.
162162

163163
In your existing PostgreSQL database, you store your data in tables and columns.
164164
Those columns have types like `integer`, `text`, `timestamp`, and `boolean`.
165-
When storing encrypted data in PostgreSQL with Proxy, you use a special column type called `cs_encrypted_v1`, which is [provided by EQL](#setting-up-the-database-schema).
166-
`cs_encrypted_v1` is a container column type that can be used for any type of encrypted data you want to store or search, whether they are numbers (`int`, `small_int`, `big_int`), text (`text`), dates and times (`date`), or booleans (`boolean`).
165+
When storing encrypted data in PostgreSQL with Proxy, you use a special column type called `eql_v1_encrypted`, which is [provided by EQL](#setting-up-the-database-schema).
166+
`eql_v1_encrypted` is a container column type that can be used for any type of encrypted data you want to store or search, whether they are numbers (`int`, `small_int`, `big_int`), text (`text`), dates and times (`date`), or booleans (`boolean`).
167167

168168
Create a table with an encrypted column for `email`:
169169

170170
```sql
171171
CREATE TABLE users (
172172
id SERIAL PRIMARY KEY,
173-
email cs_encrypted_v1
173+
email eql_v1_encrypted
174174
)
175175
```
176176

177177
This creates a `users` table with two columns:
178178

179179
- `id`, an autoincrementing integer column that is the primary key for the record
180-
- `email`, a `cs_encrypted_v1` column
180+
- `email`, a `eql_v1_encrypted` column
181181

182182
There are important differences between the plaintext columns you've traditionally used in PostgreSQL and encrypted columns with CipherStash Proxy:
183183

mise.toml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ cp -v {{config_root}}/target/{{ target }}/release/cipherstash-proxy {{config_roo
567567
"""
568568

569569
[tasks."build:docker"]
570-
depends = ["build:docker:fetch_eql"]
570+
depends = ["postgres:eql:download"]
571571
description = "Build a Docker image for cipherstash-proxy"
572572
run = """
573573
{% set default_platform = "linux/" ~ arch() | replace(from="x86_64", to="amd64") %}
@@ -580,16 +580,6 @@ docker build . \
580580
--platform {{option(name="platform",default=default_platform)}} \
581581
"""
582582

583-
[tasks."build:docker:fetch_eql"]
584-
description = "Fetch the EQL installation script"
585-
run = """
586-
if [ ! -e "cipherstash-eql.sql" ]; then
587-
echo "Fetching: cipherstash-eql.sql"
588-
curl -sLo cipherstash-eql.sql https://github.com/cipherstash/encrypt-query-language/releases/download/${CS_EQL_VERSION}/cipherstash-encrypt.sql
589-
else
590-
echo "Prefetched: cipherstash-eql.sql"
591-
fi
592-
"""
593583

594584
[tasks.release]
595585
description = "Publish release artifacts"

packages/cipherstash-proxy-integration/src/extended_protocol_error_messages.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ mod tests {
6767
let msg = err.to_string();
6868

6969
// This is similar to below. The error message comes from tokio-postgres when Proxy
70-
// returns cs_encrypted_v1 and the client cannot convert to a string.
70+
// returns eql_v1_encrypted and the client cannot convert to a string.
7171
// If mapping errors are enabled (enable_mapping_errors or CS_DEVELOPMENT__ENABLE_MAPPING_ERRORS),
7272
// then Proxy will return an error that says "Column X in table Y has no Encrypt configuration"
73-
assert_eq!(msg, "error serializing parameter 1: cannot convert between the Rust type `&str` and the Postgres type `cs_encrypted_v1`");
73+
assert_eq!(msg, "error serializing parameter 1: cannot convert between the Rust type `&str` and the Postgres type `eql_v1_encrypted`");
7474
} else {
7575
unreachable!();
7676
}

packages/cipherstash-proxy/src/encrypt/schema/manager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ pub async fn load_schema(config: &DatabaseConfig) -> Result<Schema, Error> {
143143
let ident = Ident::with_quote('"', col);
144144

145145
let column = match domain.as_deref() {
146-
Some("cs_encrypted_v1") => {
147-
debug!(target: SCHEMA, msg = "cs_encrypted_v1 column", table = table_name, column = col);
146+
Some("eql_v1_encrypted") => {
147+
debug!(target: SCHEMA, msg = "eql_v1_encrypted column", table = table_name, column = col);
148148
Column::eql(ident)
149149
}
150150
_ => Column::native(ident),

packages/cipherstash-proxy/src/postgresql/messages/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ impl Parse {
2424
}
2525

2626
///
27-
/// Encrypted columns are the cs_encrypted_v1 Domain Type
28-
/// cs_encrypted_v1 wraps JSONB
27+
/// Encrypted columns are the eql_v1_encrypted Domain Type
28+
/// eql_v1_encrypted wraps JSONB
2929
///
30-
/// Using JSONB to avoid the complexity of loading the OID of cs_encrypted_v1
31-
/// PostgreSQL will coerce JSONB to cs_encrypted_v1 if it passes the constaint check
30+
/// Using JSONB to avoid the complexity of loading the OID of eql_v1_encrypted
31+
/// PostgreSQL will coerce JSONB to eql_v1_encrypted if it passes the constaint check
3232
///
3333
pub fn rewrite_param_types(&mut self, columns: &[Option<Column>]) {
3434
for (idx, col) in columns.iter().enumerate() {

0 commit comments

Comments
 (0)