-
Notifications
You must be signed in to change notification settings - Fork 455
CDRIVER-4272: Add options and code to load the csfle dynamic library #968
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new options and code to load csfle LGTM.
If mlib is only used for csfle_override_path
, I suggest leaving it out for now. It may be better to add mlib as a separate PR to expedite unblocking other drivers testing with csfle
.
5f9d09a
to
a334c4e
Compare
…processes if possible
…ions. This is discovered because the mongocryptd spawner will cause the atexit() code to run from the csfle library loaded in the process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall.
The mongodl.py script looks robust and generally useful.
Great catch with the exit and allocation unsafety within the child process.
…-encryption Refer: [DRIVERS-2287]
@kevinAlbs I've found that I need to add an option for a test to completely disable |
@@ -123,6 +123,9 @@ | |||
"autoEncryptOpts": { | |||
"kmsProviders": { | |||
"aws": {} | |||
}, | |||
"extra": { | |||
"__csfleDisabled": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming, has the spec test this test file corresponds to been updated in the spec repo? If not, this test might not belong under the json
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. This is somewhat experimenting on how to "disable" csfle for testing. We don't want to publish an "official" way to disable csfle, but this spec test also changed behavior depending on whether csfle is present. It's a catch-22.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to include the field in spec tests so long as it is clearly documented as for testing purposes only. However, if the specification repo will not be updated to match proposed test file contents, I would like the __csfleDisabled
test to be moved out of the json
directory and tested as a prose test instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failing may be a bug in csfle
. csfle
and mongocryptd
should have the same output(slack thread for reference).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the issue with __csfleDisabled
in a modified unified spec test, LGTM.
@@ -123,6 +123,9 @@ | |||
"autoEncryptOpts": { | |||
"kmsProviders": { | |||
"aws": {} | |||
}, | |||
"extra": { | |||
"__csfleDisabled": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is fine to include the field in spec tests so long as it is clearly documented as for testing purposes only. However, if the specification repo will not be updated to match proposed test file contents, I would like the __csfleDisabled
test to be moved out of the json
directory and tested as a prose test instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a suggestion to skip tests based on test environment rather than a __csfleDisabled
option.
@@ -123,6 +123,9 @@ | |||
"autoEncryptOpts": { | |||
"kmsProviders": { | |||
"aws": {} | |||
}, | |||
"extra": { | |||
"__csfleDisabled": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test failing may be a bug in csfle
. csfle
and mongocryptd
should have the same output(slack thread for reference).
"]", | ||
"mongocryptdURI", | ||
"mongodb://localhost:27021/?serverSelectionTimeoutMS=1000", | ||
"__csfleDisabled", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All drivers will need a solution to skip this prose test when running with csfle
. I prefer not adding a hidden option to the API. I think it adds small risk that users rely on it.
I suggest only run this test if the test runner expects to use csfle
. That could be passed through an environment variable. There is precedence: (e.g. MONGOC_TEST_IS_SERVERLESS
, MONGOC_TEST_LOADBALANCED
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes and tests look good. Skipping Windows is not ideal, but seems low risk given that it has been validated locally, and libmongocrypt tests with the stub library in CI.
This is an initial basic implementation of the
csfle
options from the new CSE spec changes to support the dynamic library. This also adds mlib as a support library, which now requires some C99 support.TODO: A a testing scenario that injects the
csfle
library. Ensure tests do not load acsfle
from the system, only from the isolated test copy or relies on mongocrypd.