Skip to content

Commit 14e046f

Browse files
committed
CSHARP-2279: Disable certificate revocation checking by default
1 parent aca20b6 commit 14e046f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

Release Notes/Release Notes v2.7.0.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
An online version of these release notes is available at:
77

8-
https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v2.7.0.md
8+
<https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v2.7.0.md>
99

1010
The full list of JIRA issues that are currently scheduled to be resolved in this release is available at:
1111

12-
https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.7.0%20ORDER%20BY%20key%20ASC
12+
<https://jira.mongodb.org/issues/?jql=project%20%3D%20CSHARP%20AND%20fixVersion%20%3D%202.7.0%20ORDER%20BY%20key%20ASC>
1313

1414
The list may change as we approach the release date.
1515

1616
Documentation on the .NET driver can be found at:
1717

18-
http://mongodb.github.io/mongo-csharp-driver/
18+
<http://mongodb.github.io/mongo-csharp-driver/>
1919

20-
Upgrading
21-
22-
There are no known backwards breaking changes in this release.
20+
## Upgrading
21+
* The .NET Driver now **disables** certificate revocation checking by default, setting `CheckCertificateRevocation` in `SslSettings` to `false` by default. Any applications relying on the older default of `true` now must explicitly set `CheckCertificateRevocation` to `true` in in `SslSettings` to re-enable certificate revocation checking.
22+
* Previously, the driver enabled certificate revocation checking by default, in contrast to the `mongo` shell and other MongoDB drivers. This was also in contrast to .NET's defaults for `SslStream` (see .NET Framework documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.net.security.sslstream.authenticateasclient?view=netframework-4.7.2#System_Net_Security_SslStream_AuthenticateAsClient_System_String_) and .NET Standard documentation [here](https://docs.microsoft.com/en-us/dotnet/api/system.net.security.sslstream.authenticateasclient?view=netstandard-2.0#System_Net_Security_SslStream_AuthenticateAsClient_System_String_)).

src/MongoDB.Driver.Core/Core/Configuration/SslStreamSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public SslStreamSettings(
5050
Optional<SslProtocols> enabledProtocols = default(Optional<SslProtocols>),
5151
Optional<RemoteCertificateValidationCallback> serverCertificateValidationCallback = default(Optional<RemoteCertificateValidationCallback>))
5252
{
53-
_checkCertificateRevocation = checkCertificateRevocation.WithDefault(true);
53+
_checkCertificateRevocation = checkCertificateRevocation.WithDefault(false);
5454
_clientCertificates = Ensure.IsNotNull(clientCertificates.WithDefault(Enumerable.Empty<X509Certificate>()), "clientCertificates").ToList();
5555
_clientCertificateSelectionCallback = clientCertificateSelectionCallback.WithDefault(null);
5656
_enabledSslProtocols = enabledProtocols.WithDefault(SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls);

src/MongoDB.Driver/SslSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class SslSettings : IEquatable<SslSettings>
3434
private static readonly IEqualityComparer<X509CertificateCollection> __certificateCollectionEqualityComparer = new X509CertificateCollectionEqualityComparer();
3535

3636
// private fields
37-
private bool _checkCertificateRevocation = true;
37+
private bool _checkCertificateRevocation = false;
3838
private X509CertificateCollection _clientCertificateCollection;
3939
private LocalCertificateSelectionCallback _clientCertificateSelectionCallback;
4040
private SslProtocols _enabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls;

tests/MongoDB.Driver.Core.Tests/Core/Configuration/SslStreamSettingsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void constructor_should_initialize_instance()
3131
{
3232
var subject = new SslStreamSettings();
3333

34-
subject.CheckCertificateRevocation.Should().BeTrue();
34+
subject.CheckCertificateRevocation.Should().BeFalse();
3535
subject.ClientCertificates.Should().BeEmpty();
3636
subject.ClientCertificateSelectionCallback.Should().BeNull();
3737
subject.EnabledSslProtocols.Should().Be(SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls);

tests/MongoDB.Driver.Tests/SslSettingsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private bool ServerCertificateValidationCallback(
5050
public void TestCheckCertificateRevocation()
5151
{
5252
var settings = new SslSettings();
53-
Assert.Equal(true, settings.CheckCertificateRevocation);
53+
Assert.Equal(false, settings.CheckCertificateRevocation);
5454

5555
var checkCertificateRevocation = !settings.CheckCertificateRevocation;
5656
settings.CheckCertificateRevocation = checkCertificateRevocation;
@@ -115,7 +115,7 @@ public void TestClone()
115115
public void TestDefaults()
116116
{
117117
var settings = new SslSettings();
118-
Assert.Equal(true, settings.CheckCertificateRevocation);
118+
Assert.Equal(false, settings.CheckCertificateRevocation);
119119
Assert.Equal(null, settings.ClientCertificates);
120120
Assert.Equal(null, settings.ClientCertificateSelectionCallback);
121121
Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls, settings.EnabledSslProtocols);

0 commit comments

Comments
 (0)