Skip to content

Commit f9b5677

Browse files
authored
feat(NODE-5287): deprecate ssl options (#3743)
1 parent 777d57b commit f9b5677

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

src/connection_string.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,35 +1097,46 @@ export const OPTIONS = {
10971097
type: 'boolean'
10981098
},
10991099
sslCA: {
1100+
deprecated:
1101+
'sslCA is deprecated and will be removed in the next major version. Please use tlsCAFile instead.',
11001102
target: 'ca',
11011103
transform({ values: [value] }) {
11021104
return fs.readFileSync(String(value), { encoding: 'ascii' });
11031105
}
11041106
},
11051107
sslCRL: {
1108+
deprecated:
1109+
'sslCRL is deprecated and will be removed in the next major version. Please use tlsCertificateKeyFile instead.',
11061110
target: 'crl',
11071111
transform({ values: [value] }) {
11081112
return fs.readFileSync(String(value), { encoding: 'ascii' });
11091113
}
11101114
},
11111115
sslCert: {
1116+
deprecated:
1117+
'sslCert is deprecated and will be removed in the next major version. Please use tlsCertificateKeyFile instead.',
11121118
target: 'cert',
11131119
transform({ values: [value] }) {
11141120
return fs.readFileSync(String(value), { encoding: 'ascii' });
11151121
}
11161122
},
11171123
sslKey: {
1124+
deprecated:
1125+
'sslKey is deprecated and will be removed in the next major version. Please use tlsCertificateKeyFile instead.',
11181126
target: 'key',
11191127
transform({ values: [value] }) {
11201128
return fs.readFileSync(String(value), { encoding: 'ascii' });
11211129
}
11221130
},
11231131
sslPass: {
1124-
deprecated: true,
1132+
deprecated:
1133+
'sslPass is deprecated and will be removed in the next major version. Please use tlsCertificateKeyFilePassword instead.',
11251134
target: 'passphrase',
11261135
type: 'string'
11271136
},
11281137
sslValidate: {
1138+
deprecated:
1139+
'sslValidate is deprecated and will be removed in the next major version. Please use tlsAllowInvalidCertificates instead.',
11291140
target: 'rejectUnauthorized',
11301141
type: 'boolean'
11311142
},
@@ -1153,6 +1164,8 @@ export const OPTIONS = {
11531164
}
11541165
},
11551166
tlsCertificateFile: {
1167+
deprecated:
1168+
'tlsCertificateFile is deprecated and will be removed in the next major version. Please use tlsCertificateKeyFile instead.',
11561169
target: 'cert',
11571170
transform({ values: [value] }) {
11581171
return fs.readFileSync(String(value), { encoding: 'ascii' });

src/mongo_client.ts

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
108108
tls?: boolean;
109109
/** A boolean to enable or disables TLS/SSL for the connection. (The ssl option is equivalent to the tls option.) */
110110
ssl?: boolean;
111-
/** Specifies the location of a local TLS Certificate */
111+
/**
112+
* Specifies the location of a local TLS Certificate
113+
* @deprecated Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
114+
*/
112115
tlsCertificateFile?: string;
113116
/** Specifies the location of a local .pem file that contains either the client's TLS/SSL certificate and key or only the client's TLS/SSL key when tlsCertificateFile is used to provide the certificate. */
114117
tlsCertificateKeyFile?: string;
@@ -208,17 +211,35 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
208211
* @see https://www.mongodb.com/docs/manual/reference/write-concern/
209212
*/
210213
writeConcern?: WriteConcern | WriteConcernSettings;
211-
/** Validate mongod server certificate against Certificate Authority */
214+
/**
215+
* Validate mongod server certificate against Certificate Authority
216+
* @deprecated Will be removed in the next major version. Please use tlsAllowInvalidCertificates instead.
217+
*/
212218
sslValidate?: boolean;
213-
/** SSL Certificate file path. */
219+
/**
220+
* SSL Certificate file path.
221+
* @deprecated Will be removed in the next major version. Please use tlsCAFile instead.
222+
*/
214223
sslCA?: string;
215-
/** SSL Certificate file path. */
224+
/**
225+
* SSL Certificate file path.
226+
* @deprecated Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
227+
*/
216228
sslCert?: string;
217-
/** SSL Key file file path. */
229+
/**
230+
* SSL Key file file path.
231+
* @deprecated Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
232+
*/
218233
sslKey?: string;
219-
/** SSL Certificate pass phrase. */
234+
/**
235+
* SSL Certificate pass phrase.
236+
* @deprecated Will be removed in the next major version. Please use tlsCertificateKeyFilePassword instead.
237+
*/
220238
sslPass?: string;
221-
/** SSL Certificate revocation list file path. */
239+
/**
240+
* SSL Certificate revocation list file path.
241+
* @deprecated Will be removed in the next major version. Please use tlsCertificateKeyFile instead.
242+
*/
222243
sslCRL?: string;
223244
/** TCP Connection no delay */
224245
noDelay?: boolean;

0 commit comments

Comments
 (0)