Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/client-side-encryption.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ Queryable Encryption
====================

Queryable encryption is a new feature in MongoDB 6.0. It also requires
libmongocrypt version 1.5.0 or above.
libmongocrypt version 1.5.2 or above.

You can find more information about queryable encryption in `MongoDB Manual
<https://www.mongodb.com/docs/upcoming/core/queryable-encryption/queryable-encryption/>`_
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/standard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ def standard_dependencies
end

if ENV['FLE'] == 'helper'
gem 'libmongocrypt-helper', '~> 1.5.0'
gem 'libmongocrypt-helper', '~> 1.5.2'
end
end
20 changes: 19 additions & 1 deletion lib/mongo/crypt/binding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Binding
# will cause a `LoadError`.
#
# @api private
MIN_LIBMONGOCRYPT_VERSION = Gem::Version.new("1.5.0.alpha")
MIN_LIBMONGOCRYPT_VERSION = Gem::Version.new("1.5.2")

# @!method self.mongocrypt_version(len)
# @api private
Expand All @@ -107,6 +107,24 @@ def self.validate_version(lmc_version)
raise LoadError, "libmongocrypt version #{MIN_LIBMONGOCRYPT_VERSION} or above is required, " +
"but version #{actual_version} was found."
end
rescue ArgumentError => e
# Some lmc versions cannot be parsed with Gem::Version class,
# so we fall back to regex.
match = lmc_version.match(/\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?(-[A-Za-z\+\d]+)?\z/)
if match.nil?
raise ArgumentError.new("Malformed version number string #{lmc_version}")
end
actual_version = Gem::Version.new(
[
match[:major],
match[:minor],
match[:patch]
].join('.')
)
if actual_version < MIN_LIBMONGOCRYPT_VERSION
raise LoadError, "libmongocrypt version #{MIN_LIBMONGOCRYPT_VERSION} or above is required, " +
"but version #{actual_version} was found."
end
end

validate_version(mongocrypt_version(nil))
Expand Down
8 changes: 8 additions & 0 deletions spec/mongo/crypt/binding/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,13 @@
end.not_to raise_error(LoadError, /libmongocrypt version .* or above is required, but version .* was found./)
end
end

context 'when in a non-parsable format' do
it 'does not raise ArgumentError' do
expect do
Mongo::Crypt::Binding.validate_version("1.5.3-dev+20220730git8f8675fa11")
end.not_to raise_error(ArgumentError, /Malformed version number string/)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# commands sort the resulting documents in ascending order by the single-element
# keyAltNames array to ensure alphabetic order by original KMS provider as
# defined in initialData.
description: rewrapManyDataKey-kms_providers
description: rewrapManyDataKey

schemaVersion: "1.8"

Expand Down Expand Up @@ -50,7 +50,7 @@ initialData:
region: us-east-1
- _id: &azure_key_id { $binary: { base64: YXp1cmVhenVyZWF6dXJlYQ==, subType: "04" } }
keyAltNames: ["azure_key"]
keyMaterial: { $binary: { base64: AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEGkNTybTc7Eyif0f+qqE0lAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDB2j78AeuIQxcRh8cQIBEIB7vj9buHEaT7XHFIsKBJiyzZRmNnjvqMK5LSdzonKdx97jlqauvPvTDXSsdQDcspUs5oLrGmAXpbFResscxmbwZoKgUtWiuIOpeAcYuszCiMKt15s1WIMLDXUhYtfCmhRhekvgHnRAaK4HJMlGE+lKJXYI84E0b86Cd/g+, subType: "00" } }
keyMaterial: { $binary: { base64: pr01l7qDygUkFE/0peFwpnNlv3iIy8zrQK38Q9i12UCN2jwZHDmfyx8wokiIKMb9kAleeY+vnt3Cf1MKu9kcDmI+KxbNDd+V3ytAAGzOVLDJr77CiWjF9f8ntkXRHrAY9WwnVDANYkDwXlyU0Y2GQFTiW65jiQhUtYLYH63Tk48SsJuQvnWw1Q+PzY8ga+QeVec8wbcThwtm+r2IHsCFnc72Gv73qq7weISw+O4mN08z3wOp5FOS2ZM3MK7tBGmPdBcktW7F8ODGsOQ1FU53OrWUnyX2aTi2ftFFFMWVHqQo7EYuBZHru8RRODNKMyQk0BFfKovAeTAVRv9WH9QU7g==, subType: "00" } }
creationDate: { $date: { $numberLong: "1641024000000" } }
updateDate: { $date: { $numberLong: "1641024000000" } }
status: 1
Expand All @@ -72,7 +72,7 @@ initialData:
keyName: key-name-csfle
- _id: &kmip_key_id { $binary: { base64: a21pcGttaXBrbWlwa21pcA==, subType: "04" } }
keyAltNames: ["kmip_key"]
keyMaterial: { $binary: { base64: VoI9J8HusQ3u2gT9i8Awgg/6W4/igvLwRzn3SRDGx0Dl/1ayDMubphOw0ONPVKfuvS6HL3e4gAoCJ/uEz2KLFTVsEqYCpMhfAhgXxm8Ena8vDcOkCzFX+euvN/N2ES3wpzAD18b3qIH0MbBwKJP82d5GQ4pVfGnPW8Ujp9aO1qC/s0EqNqYyzJ1SyzhV9lAjHHGIENYJx+bBrekg2EeZBA==, subType: "00" } }
keyMaterial: { $binary: { base64: CklVctHzke4mcytd0TxGqvepkdkQN8NUF4+jV7aZQITAKdz6WjdDpq3lMt9nSzWGG2vAEfvRb3mFEVjV57qqGqxjq2751gmiMRHXz0btStbIK3mQ5xbY9kdye4tsixlCryEwQONr96gwlwKKI9Nubl9/8+uRF6tgYjje7Q7OjauEf1SrJwKcoQ3WwnjZmEqAug0kImCpJ/irhdqPzivRiA==, subType: "00" } }
creationDate: { $date: { $numberLong: "1641024000000" } }
updateDate: { $date: { $numberLong: "1641024000000" } }
status: 1
Expand Down