libmongocrypt-helper 1.8.0.0.1001 → 1.11.0.0.1001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (385) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +33 -0
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +12 -1
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
  5. data/ext/libmongocrypt/libmongocrypt/Earthfile +151 -3
  6. data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
  7. data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
  8. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +10 -0
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
  15. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
  16. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
  17. data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
  18. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +21 -26
  19. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
  22. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +21 -6
  25. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
  27. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
  28. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
  29. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
  30. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
  31. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
  32. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
  33. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
  34. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
  35. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
  36. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
  37. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +44 -2
  38. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
  39. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
  40. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -900
  41. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +60 -0
  42. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
  43. data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
  44. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
  45. data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
  46. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
  47. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
  48. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
  50. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
  51. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
  52. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
  53. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
  54. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +107 -61
  55. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -4
  56. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
  57. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
  58. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
  59. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
  60. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -238
  61. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
  62. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
  63. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
  64. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
  65. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
  66. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
  67. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
  68. data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
  69. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
  70. data/ext/libmongocrypt/libmongocrypt/bindings/python/{test-requirements.txt → requirements-test.txt} +4 -1
  71. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
  72. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
  73. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
  74. data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
  75. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +1 -0
  76. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
  77. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
  78. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
  79. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
  80. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
  81. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
  82. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
  83. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/rangeopts.json +11 -0
  84. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/value-to-encrypt.json +20 -0
  85. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
  86. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
  87. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
  88. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
  89. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
  90. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
  91. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
  92. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
  93. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
  94. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
  95. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
  96. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
  97. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +988 -340
  98. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
  99. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
  100. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +23 -0
  101. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +19 -227
  102. data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
  103. data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
  104. data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
  105. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
  106. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
  107. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
  108. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
  109. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +1 -1
  110. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
  111. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
  112. data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
  113. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
  114. data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
  115. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
  116. data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
  117. data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
  118. data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
  119. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
  120. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  121. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +17 -0
  122. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
  123. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
  124. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
  125. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
  126. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
  127. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
  128. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
  129. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
  130. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
  131. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
  132. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +13 -10
  133. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +1 -1
  134. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +16 -2
  135. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +94 -6
  136. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +15 -5
  137. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +114 -53
  138. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +1 -1
  139. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +1 -1
  140. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +2 -2
  141. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +2 -2
  142. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +21 -6
  143. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +5 -5
  144. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +38 -2
  145. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +1 -1
  146. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +20 -7
  147. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +8 -8
  148. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +89 -1
  149. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +3 -3
  150. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +1 -23
  151. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +4 -3
  152. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +15 -12
  153. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +11 -0
  154. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +16 -6
  155. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +64 -22
  156. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +23 -4
  157. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +359 -65
  158. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +26 -14
  159. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +17 -6
  160. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +31 -13
  161. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +16 -3
  162. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +259 -63
  163. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +40 -24
  164. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +57 -13
  165. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +17 -0
  166. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
  167. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +0 -5
  168. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +5 -7
  169. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +1 -0
  170. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -18
  171. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +105 -76
  172. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +9 -3
  173. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +170 -89
  174. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +5 -5
  175. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +505 -124
  176. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +31 -6
  177. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +81 -13
  178. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +7 -0
  179. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +5 -1
  180. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +161 -103
  181. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +2 -7
  182. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +191 -69
  183. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +1 -1
  184. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +50 -15
  185. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +365 -69
  186. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +2 -1
  187. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +200 -107
  188. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +50 -5
  189. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +591 -15
  190. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +6 -13
  191. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +3 -2
  192. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -234
  193. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +75 -24
  194. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +18 -2
  195. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +4 -0
  196. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
  197. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
  198. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
  199. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
  200. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
  201. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
  202. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
  203. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
  204. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
  205. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
  206. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
  207. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
  208. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
  209. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
  210. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
  211. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
  212. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
  213. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
  214. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
  216. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
  217. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
  218. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
  219. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
  220. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
  221. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
  222. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
  223. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
  224. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
  225. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
  226. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
  227. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
  228. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
  229. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
  230. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +3 -3
  231. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
  232. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
  233. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
  234. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
  235. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
  236. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
  237. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
  238. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
  239. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
  240. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
  241. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
  242. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
  243. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
  244. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
  245. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
  246. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
  247. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
  248. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
  249. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
  250. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
  251. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
  252. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
  253. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
  254. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
  255. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
  256. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
  257. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
  258. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
  259. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
  260. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
  261. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
  262. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
  263. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
  264. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
  265. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
  266. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
  267. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +7 -4
  268. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +9 -5
  269. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +9 -5
  270. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +1 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +8 -8
  272. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +6 -4
  273. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +43 -3
  274. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +76 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +5 -5
  276. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +89 -14
  277. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +342 -76
  278. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +94 -12
  279. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +205 -7
  280. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +49 -23
  281. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +16 -19
  282. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -1
  283. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +94 -11
  284. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +121 -42
  286. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +134 -4
  287. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +40 -0
  288. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +16 -0
  289. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +11 -11
  290. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +8 -5
  291. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +922 -92
  292. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +2 -2
  293. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +114 -12
  294. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +14 -9
  295. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +424 -3
  296. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +1 -1
  297. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +447 -28
  298. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +30 -26
  300. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +7 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +3 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +66 -14
  303. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +11 -0
  304. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
  306. data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +4 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
  309. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +38 -3
  310. data/lib/libmongocrypt_helper/version.rb +2 -2
  311. metadata +112 -106
  312. checksums.yaml.gz.sig +0 -0
  313. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
  314. data/ext/libmongocrypt/libmongocrypt/bindings/cs/cs.sln +0 -79
  315. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -105
  316. data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
  317. data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
  318. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
  319. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -36
  320. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -641
  321. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
  322. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
  323. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -821
  324. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -98
  325. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
  326. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/errors.js +0 -75
  327. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -73
  328. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
  329. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js +0 -26
  330. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/azure.js +0 -178
  331. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/gcp.js +0 -24
  332. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/index.js +0 -54
  333. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/utils.js +0 -39
  334. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -492
  335. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -15302
  336. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -100
  337. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -956
  338. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
  339. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -950
  340. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
  341. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -1093
  342. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/common.test.js +0 -94
  343. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -240
  344. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
  345. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
  346. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
  347. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
  348. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
  349. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
  350. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
  351. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
  352. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
  353. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/index.test.js +0 -45
  354. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
  355. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/providers/credentialsProvider.test.js +0 -551
  356. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -66
  357. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -51
  358. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
  359. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/chai-addons.js +0 -8
  360. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
  361. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/types/index.test-d.ts +0 -63
  362. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -89
  363. data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
  364. data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
  365. data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
  366. data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
  367. data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
  368. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
  369. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
  370. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
  371. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
  372. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
  373. data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
  374. data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
  375. data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
  376. data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
  377. data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
  378. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
  379. data.tar.gz.sig +0 -1
  380. metadata.gz.sig +0 -0
  381. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
  382. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
  383. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
  384. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
  385. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -1,551 +0,0 @@
1
- 'use strict';
2
-
3
- const { expect } = require('chai');
4
- const http = require('http');
5
- const requirements = require('../requirements.helper');
6
- const { loadCredentials, isEmptyCredentials } = require('../../lib/providers');
7
- const { tokenCache, fetchAzureKMSToken } = require('../../lib/providers/azure');
8
- const sinon = require('sinon');
9
- const utils = require('../../lib/providers/utils');
10
- const {
11
- MongoCryptKMSRequestNetworkTimeoutError,
12
- MongoCryptAzureKMSRequestError
13
- } = require('../../lib/errors');
14
-
15
- const originalAccessKeyId = process.env.AWS_ACCESS_KEY_ID;
16
- const originalSecretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
17
- const originalSessionToken = process.env.AWS_SESSION_TOKEN;
18
-
19
- describe('#loadCredentials', function () {
20
- context('isEmptyCredentials()', () => {
21
- it('returns true for an empty object', () => {
22
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: {} })).to.be.true;
23
- });
24
-
25
- it('returns false for an object with keys', () => {
26
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: { password: 'secret' } })).to.be.false;
27
- });
28
-
29
- it('returns false for an nullish credentials', () => {
30
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: null })).to.be.false;
31
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: undefined })).to.be.false;
32
- expect(isEmptyCredentials('rainyCloud', {})).to.be.false;
33
- });
34
-
35
- it('returns false for non object credentials', () => {
36
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: 0 })).to.be.false;
37
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: false })).to.be.false;
38
- expect(isEmptyCredentials('rainyCloud', { rainyCloud: Symbol('secret') })).to.be.false;
39
- });
40
- });
41
-
42
- context('when using aws', () => {
43
- const accessKey = 'example';
44
- const secretKey = 'example';
45
- const sessionToken = 'example';
46
-
47
- after(function () {
48
- // After the entire suite runs, set the env back for the rest of the test run.
49
- process.env.AWS_ACCESS_KEY_ID = originalAccessKeyId;
50
- process.env.AWS_SECRET_ACCESS_KEY = originalSecretAccessKey;
51
- process.env.AWS_SESSION_TOKEN = originalSessionToken;
52
- });
53
-
54
- context('when the credential provider finds credentials', function () {
55
- before(function () {
56
- process.env.AWS_ACCESS_KEY_ID = accessKey;
57
- process.env.AWS_SECRET_ACCESS_KEY = secretKey;
58
- process.env.AWS_SESSION_TOKEN = sessionToken;
59
- });
60
-
61
- context('when the credentials are empty', function () {
62
- const kmsProviders = { aws: {} };
63
-
64
- before(function () {
65
- if (!requirements.credentialProvidersInstalled.aws) {
66
- this.currentTest.skipReason = 'Cannot refresh credentials without sdk provider';
67
- this.currentTest.skip();
68
- return;
69
- }
70
- });
71
-
72
- it('refreshes the aws credentials', async function () {
73
- const providers = await loadCredentials(kmsProviders);
74
- expect(providers).to.deep.equal({
75
- aws: {
76
- accessKeyId: accessKey,
77
- secretAccessKey: secretKey,
78
- sessionToken: sessionToken
79
- }
80
- });
81
- });
82
- });
83
-
84
- context('when the credentials are not empty', function () {
85
- context('when aws is empty', function () {
86
- const kmsProviders = {
87
- local: {
88
- key: Buffer.alloc(96)
89
- },
90
- aws: {}
91
- };
92
-
93
- before(function () {
94
- if (!requirements.credentialProvidersInstalled.aws) {
95
- this.currentTest.skipReason = 'Cannot refresh credentials without sdk provider';
96
- this.currentTest.skip();
97
- return;
98
- }
99
- });
100
-
101
- it('refreshes only the aws credentials', async function () {
102
- const providers = await loadCredentials(kmsProviders);
103
- expect(providers).to.deep.equal({
104
- local: {
105
- key: Buffer.alloc(96)
106
- },
107
- aws: {
108
- accessKeyId: accessKey,
109
- secretAccessKey: secretKey,
110
- sessionToken: sessionToken
111
- }
112
- });
113
- });
114
- });
115
-
116
- context('when aws is not empty', function () {
117
- const kmsProviders = {
118
- local: {
119
- key: Buffer.alloc(96)
120
- },
121
- aws: {
122
- accessKeyId: 'example'
123
- }
124
- };
125
-
126
- before(function () {
127
- if (!requirements.credentialProvidersInstalled.aws) {
128
- this.currentTest.skipReason = 'Cannot refresh credentials without sdk provider';
129
- this.currentTest.skip();
130
- return;
131
- }
132
- });
133
-
134
- it('does not refresh credentials', async function () {
135
- const providers = await loadCredentials(kmsProviders);
136
- expect(providers).to.deep.equal(kmsProviders);
137
- });
138
- });
139
- });
140
- });
141
-
142
- context('when the sdk is not installed', function () {
143
- const kmsProviders = {
144
- local: {
145
- key: Buffer.alloc(96)
146
- },
147
- aws: {}
148
- };
149
-
150
- before(function () {
151
- if (requirements.credentialProvidersInstalled.aws) {
152
- this.currentTest.skipReason = 'Credentials will be loaded when sdk present';
153
- this.currentTest.skip();
154
- return;
155
- }
156
- });
157
-
158
- it('does not refresh credentials', async function () {
159
- const providers = await loadCredentials(kmsProviders);
160
- expect(providers).to.deep.equal(kmsProviders);
161
- });
162
- });
163
- });
164
-
165
- context('when using gcp', () => {
166
- const setupHttpServer = status => {
167
- let httpServer;
168
- before(() => {
169
- httpServer = http
170
- .createServer((_, res) => {
171
- if (status === 200) {
172
- res.writeHead(200, { 'Content-Type': 'application/json' });
173
- res.writeHead(200, { 'Metadata-Flavor': 'Google' });
174
- res.end(JSON.stringify({ access_token: 'abc' }));
175
- } else {
176
- res.writeHead(401, { 'Content-Type': 'application/json' });
177
- res.writeHead(401, { 'Metadata-Flavor': 'Google' });
178
- res.end('{}');
179
- }
180
- })
181
- .listen(5001);
182
- process.env.GCE_METADATA_HOST = 'http://127.0.0.1:5001';
183
- });
184
-
185
- after(() => {
186
- httpServer.close();
187
- delete process.env.GCE_METADATA_HOST;
188
- });
189
- };
190
-
191
- context('and gcp-metadata is installed', () => {
192
- beforeEach(function () {
193
- if (!requirements.credentialProvidersInstalled.gcp) {
194
- this.currentTest.skipReason = 'Tests require gcp-metadata to be installed';
195
- this.currentTest.skip();
196
- return;
197
- }
198
- });
199
-
200
- context('when metadata http response is 200 ok', () => {
201
- setupHttpServer(200);
202
- context('when the credentials are empty', function () {
203
- const kmsProviders = { gcp: {} };
204
-
205
- it('refreshes the gcp credentials', async function () {
206
- const providers = await loadCredentials(kmsProviders);
207
- expect(providers).to.deep.equal({
208
- gcp: {
209
- accessToken: 'abc'
210
- }
211
- });
212
- });
213
- });
214
- });
215
-
216
- context('when metadata http response is 401 bad', () => {
217
- setupHttpServer(401);
218
- context('when the credentials are empty', function () {
219
- const kmsProviders = { gcp: {} };
220
-
221
- it('surfaces error from server', async function () {
222
- const error = await loadCredentials(kmsProviders).catch(error => error);
223
- expect(error).to.be.instanceOf(Error);
224
- });
225
- });
226
- });
227
- });
228
-
229
- context('and gcp-metadata is not installed', () => {
230
- beforeEach(function () {
231
- if (requirements.credentialProvidersInstalled.gcp) {
232
- this.currentTest.skipReason = 'Tests require gcp-metadata to be installed';
233
- this.currentTest.skip();
234
- return;
235
- }
236
- });
237
-
238
- context('when the credentials are empty', function () {
239
- const kmsProviders = { gcp: {} };
240
-
241
- it('does not modify the gcp credentials', async function () {
242
- const providers = await loadCredentials(kmsProviders);
243
- expect(providers).to.deep.equal({ gcp: {} });
244
- });
245
- });
246
- });
247
- });
248
-
249
- context('when using azure', () => {
250
- afterEach(() => tokenCache.resetCache());
251
- afterEach(() => sinon.restore());
252
- context('credential caching', () => {
253
- const cache = tokenCache;
254
-
255
- beforeEach(() => {
256
- cache.resetCache();
257
- });
258
-
259
- context('when there is no cached token', () => {
260
- let mockToken = {
261
- accessToken: 'mock token',
262
- expiresOnTimestamp: Date.now()
263
- };
264
-
265
- let token;
266
-
267
- beforeEach(async () => {
268
- sinon.stub(cache, '_getToken').returns(mockToken);
269
- token = await cache.getToken();
270
- });
271
- it('fetches a token', async () => {
272
- expect(token).to.have.property('accessToken', mockToken.accessToken);
273
- });
274
- it('caches the token on the class', async () => {
275
- expect(cache.cachedToken).to.equal(mockToken);
276
- });
277
- });
278
-
279
- context('when there is a cached token', () => {
280
- context('when the cached token expires <= 1 minute from the current time', () => {
281
- let mockToken = {
282
- accessToken: 'mock token',
283
- expiresOnTimestamp: Date.now()
284
- };
285
-
286
- let token;
287
-
288
- beforeEach(async () => {
289
- cache.cachedToken = {
290
- accessToken: 'a new key',
291
- expiresOnTimestamp: Date.now() + 3000
292
- };
293
- sinon.stub(cache, '_getToken').returns(mockToken);
294
- token = await cache.getToken();
295
- });
296
-
297
- it('fetches a token', () => {
298
- expect(token).to.have.property('accessToken', mockToken.accessToken);
299
- });
300
- it('caches the token on the class', () => {
301
- expect(cache.cachedToken).to.equal(mockToken);
302
- });
303
- });
304
-
305
- context('when the cached token expires > 1 minute from the current time', () => {
306
- let expiredToken = {
307
- token: 'mock token',
308
- expiresOnTimestamp: Date.now()
309
- };
310
-
311
- let expectedMockToken = {
312
- accessToken: 'a new key',
313
- expiresOnTimestamp: Date.now() + 10000
314
- };
315
-
316
- let token;
317
-
318
- beforeEach(async () => {
319
- cache.cachedToken = expiredToken;
320
- sinon.stub(cache, '_getToken').returns(expectedMockToken);
321
- token = await cache.getToken();
322
- });
323
- it('returns the cached token', () => {
324
- expect(token).to.have.property('accessToken', expectedMockToken.accessToken);
325
- });
326
- });
327
- });
328
- });
329
-
330
- context('request configuration', () => {
331
- const mockResponse = {
332
- status: 200,
333
- body: '{ "access_token": "token", "expires_in": "10000" }'
334
- };
335
-
336
- let httpSpy;
337
-
338
- beforeEach(async () => {
339
- httpSpy = sinon.stub(utils, 'get');
340
- httpSpy.resolves(mockResponse);
341
-
342
- await loadCredentials({ azure: {} });
343
- });
344
-
345
- it('sets the `api-version` param to 2012-02-01', () => {
346
- const url = httpSpy.args[0][0];
347
- expect(url).to.be.instanceof(URL);
348
- expect(url.searchParams.get('api-version'), '2018-02-01');
349
- });
350
-
351
- it('sets the `resource` param to `https://vault.azure.net`', () => {
352
- const url = httpSpy.args[0][0];
353
- expect(url).to.be.instanceof(URL);
354
- expect(url.searchParams.get('resource'), 'https://vault.azure.net');
355
- });
356
-
357
- it('sends the request to `http://169.254.169.254/metadata/identity/oauth2/token`', () => {
358
- const url = httpSpy.args[0][0];
359
- expect(url).to.be.instanceof(URL);
360
- expect(url.toString()).to.include('http://169.254.169.254/metadata/identity/oauth2/token');
361
- });
362
-
363
- it('sets the Metadata header to true', () => {
364
- const options = httpSpy.args[0][1];
365
- expect(options).to.have.property('headers').to.have.property('Metadata', true);
366
- });
367
-
368
- it('sets the Content-Type header to application/json', () => {
369
- const options = httpSpy.args[0][1];
370
- expect(options)
371
- .to.have.property('headers')
372
- .to.have.property('Content-Type', 'application/json');
373
- });
374
-
375
- context('prose test specific requirements', () => {
376
- /**
377
- * the driver prose tests require the ability to set custom URL endpoints
378
- * for the IMDS call and set custom headers
379
- */
380
- const url = new URL('http://customentpoint.com');
381
-
382
- beforeEach(async () => {
383
- sinon.restore();
384
- httpSpy = sinon.stub(utils, 'get');
385
- httpSpy.resolves(mockResponse);
386
- await fetchAzureKMSToken({
387
- url,
388
- headers: {
389
- customHeader1: 'value1',
390
- customHeader2: 'value2'
391
- }
392
- });
393
- });
394
-
395
- it('allows a custom URL to be specified', () => {
396
- const url = httpSpy.args[0][0];
397
- expect(url).to.be.instanceof(URL);
398
- expect(url.toString()).to.include('http://customentpoint.com');
399
- });
400
-
401
- it('deep copies the provided url', () => {
402
- const spiedUrl = httpSpy.args[0][0];
403
- expect(spiedUrl).to.be.instanceof(URL);
404
- expect(spiedUrl).to.not.equal(url);
405
- });
406
-
407
- it('allows custom headers to be specified', () => {
408
- const options = httpSpy.args[0][1];
409
- expect(options).to.have.property('headers').to.have.property('customHeader1', 'value1');
410
- expect(options).to.have.property('headers').to.have.property('customHeader2', 'value2');
411
- });
412
- });
413
- });
414
-
415
- context('error handling', () => {
416
- afterEach(() => sinon.restore());
417
- context('when the request times out', () => {
418
- before(() => {
419
- sinon.stub(utils, 'get').rejects(new MongoCryptKMSRequestNetworkTimeoutError());
420
- });
421
-
422
- it('throws a MongoCryptKMSRequestError', async () => {
423
- const error = await loadCredentials({ azure: {} }).catch(e => e);
424
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
425
- });
426
- });
427
-
428
- context('when the request returns a non-200 error', () => {
429
- context('when the request has no body', () => {
430
- before(() => {
431
- sinon.stub(utils, 'get').resolves({ status: 400 });
432
- });
433
-
434
- it('throws a MongoCryptKMSRequestError', async () => {
435
- const error = await loadCredentials({ azure: {} }).catch(e => e);
436
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
437
- expect(error).to.match(/Malformed JSON body in GET request/);
438
- });
439
- });
440
-
441
- context('when the request has a non-json body', () => {
442
- before(() => {
443
- sinon.stub(utils, 'get').resolves({ status: 400, body: 'non-json body' });
444
- });
445
-
446
- it('throws a MongoCryptKMSRequestError', async () => {
447
- const error = await loadCredentials({ azure: {} }).catch(e => e);
448
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
449
- expect(error).to.match(/Malformed JSON body in GET request/);
450
- });
451
- });
452
-
453
- context('when the request has a json body', () => {
454
- beforeEach(() => {
455
- sinon
456
- .stub(utils, 'get')
457
- .resolves({ status: 400, body: '{ "error": "something went wrong" }' });
458
- });
459
-
460
- it('throws a MongoCryptKMSRequestError', async () => {
461
- const error = await loadCredentials({ azure: {} }).catch(e => e);
462
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
463
- });
464
-
465
- it('attaches the body to the error', async () => {
466
- const error = await loadCredentials({ azure: {} }).catch(e => e);
467
- expect(error).to.have.property('body').to.deep.equal({ error: 'something went wrong' });
468
- });
469
- });
470
- });
471
-
472
- context('when the request returns a 200 response', () => {
473
- context('when the request has no body', () => {
474
- before(() => {
475
- sinon.stub(utils, 'get').resolves({ status: 200 });
476
- });
477
-
478
- it('throws a MongoCryptKMSRequestError', async () => {
479
- const error = await loadCredentials({ azure: {} }).catch(e => e);
480
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
481
- expect(error).to.match(/Malformed JSON body in GET request/);
482
- });
483
- });
484
-
485
- context('when the request has a non-json body', () => {
486
- before(() => {
487
- sinon.stub(utils, 'get').resolves({ status: 200, body: 'non-json body' });
488
- });
489
-
490
- it('throws a MongoCryptKMSRequestError', async () => {
491
- const error = await loadCredentials({ azure: {} }).catch(e => e);
492
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
493
- expect(error).to.match(/Malformed JSON body in GET request/);
494
- });
495
- });
496
-
497
- context('when the body has no access_token', () => {
498
- beforeEach(() => {
499
- sinon.stub(utils, 'get').resolves({ status: 200, body: '{ "expires_in": "10000" }' });
500
- });
501
-
502
- it('throws a MongoCryptKMSRequestError', async () => {
503
- const error = await loadCredentials({ azure: {} }).catch(e => e);
504
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
505
- expect(error).to.match(/missing field `access_token/);
506
- });
507
- });
508
-
509
- context('when the body has no expires_in', () => {
510
- beforeEach(() => {
511
- sinon.stub(utils, 'get').resolves({ status: 200, body: '{ "access_token": "token" }' });
512
- });
513
-
514
- it('throws a MongoCryptKMSRequestError', async () => {
515
- const error = await loadCredentials({ azure: {} }).catch(e => e);
516
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
517
- expect(error).to.match(/missing field `expires_in/);
518
- });
519
- });
520
-
521
- context('when expires_in cannot be parsed into a number', () => {
522
- beforeEach(() => {
523
- sinon.stub(utils, 'get').resolves({
524
- status: 200,
525
- body: '{ "access_token": "token", "expires_in": "foo" }'
526
- });
527
- });
528
-
529
- it('throws a MongoCryptKMSRequestError', async () => {
530
- const error = await loadCredentials({ azure: {} }).catch(e => e);
531
- expect(error).to.be.instanceOf(MongoCryptAzureKMSRequestError);
532
- expect(error).to.match(/unable to parse int from `expires_in` field/);
533
- });
534
- });
535
- });
536
-
537
- context('when a valid token was returned', () => {
538
- beforeEach(() => {
539
- sinon
540
- .stub(utils, 'get')
541
- .resolves({ status: 200, body: '{ "access_token": "token", "expires_in": "10000" }' });
542
- });
543
-
544
- it('returns the token in the `azure` field of the kms providers', async () => {
545
- const kmsProviders = await loadCredentials({ azure: {} });
546
- expect(kmsProviders).to.have.property('azure').to.deep.equal({ accessToken: 'token' });
547
- });
548
- });
549
- });
550
- });
551
- });
@@ -1,66 +0,0 @@
1
- 'use strict';
2
- const { expect } = require('chai');
3
- const tar = require('tar');
4
- const cp = require('child_process');
5
- const fs = require('fs');
6
- const pkg = require('../package.json');
7
-
8
- const packFile = `mongodb-client-encryption-${pkg.version}.tgz`;
9
-
10
- const REQUIRED_FILES = [
11
- 'package/binding.gyp',
12
- 'package/CHANGELOG.md',
13
- 'package/index.d.ts',
14
- 'package/lib/index.js',
15
- 'package/lib/autoEncrypter.js',
16
- 'package/lib/buffer_pool.js',
17
- 'package/lib/clientEncryption.js',
18
- 'package/lib/common.js',
19
- 'package/lib/providers/index.js',
20
- 'package/lib/providers/gcp.js',
21
- 'package/lib/providers/aws.js',
22
- 'package/lib/providers/azure.js',
23
- 'package/lib/providers/utils.js',
24
- 'package/lib/cryptoCallbacks.js',
25
- 'package/lib/errors.js',
26
- 'package/lib/mongocryptdManager.js',
27
- 'package/lib/stateMachine.js',
28
- 'package/LICENSE',
29
- 'package/package.json',
30
- 'package/README.md',
31
- 'package/src/mongocrypt.cc',
32
- 'package/src/mongocrypt.h'
33
- ];
34
-
35
- describe(`Release ${packFile}`, function () {
36
- this.timeout(5000);
37
-
38
- let tarFileList;
39
- before(() => {
40
- expect(fs.existsSync(packFile)).to.equal(false);
41
- cp.execSync('npm pack', { stdio: 'ignore' });
42
- tarFileList = [];
43
- tar.list({
44
- file: packFile,
45
- sync: true,
46
- onentry(entry) {
47
- tarFileList.push(entry.path);
48
- }
49
- });
50
- });
51
-
52
- after(() => {
53
- fs.unlinkSync(packFile);
54
- });
55
-
56
- for (const requiredFile of REQUIRED_FILES) {
57
- it(`should contain ${requiredFile}`, () => {
58
- expect(tarFileList).to.includes(requiredFile);
59
- });
60
- }
61
-
62
- it('should not have extraneous files', () => {
63
- const unexpectedFileList = tarFileList.filter(f => !REQUIRED_FILES.some(r => r === f));
64
- expect(unexpectedFileList).to.have.lengthOf(0, `Extra files: ${unexpectedFileList.join(', ')}`);
65
- });
66
- });
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- // Data Key Stuff
4
- const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;
5
- const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;
6
- const AWS_REGION = process.env.AWS_REGION;
7
- const AWS_CMK_ID = process.env.AWS_CMK_ID;
8
-
9
- const awsKmsProviders = {
10
- aws: { accessKeyId: AWS_ACCESS_KEY_ID, secretAccessKey: AWS_SECRET_ACCESS_KEY }
11
- };
12
- const awsDataKeyOptions = { masterKey: { key: AWS_CMK_ID, region: AWS_REGION } };
13
-
14
- const SKIP_LIVE_TESTS = !!process.env.MONGODB_NODE_SKIP_LIVE_TESTS;
15
- const SKIP_AWS_TESTS =
16
- SKIP_LIVE_TESTS || !AWS_ACCESS_KEY_ID || !AWS_SECRET_ACCESS_KEY || !AWS_REGION || !AWS_CMK_ID;
17
-
18
- function isAWSCredentialProviderInstalled() {
19
- try {
20
- require.resolve('@aws-sdk/credential-providers');
21
- return true;
22
- } catch {
23
- return false;
24
- }
25
- }
26
-
27
- function isGCPCredentialProviderInstalled() {
28
- try {
29
- require.resolve('gcp-metadata');
30
- return true;
31
- } catch {
32
- return false;
33
- }
34
- }
35
-
36
- module.exports = {
37
- SKIP_LIVE_TESTS,
38
- SKIP_AWS_TESTS,
39
- KEYS: {
40
- AWS_ACCESS_KEY_ID,
41
- AWS_SECRET_ACCESS_KEY,
42
- AWS_REGION,
43
- AWS_CMK_ID
44
- },
45
- awsKmsProviders,
46
- awsDataKeyOptions,
47
- credentialProvidersInstalled: {
48
- aws: isAWSCredentialProviderInstalled(),
49
- gcp: isGCPCredentialProviderInstalled()
50
- }
51
- };