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

update for libmongocrypt 1.5.2 #1037

Merged
merged 16 commits into from Aug 2, 2022
Merged

update for libmongocrypt 1.5.2 #1037

merged 16 commits into from Aug 2, 2022

Conversation

kevinAlbs
Copy link
Contributor

@kevinAlbs kevinAlbs commented Jul 29, 2022

Summary

Resolve GODRIVER-2511:

  • Add CSFLE prose test 16.
  • Update tests to use libmongocrypt 1.5.2.

Resolve GODRIVER-2513:

  • Return error if libmongocrypt < 1.5.2 is detected in RewrapManyDataKey.
  • Retract Go 1.10.0.

Resolve GODRIVER-2509:

Resolve GODRIVER-2512:

Background & Motivation

libmongocrypt 1.5.2 includes a fix to a severe bug introduced in libmongocrypt 1.5.0: MONGOCRYPT-464.

@kevinAlbs kevinAlbs changed the title DRIVERS-2403 POC GODRIVER-2510 update for libmongocrypt 1.5.2 Jul 30, 2022
# After: "can only execute encrypted equality queries with an encrypted equality index"
# Use a small common substring.
errorContains: "encrypt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
errorContains: "encrypt"
errorContains: "encrypt"

[opt] also missing newline in the spec PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// libmongocrypt versions 1.5.0 and 1.5.1 have a severe bug in RewrapManyDataKey.
// Check if the version string starts with 1.5.0 or 1.5.1. This accounts for pre-release versions, like 1.5.0-rc0.
libmongocryptVersion := mongocrypt.Version()
if strings.Index(libmongocryptVersion, "1.5.0") == 0 || strings.Index(libmongocryptVersion, "1.5.1") == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I'd probably use strings.HasPrefix for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

mt.Run(fmt.Sprintf("%s to %s", srcProvider, dstProvider), func(mt *mtest.T) {
var err error
// Drop the collection ``keyvault.datakeys``.
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm is the point of these empty blocks just to emphasize what the steps of this test are? Or are you using them for some scope logic that I'm not understanding 🧑‍🔧 . If it's just for emphasizing the steps, I'm not sure it's necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is to emphasize what code accomplishes the step. It is not necessary.

if val, ok := dataKeyMap[dstProvider]; ok {
rwOpts.SetMasterKey(val)
}
res, err := clientEncryption2.RewrapManyDataKey(context.Background(), bson.D{{}}, rwOpts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res, err := clientEncryption2.RewrapManyDataKey(context.Background(), bson.D{{}}, rwOpts)
res, err := clientEncryption2.RewrapManyDataKey(context.Background(), bson.D{}, rwOpts)

Should this just be bson.D{} if you want an empty filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Done.

Copy link
Contributor

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mod my small comments/questions.

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with a few questions. 👍

mongo/doc.go Outdated
@@ -110,7 +110,7 @@
// - Go Driver v1.2.0 requires libmongocrypt v1.0.0 or higher
// - Go Driver v1.5.0 requires libmongocrypt v1.1.0 or higher
// - Go Driver v1.8.0 requires libmongocrypt v1.3.0 or higher
// - Go Driver v1.10.0 requires libmongocrypt v1.5.0 or higher
// - Go Driver v1.10.0 requires libmongocrypt v1.5.2 or higher
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: This is slightly odd messaging and conflates compatibility requirements with libmongocrypt version retraction. My understanding is that libmongocrypt v1.5.0 and v1.5.1 contain serious bugs that can cause data corruption, but are technically build-compatible with Go Driver v1.10.0. Consider adding a note that describes why libmongocrypt v1.5.0/v1.5.1 shouldn't be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated to say v1.5.0 is required but added a note to say 1.5.2 is required to avoid the severe bug in RewrapManyDataKey.

libmongocryptVersion := mongocrypt.Version()
if strings.Index(libmongocryptVersion, "1.5.0") == 0 || strings.Index(libmongocryptVersion, "1.5.1") == 0 {
return nil, fmt.Errorf("RewrapManyDataKey requires libmongocrypt 1.5.2 or newer. Detected version: %v", libmongocryptVersion)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updates will only apply to users who update to Go Driver v1.10.1+ and could be missed by users who are using Go Driver v1.10.0. Are there other ways we're messaging to Go Driver users that they shouldn't use libmongocrypt v1.5.0/v1.5.1 (e.g. retraction notices on the libmongocrypt download page)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I updated the libmongocrypt release notes and changelog to add a warning. There is no libmongocrypt downloads page. Go users are advised to download libmongocrypt from Homebrew, the Linux packages we maintain, or the Windows download URL.

One option is to update the Go driver 1.10.0 release notes to add a notice like the following. I have asked in the team channel.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@kevinAlbs
Copy link
Contributor Author

Updated to retract v1.10.0.

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

// - Go Driver v1.10.0 requires libmongocrypt v1.5.0 or higher.
// There is a severe bug when calling RewrapManyDataKey with libmongocrypt versions less than 1.5.2.
// This bug may result in data corruption.
// Please use libmongocrypt 1.5.2 or higher when calling RewrapManyDataKey.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great godoc format improvement!

libmongocryptVersion := mongocrypt.Version()
if strings.Index(libmongocryptVersion, "1.5.0") == 0 || strings.Index(libmongocryptVersion, "1.5.1") == 0 {
return nil, fmt.Errorf("RewrapManyDataKey requires libmongocrypt 1.5.2 or newer. Detected version: %v", libmongocryptVersion)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@kevinAlbs kevinAlbs removed the request for review from benjirewis August 2, 2022 02:06
@kevinAlbs kevinAlbs merged commit 82a6eeb into mongodb:master Aug 2, 2022
kevinAlbs added a commit that referenced this pull request Aug 2, 2022
Resolve GODRIVER-2511:
* Add CSFLE prose test 16.
* Update tests to use libmongocrypt 1.5.2.

Resolve GODRIVER-2513:
* Return error if libmongocrypt < 1.5.2 is detected in RewrapManyDataKey.
* Retract Go driver release v1.10.0.

Resolve GODRIVER-2509:
* Resync RewrapManyDataKey specification tests to mongodb/specifications@10b4a41.
* Resolve GODRIVER-2512:

Resolve GODRIVER-2512:
- Resync fle2-InsertFind-Unindexed.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants