Remove Windows 7 support code from System.Net.Security#124555
Conversation
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
- SslCertificateTrust.cs: Replace IsWindowsVersionAtLeast(6, 2) with IsWindows() - SslAuthenticationOptions.cs: Remove obsolete comment about SSL2 on pre-Win10 - ExtendedProtectionPolicy.cs: Update "Win7+" comment to "Windows" - SslStreamPal.Windows.cs: Update legacy API comment to "older Windows 10" - TestConfiguration.cs: Remove dead pre-Win10 null encryption branch - SslStreamSystemDefaultsTest.cs: Simplify WindowsVersion >= 10 to IsWindows - SslStreamCredentialCacheTest.cs: Update Win8 behavior comment Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
...t.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
There was a problem hiding this comment.
Pull request overview
Removes Windows 7–specific branches and updates related comments in System.Net.Security, simplifying runtime and test logic now that Win7 is out of support.
Changes:
- Simplify Windows gating logic (e.g., remove Win7-era version checks) and delete now-unused
usingdirectives. - Update/clarify platform-specific comments around Schannel credential paths and ExtendedProtection support assumptions.
- Simplify test platform gating logic for Windows-specific behaviors.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Net.Security/src/System/Net/Security/SslCertificateTrust.cs | Removes Win7 version guard for “send trust in handshake” capability (now Windows vs non-Windows). |
| src/libraries/System.Net.Security/src/System/Net/Security/SslAuthenticationOptions.cs | Removes outdated Windows-version-specific comment in SSL2/TLS1.2 filtering logic. |
| src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicy.cs | Updates comment to reflect current supported Windows baselines. |
| src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs | Adjusts comment describing the legacy Schannel credential path. |
| src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs | Removes dead Windows version branch for null-encryption detection; updates comment. |
| src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamSystemDefaultsTest.cs | Simplifies Windows condition gating a hash-algorithm assertion. |
| src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamCredentialCacheTest.cs | Updates Windows behavior comment regarding trusted issuers list behavior. |
Comments suppressed due to low confidence (1)
src/libraries/System.Net.Security/tests/FunctionalTests/TestConfiguration.cs:49
- SupportsNullEncryption: this starts PowerShell with RedirectStandardError=true but never reads StandardError or checks ExitCode. If Get-TlsCipherSuite fails (e.g., cmdlet missing/blocked), StandardOutput will be empty and this will incorrectly return false (skipping null-encryption tests) instead of falling back to the "assume availability" path. Consider draining StandardError and/or treating non-zero exit code / any stderr output as an indeterminate failure and returning true (or explicitly detecting the cmdlet with Get-Command).
// Null encryption may be disabled in Azure images
using (Process p = Process.Start(new ProcessStartInfo("powershell", "-Command Get-TlsCipherSuite") { RedirectStandardOutput = true, RedirectStandardError = true }))
{
using StreamReader reader = p.StandardOutput;
return reader.ReadToEnd().Contains("WITH_NULL");
}
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
|
I am sure there is more code that could be removed/simplified, but it would require closer scrutiny to identify these parts. I might try to dig out more as a follow up if I have time. |
…treamPal.Windows.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot The SslStreamPal.Unix.cs seems to have changes on all lines, can you revert any whitespace/crlf changes you did to that file? |
- Revert whitespace/CRLF changes in SslStreamPal.Windows.cs - Revert whitespace/CRLF changes in ExtendedProtectionPolicy.cs - Apply @jkotas suggestion for SslStreamPal.Windows.cs comment - Apply @jkotas suggestion for ExtendedProtectionPolicy.cs comment Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
The CRLF issue was actually on Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/ba-g Test failures are unrelated |
Description
Windows 7 is no longer a supported OS. Remove Win7-specific code paths, dead branches, and outdated comments from System.Net.Security.
Product code
SslCertificateTrust.cs: ReplaceIsWindowsVersionAtLeast(6, 2)guard withIsWindows()— the version check only excluded Win7, which is no longer reachable. Remove unusedSystem.Runtime.Versioningusing.SslAuthenticationOptions.cs: Remove comment about SSL2+TLS1.2 incompatibility on pre-Win10 (code stays, it's still correct).ExtendedProtectionPolicy.cs: Update comment to clarify ExtendedProtection is supported on all Windows versions supported by current .NET version.SslStreamPal.Windows.cs: Clarify legacySCHANNEL_CREDcomment — it's for older Windows versions, not specific to Win7.Test code
TestConfiguration.cs: Remove dead!PlatformDetection.IsWindows10OrLaterbranch in null encryption detection.SslStreamSystemDefaultsTest.cs: SimplifyIsWindows && WindowsVersion >= 10toIsWindows.SslStreamCredentialCacheTest.cs: Update comment referencing Win8 behavioral change from Win7.Note: The
SCHANNEL_CRED/UseNewCryptoApidual-path remains — it serves Win10 builds before 18836 (pre-TLS 1.3), not Win7.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.