Skip to content

fix(proxy): use specific EqlTraits on encrypted columns (instead of EqlTrait::all())#391

Open
freshtonic wants to merge 2 commits intomainfrom
fix/eql-traits-from-encrypt-config
Open

fix(proxy): use specific EqlTraits on encrypted columns (instead of EqlTrait::all())#391
freshtonic wants to merge 2 commits intomainfrom
fix/eql-traits-from-encrypt-config

Conversation

@freshtonic
Copy link
Copy Markdown
Contributor

Acknowledgment

By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.

…-suite

Picks up the in-flight OPE work in cipherstash-suite that hasn't been
published yet. The newer suite renames Plaintext::Utf8Str → Text and
Plaintext::JsonB → Json (same for ColumnType); this commit applies the
mechanical follow-on changes in the proxy.

Workspace builds clean and proxy unit tests (97) pass. The path
override is temporary; the workspace dep should be reverted to the
crates.io version once cipherstash-suite is published.
The schema loader previously stamped every `eql_v2_encrypted` column with
`EqlTraits::all()`, which over-promised to the eql-mapper that every
encrypted column supports every operation. The mapper would then permit
SQL the database can't actually execute (e.g. `LIKE` against a column
with only a `unique` index).

Derive the traits from the column's configured indexes instead:
  - `unique`      → Eq
  - `ore` / `ope` → Ord (implies Eq)
  - `match`       → TokenMatch
  - `ste_vec`     → JsonLike (implies Ord+Eq) and Contain

Plumb the `EncryptConfigManager` into `SchemaManager` so each schema
reload reads a fresh encrypt-config snapshot. Reorder the explicit
DatabaseSchema reload to load encrypt-config first, ensuring the schema
sees the latest per-column index list.
@freshtonic freshtonic requested a review from tobyhede April 27, 2026 23:40
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Warning

Rate limit exceeded

@freshtonic has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 31 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0beba953-c01e-4c48-8815-1c1426c18c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 30aafc6 and e556d9f.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml
  • packages/cipherstash-proxy/src/postgresql/context/column.rs
  • packages/cipherstash-proxy/src/postgresql/data/from_sql.rs
  • packages/cipherstash-proxy/src/postgresql/data/to_sql.rs
  • packages/cipherstash-proxy/src/proxy/encrypt_config/config.rs
  • packages/cipherstash-proxy/src/proxy/mod.rs
  • packages/cipherstash-proxy/src/proxy/schema/manager.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/eql-traits-from-encrypt-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

let eql_traits = encrypt_config
.get_column_config(&identifier)
.map(|config| eql_traits_from_indexes(&config.indexes))
.unwrap_or_default();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encrypted without config has silent fallback.
Log may be helpful here

  .unwrap_or_else(|| {
      warn!(
          target: SCHEMA,
          msg = "eql_v2_encrypted column has no encrypt_config entry; refusing all encrypted operations",
          table = table_name,
          column = col,
      );
      EqlTraits::none()
  });

let _ = responder.send(());
}
ReloadCommand::EncryptSchema(responder) => {
encrypt_config_manager.reload().await;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ReloadCommand::EncryptSchema should probably refresh the database schema now the calls are dependent.

  ReloadCommand::EncryptSchema(responder) => {
      encrypt_config_manager.reload().await;
      schema_manager.reload().await;
      let _ = responder.send(());
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants