Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2774 Locally encrypted properties can be used in "in" queries #2872

Merged

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Oct 27, 2022

Ebean already supports encrypted properties in "eq" queries. (See #2774)

Now we can also use them in "in" queries.

Note: locally encrypted properties can be used only in exact match queries https://ebean.io/docs/features/encryption#encrypted

@rPraml
Copy link
Contributor Author

rPraml commented Nov 2, 2022

This PR mainly adds the missing local encryption feature for "in" query.

For the sake of completenes, I reviewed the existing expressions and made this overview:

Expression           | dbEnc | local |
---------------------+-------+-------+
InQuery              | No¹   |   -   |
Like                 | Yes   |   -   |
Simple               | Yes   | Yes   |
CaseInsensitiveEqual | Yes   |   -   |
Null                 | Yes²  | Yes²  |
ArrayContains        | No¹   | No¹   |
NativeILike          | Yes   |   -   |
InRange              | No¹   |   -   |
In                   | Yes   | Yes   |
JsonPath             |   -   |   -   |
InPairs              | No¹   | No¹   |
Bitwise              | No¹   |   -   |
AbstractText         |   -   |   -   |
Between              | No¹   |   -   |
ArrayIsEmpty         |   -²  |   -   |
IsEmpty              |   -²  |   -   |

-) Technically not possible/makes no sense
¹) Could be implemented
²) Null/Empty values are not encrypted

@rbygrave There are some expressions left, that do not yet support dbEncryption (although ebean claims it's fully transparent)
It should be easy to add "dbEncryption" support for InRange / Bitwise / Between (it is straightforward to Like and if you want, I can do that in a separate PR)

InPairs woud be more difficult, as it should be possible also to add local encryption support and I'm unsure if it will make sense
I'm unsure, what to do with ArrayContains - It's technically possible, but as far as I see, this is very postgres specific.
I would not add dbEncryption support for InQuery- if you use a subquery on an encrypted property, it is very likely, that the result of the subquery is also encrypted (at least it should be)

Cheers
Roland

@rbygrave rbygrave added this to the 13.10.1 milestone Nov 2, 2022
@rbygrave rbygrave merged commit 08e1a05 into ebean-orm:master Nov 2, 2022
@rPraml rPraml deleted the issue-2774/encryption-support-for-in branch January 23, 2023 07:36
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.

None yet

2 participants