[MONGOCRYPT-329] Spring FLE POC Created: 09/Aug/21  Updated: 20/Oct/21  Resolved: 19/Aug/21

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Unknown
Reporter: Rachelle Palmer Assignee: Kevin Albertson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Scope

Write a POC to allow lazily supplying encryption schemas to libmongocrypt. This must enable driver API like the following:

collection = db.GetCollection("foo").WithEncryptionSchema(schema);



 Comments   
Comment by Kevin Albertson [ 19/Aug/21 ]

I considered two solutions.

1. The driver lazily passes a schema into libmongocrypt when the first operation occurs on collection "foo" and the state machine enters the MONGOCRYPT_CTX_NEED_COLLINFO state.
Pro: This would require no libmongocrypt changes.
Con: It requires the driver passing the schema from the collection object down to the layer where the state machine is run.

2. Allow libmongocrypt to set additional schemas by repeated calls to mongocrypt_setopt_schemamap
Pro: This simplifies driver changes.
Con: This requires libmongocrypt changes.

I chose to implement option 2 with the C driver. The syntax looks like the following:

coll = mongoc_database_get_collection (db, "foo");
mongoc_collection_set_encryption_schema (coll, schema);

A branch of mongodb/mongo-c-driver containing the POC and an integration test is located here:
https://github.com/mongodb/mongo-c-driver/compare/springPOC?expand=1#diff-d363a5539f2fbabfadf2d7cc6cdb96a203fb63f2caa31bae731c3e12d97b204cR2245-R2314

An integration test of lazily setting a collection schema and performing automatic encryption is located here:
https://github.com/mongodb/mongo-c-driver/compare/springPOC?expand=1

A branch of mongodb/libmongocrypt containing the required libmongocrypt changes is located here:
https://github.com/mongodb/libmongocrypt/compare/springpoc.329?expand=1

 

Generated at Thu Feb 08 09:08:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.