You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit aa91861
Browse filesBrowse the repository at this point in the historyBrowse files
feat(stack-encrypt): verify a match query's rows after decrypt
A Bloom filter can hold every bit of a query without the value holding
the needle, so a `Matches` query returns false positives. ADR-0009
decision 4 makes such a term `Probabilistic`, with `verify` as the
operator's own meaning run on a decrypted value.
- `op::Probabilistic { type Plaintext; fn verify(&self, &Plaintext) -> bool }`.
Infallible: every outcome other than a match is `false`.
- `MatchQuery` keeps the needle's tokens as the index cut them, through a
new `Supports::carry` taken before the value is consumed. `verify` cuts
the decrypted value the same way and checks every needle token is among
its tokens. The tokens are zeroized on drop and never shown by `Debug`.
- `Supports::Query` is bounded by `op::TermFor<Op>`: any query term answers
`Eq`, only a probabilistic one answers `Matches`, so an index cannot
claim a text match without saying how its answer is checked
(tests/ui/op_inexact_operator_needs_probabilistic.rs).
- `verify` on an exact term does not compile (tests/ui/op_verify_exact_term.rs).
The tests plant a real Bloom false positive under a 32-bit filter and
check `verify` drops it.
Closes#1183
Claude-Session: https://claude.ai/code/session_01VYKAWbd361xDLmqBdLoUcB
Copy file name to clipboardExpand all lines: packages/stack-encrypt/docs/adr/0009-operators-select-the-index-and-a-query-term-is-not-the-stored-term.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,9 +144,11 @@ query against a case-folding index is a type error, not an empty result.
144
144
pubtraitOperator:Copy+ 'static {}
145
145
146
146
pubtraitSupports<Op:Operator, S>:Index<S> {
147
-
typeQuery:QueryTerm; // what this index sends for this operator
147
+
typeQuery:TermFor<Op>; // what this index sends for `Op`
0 commit comments