spring-projects / spring-data-mongodb

Provides support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-mongodb/
Apache License 2.0
1.61k stars 1.08k forks source link

Queryable Encryption Support #4185

Open ashni-mongodb opened 1 year ago

ashni-mongodb commented 1 year ago

Queryable Encryption is a new feature in MongoDB 6.0. It allows customers to encrypt sensitive data from the client side, store it as fully randomized encrypted data on the database server side, and run expressive queries on the encrypted data.

More details on Queryable Encryption here: https://www.mongodb.com/docs/manual/core/queryable-encryption/

jyemin commented 1 year ago

This is the part that describes the requirements for the JSON schema: https://www.mongodb.com/docs/manual/core/queryable-encryption/tutorials/aws/aws-automatic/#create-your-encrypted-collection

christophstrobl commented 1 year ago

The missing bit seems to be the queries part. So far only queryType: "equality" and queryType: "none" are mentioned in the docs. Will there be more or a change to the format? Which boils down to if a single attribute on @Encrypted (like below) is sufficient and future proof?

@Encrypted(query = EQUALITY)
ashni-mongodb commented 1 year ago

My understanding is that more are coming in the future. I can find out if format will remain consistent.

spring-projects-issues commented 1 year ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

ashni-mongodb commented 1 year ago

Hey, spoke to the team.

christophstrobl commented 2 months ago

Thank you Thank you @ashni-mongodb. When using queryable encryption along with explicit encryption is the queryType only to be set when encrypting parts of the filter query or is it also allowed/required when encrypting field data for the document to store. Javadoc of EncryptOptions is a bit thin there.

joelodom commented 2 months ago

@christophstrobl, queryType is used when creating the encrypted collection and it's also used when creating the query filter for the find. queryType is not used when creating the payload to insert.

@ashni-mongodb