Skip to content

Commit a09212a

Browse files
authored
refactor(NODE-3922): remove behaviour around ocsp tls options (#4577)
1 parent bff57ed commit a09212a

File tree

4 files changed

+23
-31
lines changed

4 files changed

+23
-31
lines changed

src/client-side-encryption/state_machine.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,7 @@ const stateToString = new Map([
6868
const INSECURE_TLS_OPTIONS = [
6969
'tlsInsecure',
7070
'tlsAllowInvalidCertificates',
71-
'tlsAllowInvalidHostnames',
72-
73-
// These options are disallowed by the spec, so we explicitly filter them out if provided, even
74-
// though the StateMachine does not declare support for these options.
75-
'tlsDisableOCSPEndpointCheck',
76-
'tlsDisableCertificateRevocationCheck'
71+
'tlsAllowInvalidHostnames'
7772
];
7873

7974
/**

src/connection_string.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ function checkTLSOptions(allOptions: CaseInsensitiveMap): void {
172172
};
173173
check('tlsInsecure', 'tlsAllowInvalidCertificates');
174174
check('tlsInsecure', 'tlsAllowInvalidHostnames');
175-
check('tlsInsecure', 'tlsDisableCertificateRevocationCheck');
176-
check('tlsInsecure', 'tlsDisableOCSPEndpointCheck');
177-
check('tlsAllowInvalidCertificates', 'tlsDisableCertificateRevocationCheck');
178-
check('tlsAllowInvalidCertificates', 'tlsDisableOCSPEndpointCheck');
179-
check('tlsDisableCertificateRevocationCheck', 'tlsDisableOCSPEndpointCheck');
180175
}
181176
function getBoolean(name: string, value: unknown): boolean {
182177
if (typeof value === 'boolean') return value;

test/unit/assorted/uri_options.spec.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ describe('URI option spec tests', function () {
1010
// Skipped because this does not apply to Node
1111
'Valid options specific to single-threaded drivers are parsed correctly',
1212

13-
// TODO(NODE-3922): have not implemented option support
13+
// These options are specific to OCSP which the driver does not implement
14+
// and will not be implemented in the future. Note that the other URI
15+
// option tests that are testing these options are passing, simply because
16+
// they are testing error conditions and the driver is throwing a MongoParseError
17+
// when either of these options are provided.
1418
'tlsDisableCertificateRevocationCheck can be set to true',
1519
'tlsDisableCertificateRevocationCheck can be set to false',
1620
'tlsDisableOCSPEndpointCheck can be set to true',

test/unit/client-side-encryption/state_machine.test.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -190,27 +190,25 @@ describe('StateMachine', function () {
190190

191191
context('when tls options are provided', function () {
192192
context('when the options are insecure', function () {
193-
[
194-
'tlsInsecure',
195-
'tlsAllowInvalidCertificates',
196-
'tlsAllowInvalidHostnames',
197-
'tlsDisableOCSPEndpointCheck',
198-
'tlsDisableCertificateRevocationCheck'
199-
].forEach(function (option) {
200-
context(`when the option is ${option}`, function () {
201-
const stateMachine = new StateMachine({
202-
tlsOptions: { aws: { [option]: true } }
203-
} as any);
204-
const request = new MockRequest(Buffer.from('foobar'), 500);
205-
206-
it('rejects with the validation error', function (done) {
207-
stateMachine.kmsRequest(request).catch(err => {
208-
expect(err.message).to.equal(`Insecure TLS options prohibited for aws: ${option}`);
209-
done();
193+
['tlsInsecure', 'tlsAllowInvalidCertificates', 'tlsAllowInvalidHostnames'].forEach(
194+
function (option) {
195+
context(`when the option is ${option}`, function () {
196+
const stateMachine = new StateMachine({
197+
tlsOptions: { aws: { [option]: true } }
198+
} as any);
199+
const request = new MockRequest(Buffer.from('foobar'), 500);
200+
201+
it('rejects with the validation error', function (done) {
202+
stateMachine.kmsRequest(request).catch(err => {
203+
expect(err.message).to.equal(
204+
`Insecure TLS options prohibited for aws: ${option}`
205+
);
206+
done();
207+
});
210208
});
211209
});
212-
});
213-
});
210+
}
211+
);
214212
});
215213

216214
context('when the options are secure', function () {

0 commit comments

Comments
 (0)