Skip to content

stack-encrypt: a field marker cannot query an ordered EQL type such as IntegerOrd — add order queries #1668

Open

Description

@coderdan

Background

Stack Encrypt (packages/stack-encrypt) is the Rust encryption engine that every CipherStash language SDK runs on. A derived record gives each field a marker, such as EncryptedMember::AGE, with one method for each operator the field's type answers: EncryptedMember::AGE.gt(30).encrypt(&keyset). An EQL type (from eql-bindings, the Rust types of EQL, the SQL library we install in the customer's database) says which operators it answers through its op::Answers impls, which eql-codegen writes into eql_bindings::v4::answers.

Problem

The equality and match types answer their operators from a marker. The ordered types (IntegerOrd, TextOrd, IntegerOrdOre, and the others) answer nothing: v4/answers.rs has no Answers impl for op::Lt, Lte, Gt, Gte or Between. Their query twin needs an order term, and for text an equality term too, but a marker's query sends one index's term. So a Rust program that stores an ordered EQL type cannot run a range query on it except through a data plan (dynamic::query_term).

#1658 is closed by #1659, which does not include order queries. The plan's item EQL types as fields is finished only when order queries work too.

Proposal

  1. Let a marker's query build a twin from more than one term, or give the ordered twins a single-term form that the SQL accepts.
  2. Generate Answers impls for the ordered types in eql-codegen, by the same rule the data path uses.
  3. Test that a marker's order query and the data path derive the same bytes, and that each finds the rows the other's terms find.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKrustPull requests that update Rust code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions