@@ -2,6 +2,7 @@ import { BSON, EJSON } from 'bson';
22import { expect } from 'chai' ;
33import * as fs from 'fs/promises' ;
44import * as path from 'path' ;
5+ import { satisfies } from 'semver' ;
56
67import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption' ;
78import { getCSFLEKMSProviders } from '../../csfle-kms-providers' ;
@@ -46,6 +47,15 @@ const metadata: MongoDBMetadataUI = {
4647 }
4748} ;
4849
50+ const kmsTlsMetadata : MongoDBMetadataUI = {
51+ requires : {
52+ clientSideEncryption : true ,
53+ topology : '!load-balanced' ,
54+ predicate : ( ) =>
55+ satisfies ( process . version , '<25.0.0' ) ? true : 'TODO(NODE-7252): fix these tests in v25'
56+ }
57+ } ;
58+
4959const eeMetadata : MongoDBMetadataUI = {
5060 requires : {
5161 clientSideEncryption : true ,
@@ -1369,7 +1379,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
13691379 * - Create client encryption expired
13701380 * - Create client encryption invalid hostname
13711381 */
1372- context ( 'KMS TLS Options Tests' , metadata , function ( ) {
1382+ context ( 'KMS TLS Options Tests' , kmsTlsMetadata , function ( ) {
13731383 let clientNoTls ;
13741384 let clientWithTls ;
13751385 let clientWithTlsExpired ;
@@ -1506,7 +1516,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15061516 } ) ;
15071517
15081518 // Case 1.
1509- context ( 'Case 1: AWS' , metadata , function ( ) {
1519+ context ( 'Case 1: AWS' , kmsTlsMetadata , function ( ) {
15101520 const masterKey = {
15111521 region : 'us-east-1' ,
15121522 key : 'arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0' ,
@@ -1515,7 +1525,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15151525 const masterKeyExpired = { ...masterKey , endpoint : '127.0.0.1:9000' } ;
15161526 const masterKeyInvalidHostname = { ...masterKey , endpoint : '127.0.0.1:9001' } ;
15171527
1518- it ( 'should fail with no TLS' , metadata , async function ( ) {
1528+ it ( 'should fail with no TLS' , async function ( ) {
15191529 // NODE-6861: flakiness is caused by mock KMS servers
15201530 this . retries ( 2 ) ;
15211531
@@ -1528,7 +1538,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15281538 }
15291539 } ) ;
15301540
1531- it ( 'should succeed with valid TLS options' , metadata , async function ( ) {
1541+ it ( 'should succeed with valid TLS options' , async function ( ) {
15321542 try {
15331543 await clientEncryptionWithTls . createDataKey ( 'aws' , { masterKey } ) ;
15341544 expect . fail ( 'it must fail to parse response' ) ;
@@ -1551,7 +1561,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15511561 }
15521562 } ) ;
15531563
1554- it ( 'should fail with an invalid hostname' , metadata , async function ( ) {
1564+ it ( 'should fail with an invalid hostname' , async function ( ) {
15551565 try {
15561566 await clientEncryptionWithInvalidHostname . createDataKey ( 'aws' , {
15571567 masterKey : masterKeyInvalidHostname
@@ -1565,13 +1575,13 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15651575 } ) ;
15661576
15671577 // Case 2.
1568- context ( 'Case 2: Azure' , metadata , function ( ) {
1578+ context ( 'Case 2: Azure' , kmsTlsMetadata , function ( ) {
15691579 const masterKey = {
15701580 keyVaultEndpoint : 'doesnotexist.invalid' ,
15711581 keyName : 'foo'
15721582 } ;
15731583
1574- it ( 'should fail with no TLS' , metadata , async function ( ) {
1584+ it ( 'should fail with no TLS' , async function ( ) {
15751585 // NODE-6861: flakiness is caused by mock KMS servers
15761586 this . retries ( 2 ) ;
15771587
@@ -1584,7 +1594,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
15841594 }
15851595 } ) ;
15861596
1587- it ( 'should succeed with valid TLS options' , metadata , async function ( ) {
1597+ it ( 'should succeed with valid TLS options' , async function ( ) {
15881598 try {
15891599 await clientEncryptionWithTls . createDataKey ( 'azure' , { masterKey } ) ;
15901600 expect . fail ( 'it must fail with HTTP 404' ) ;
@@ -1605,7 +1615,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16051615 }
16061616 } ) ;
16071617
1608- it ( 'should fail with an invalid hostname' , metadata , async function ( ) {
1618+ it ( 'should fail with an invalid hostname' , async function ( ) {
16091619 try {
16101620 await clientEncryptionWithInvalidHostname . createDataKey ( 'azure' , { masterKey } ) ;
16111621 expect . fail ( 'it must fail with invalid hostnames' ) ;
@@ -1617,15 +1627,15 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16171627 } ) ;
16181628
16191629 // Case 3.
1620- context ( 'Case 3: GCP' , metadata , function ( ) {
1630+ context ( 'Case 3: GCP' , kmsTlsMetadata , function ( ) {
16211631 const masterKey = {
16221632 projectId : 'foo' ,
16231633 location : 'bar' ,
16241634 keyRing : 'baz' ,
16251635 keyName : 'foo'
16261636 } ;
16271637
1628- it ( 'should fail with no TLS' , metadata , async function ( ) {
1638+ it ( 'should fail with no TLS' , async function ( ) {
16291639 // NODE-6861: flakiness is caused by mock KMS servers
16301640 this . retries ( 2 ) ;
16311641
@@ -1638,7 +1648,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16381648 }
16391649 } ) ;
16401650
1641- it ( 'should succeed with valid TLS options' , metadata , async function ( ) {
1651+ it ( 'should succeed with valid TLS options' , async function ( ) {
16421652 try {
16431653 await clientEncryptionWithTls . createDataKey ( 'gcp' , { masterKey } ) ;
16441654 expect . fail ( 'it must fail with HTTP 404' ) ;
@@ -1659,7 +1669,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16591669 }
16601670 } ) ;
16611671
1662- it ( 'should fail with an invalid hostname' , metadata , async function ( ) {
1672+ it ( 'should fail with an invalid hostname' , async function ( ) {
16631673 try {
16641674 await clientEncryptionWithInvalidHostname . createDataKey ( 'gcp' , { masterKey } ) ;
16651675 expect . fail ( 'it must fail with invalid hostnames' ) ;
@@ -1671,7 +1681,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16711681 } ) ;
16721682
16731683 // Case 4.
1674- context ( 'Case 4: KMIP' , metadata , function ( ) {
1684+ context ( 'Case 4: KMIP' , kmsTlsMetadata , function ( ) {
16751685 const masterKey = { } ;
16761686
16771687 it ( 'should fail with no TLS' , metadata , async function ( ) {
@@ -1699,7 +1709,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
16991709 }
17001710 } ) ;
17011711
1702- it ( 'should fail with an invalid hostname' , metadata , async function ( ) {
1712+ it ( 'should fail with an invalid hostname' , async function ( ) {
17031713 try {
17041714 await clientEncryptionWithInvalidHostname . createDataKey ( 'kmip' , { masterKey } ) ;
17051715 expect . fail ( 'it must fail with invalid hostnames' ) ;
@@ -1717,7 +1727,7 @@ describe('Client Side Encryption Prose Tests', metadata, function () {
17171727 function ( ) { }
17181728 ) . skipReason = 'TODO(NODE-4840): Node does not support any OCSP options' ;
17191729
1720- context ( 'Case 6: named KMS providers apply TLS options' , function ( ) {
1730+ context ( 'Case 6: named KMS providers apply TLS options' , kmsTlsMetadata , function ( ) {
17211731 afterEach ( ( ) => keyvaultClient ?. close ( ) ) ;
17221732 beforeEach ( async function ( ) {
17231733 const shouldSkip = this . configuration . filters . ClientSideEncryptionFilter . filter ( {
0 commit comments