Skip to content

Commit ff2beb7

Browse files
authored
Merge pull request #233 from cipherstash/chore/proxy-eql-v2-integration-clippy
fixes for rust 1.87 clippy lints
2 parents fa7bbec + 1b36011 commit ff2beb7

29 files changed

Lines changed: 129 additions & 137 deletions

docs/errors.md

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

319319
## Unknown Column <a id='encrypt-unknown-column'></a>
320320

321-
The column has an encrypted type (PostgreSQL `eql_v1_encrypted` type ) with no encryption configuration.
321+
The column has an encrypted type (PostgreSQL `eql_v2_encrypted` type ) with no encryption configuration.
322322

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

346346
## Unknown Table <a id='encrypt-unknown-table'></a>
347347

348-
The table has one or more encrypted columns (PostgreSQL `eql_v1_encrypted` type ) with no encryption configuration.
348+
The table has one or more encrypted columns (PostgreSQL `eql_v2_encrypted` type ) with no encryption configuration.
349349

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

docs/getting-started/schema-example.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
TRUNCATE TABLE public.eql_v1_configuration;
1+
TRUNCATE TABLE public.eql_v2_configuration;
22

33
-- Exciting cipherstash table
44
DROP TABLE IF EXISTS users;
55
CREATE TABLE users (
66
id SERIAL PRIMARY KEY,
7-
encrypted_email eql_v1_encrypted,
8-
encrypted_dob eql_v1_encrypted,
9-
encrypted_salary eql_v1_encrypted
7+
encrypted_email eql_v2_encrypted,
8+
encrypted_dob eql_v2_encrypted,
9+
encrypted_salary eql_v2_encrypted
1010
);
1111

1212
SELECT cs_add_index_v1(

docs/how-to.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ You can also install EQL by running [the installation script](https://github.com
153153
Once you have installed EQL, you can see what version is installed by querying the database:
154154

155155
```sql
156-
SELECT eql_v1.version();
156+
SELECT eql_v2.version();
157157
```
158158

159159
This will output the version of EQL installed.
@@ -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 `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`. `timestamp`), or booleans (`boolean`).
165+
When storing encrypted data in PostgreSQL with Proxy, you use a special column type called `eql_v2_encrypted`, which is [provided by EQL](#setting-up-the-database-schema).
166+
`eql_v2_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`. `timestamp`), 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 eql_v1_encrypted
173+
email eql_v2_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 `eql_v1_encrypted` column
180+
- `email`, a `eql_v2_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

packages/cipherstash-proxy/src/connect/async_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use x509_parser::prelude::{FromDer, X509Certificate};
2323
#[derive(Debug)]
2424
pub enum AsyncStream {
2525
Tcp(TcpStream),
26-
Tls(TlsStream<TcpStream>),
26+
Tls(Box<TlsStream<TcpStream>>),
2727
}
2828

2929
impl AsyncStream {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,5 @@ pub async fn load_encrypt_config(config: &DatabaseConfig) -> Result<EncryptConfi
197197
}
198198
fn configuration_table_not_found(e: &tokio_postgres::Error) -> bool {
199199
let msg = e.to_string();
200-
msg.contains("eql_v1_configuration") && msg.contains("does not exist")
200+
msg.contains("eql_v2_configuration") && msg.contains("does not exist")
201201
}

packages/cipherstash-proxy/src/encrypt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl Encrypt {
5858
let eql_version = {
5959
let client = connect::database(&config.database).await?;
6060
let rows = client
61-
.query("SELECT eql_v1.version() AS version;", &[])
61+
.query("SELECT eql_v2.version() AS version;", &[])
6262
.await;
6363

6464
match rows {

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

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

144144
let column = match column_type_name.as_deref() {
145-
Some("eql_v1_encrypted") => {
146-
debug!(target: SCHEMA, msg = "eql_v1_encrypted column", table = table_name, column = col);
145+
Some("eql_v2_encrypted") => {
146+
debug!(target: SCHEMA, msg = "eql_v2_encrypted column", table = table_name, column = col);
147147
Column::eql(ident)
148148
}
149149
_ => Column::native(ident),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SELECT data FROM public.eql_v1_configuration WHERE state = 'active' LIMIT 1;
1+
SELECT data FROM public.eql_v2_configuration WHERE state = 'active' LIMIT 1;

packages/cipherstash-proxy/src/postgresql/handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub async fn handler(
8484
AsyncStream::Tcp(stream) => {
8585
// The Client is connecting to our Server
8686
let tls_stream = tls::server(stream, tls).await?;
87-
client_stream = AsyncStream::Tls(tls_stream);
87+
client_stream = AsyncStream::Tls(Box::new(tls_stream));
8888
}
8989
AsyncStream::Tls(_) => {
9090
unreachable!();

packages/cipherstash-proxy/src/postgresql/messages/authentication/auth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ impl Authentication {
5656

5757
pub fn is_scram_sha_256_plus(&self) -> bool {
5858
match self.method {
59-
AuthenticationMethod::Sasl { ref mechanisms } => mechanisms
60-
.iter()
61-
.any(|m| *m == SaslMechanism::ScramSha256Plus),
59+
AuthenticationMethod::Sasl { ref mechanisms } => {
60+
mechanisms.contains(&SaslMechanism::ScramSha256Plus)
61+
}
6262
_ => false,
6363
}
6464
}

0 commit comments

Comments
 (0)