-
Notifications
You must be signed in to change notification settings - Fork 5.6k
update SSL tests to deal better with disabled protocols #65120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9f2b1a1
318518c
6dddb96
36b4b36
bd6ee9c
429d7da
d1ad211
212fa5b
76a485a
c4add0d
371f08b
bc8c739
34cfde3
c5eb617
63e9638
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |
| using System.Security.Cryptography.X509Certificates; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
|
|
||
| using Microsoft.DotNet.XUnitExtensions; | ||
| using Xunit; | ||
| using Xunit.Abstractions; | ||
|
|
||
|
|
@@ -43,13 +43,19 @@ public async Task ServerAsyncAuthenticate_EachSupportedProtocol_Success(SslProto | |
| await ServerAsyncSslHelper(protocol, protocol); | ||
| } | ||
|
|
||
| [Theory] | ||
| [ConditionalTheory] | ||
| [MemberData(nameof(ProtocolMismatchData))] | ||
| public async Task ServerAsyncAuthenticate_MismatchProtocols_Fails( | ||
| SslProtocols serverProtocol, | ||
| SslProtocols clientProtocol, | ||
| Type expectedException) | ||
| { | ||
|
|
||
| if ((serverProtocol & SslProtocolSupport.SupportedSslProtocols) == 0) | ||
| { | ||
| throw new SkipTestException($"None of '{serverProtocol}' requested versions is available"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't mind the check, but this shouldn't happen should it? Based on the checks in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two parts. The one side is guarded but the other is not. So we would not start server on unsupported version but the client can be anything. We could possibly change that as well. We have tests where the client part is set of allowed protocols and the test would work as far as any of them is available. It is also somewhat more complicated as the protocol may not be supported by the SSL stack but on this case the server does support but it is disabled in registry. And when it does, some of the call fail with WIn32Exception. There is also some variations I run into on Linux: The protocols may not be disabled explicitly but all the ciphers suites used by it may - as deemed weak. In that case the API calls succeed but then the negotiation fails with protocol mismatch. Perhaps we should construct this automatically e.g. create disjoined sets from all supported protocols. |
||
| } | ||
|
|
||
| Exception e = await Record.ExceptionAsync( | ||
| () => | ||
| { | ||
|
|
@@ -236,7 +242,7 @@ public async Task ServerAsyncAuthenticate_ConstructorVerificationDelegate_Succes | |
|
|
||
| (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); | ||
| var client = new SslStream(clientStream); | ||
| var server = new SslStream(serverStream, false, (sender, certificate, chain, sslPolicyErrors) => { validationCallbackCalled = true; return true;}); | ||
| var server = new SslStream(serverStream, false, (sender, certificate, chain, sslPolicyErrors) => { validationCallbackCalled = true; return true; }); | ||
|
|
||
| using (client) | ||
| using (server) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,10 @@ public async Task ServerNoEncryption_ClientNoEncryption_ConnectWithNoEncryption( | |
| else | ||
| { | ||
| var ae = await Assert.ThrowsAsync<AuthenticationException>(() => sslStream.AuthenticateAsClientAsync("localhost", null, SslProtocolSupport.DefaultSslProtocols, false)); | ||
| Assert.IsType<PlatformNotSupportedException>(ae.InnerException); | ||
| if (!OperatingSystem.IsWindows()) | ||
| { | ||
| Assert.IsType<PlatformNotSupportedException>(ae.InnerException); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this correlates anyhow with the new check for
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not necessarily. I'm not sure where the expected |
||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.