Skip to content

Commit e50cbab

Browse files
committed
Packages: update to remove CVE dependencies
This bumps *testing* (not the core package) to net8.0 for an easier time maintaining and updates packages outside StackExchange.Redis except for `Microsoft.Bcl.AsyncInterfaces`. `Microsoft.Bcl.AsyncInterfaces` was bumped from 5.0.0 to 6.0.0 due to deprecation warnings, still maintaining widest compatibility we can.
1 parent 11ef77d commit e50cbab

File tree

11 files changed

+70
-52
lines changed

11 files changed

+70
-52
lines changed

Directory.Packages.props

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
<Project>
22
<ItemGroup>
33
<!-- Packages we depend on for StackExchange.Redis, upgrades can create binding redirect pain! -->
4-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" />
4+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
5+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
56
<PackageVersion Include="Pipelines.Sockets.Unofficial" Version="2.2.8" />
67
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="5.0.0" />
78
<PackageVersion Include="System.Threading.Channels" Version="5.0.0" />
89
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
910
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
1011

1112
<!-- Packages only used in the solution, upgrade at will -->
12-
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
13+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
1314
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
1415
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.4" />
15-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
16-
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
17-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
16+
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
17+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
1818
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
19-
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.141" />
19+
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.146" />
2020
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
21-
<PackageVersion Include="NSubstitute" Version="5.1.0" />
21+
<PackageVersion Include="NSubstitute" Version="5.3.0" />
2222
<PackageVersion Include="StackExchange.Redis" Version="2.6.96" />
2323
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
24+
<PackageVersion Include="System.Collections.Immutable" Version="9.0.0" />
25+
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.0" />
2426
<!-- For binding redirect testing, main package gets this transitively -->
25-
<PackageVersion Include="System.IO.Pipelines" Version="5.0.1" />
26-
<PackageVersion Include="System.Runtime.Caching" Version="5.0.0" />
27-
<PackageVersion Include="xunit" Version="2.9.0" />
27+
<PackageVersion Include="System.IO.Pipelines" Version="9.0.0" />
28+
<PackageVersion Include="System.Runtime.Caching" Version="9.0.0" />
29+
<PackageVersion Include="xunit" Version="2.9.2" />
2830
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
2931
</ItemGroup>
3032
</Project>

tests/BasicTest/BasicTest.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>StackExchange.Redis.BasicTest .NET Core</Description>
5-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net472;net8.0</TargetFrameworks>
66
<AssemblyName>BasicTest</AssemblyName>
77
<OutputType>Exe</OutputType>
88
<PackageId>BasicTest</PackageId>
@@ -11,6 +11,9 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="BenchmarkDotNet" />
14+
<PackageReference Include="System.Collections.Immutable" />
15+
<PackageReference Include="System.Reflection.Metadata" />
16+
1417
<ProjectReference Include="..\..\src\StackExchange.Redis\StackExchange.Redis.csproj" />
1518
</ItemGroup>
1619

tests/BasicTestBaseline/BasicTestBaseline.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>StackExchange.Redis.BasicTest .NET Core</Description>
5-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net472;net8.0</TargetFrameworks>
66
<AssemblyName>BasicTestBaseline</AssemblyName>
77
<OutputType>Exe</OutputType>
88
<PackageId>BasicTestBaseline</PackageId>
@@ -17,6 +17,8 @@
1717
<ItemGroup>
1818
<PackageReference Include="BenchmarkDotNet" />
1919
<PackageReference Include="StackExchange.Redis" />
20+
<PackageReference Include="System.Collections.Immutable" />
21+
<PackageReference Include="System.Reflection.Metadata" />
2022
</ItemGroup>
2123

2224
</Project>

tests/ConsoleTest/ConsoleTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>

tests/ConsoleTestBaseline/ConsoleTestBaseline.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>

tests/StackExchange.Redis.Tests/ConfigTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ public void ExpectedFields()
9292
[Fact]
9393
public void SslProtocols_SingleValue()
9494
{
95-
var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11");
96-
Assert.Equal(SslProtocols.Tls11, options.SslProtocols.GetValueOrDefault());
95+
var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls12");
96+
Assert.Equal(SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
9797
}
9898

9999
[Fact]
100100
public void SslProtocols_MultipleValues()
101101
{
102-
var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls11|Tls12");
103-
Assert.Equal(SslProtocols.Tls11 | SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
102+
var options = ConfigurationOptions.Parse("myhost,sslProtocols=Tls12|Tls13");
103+
Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, options.SslProtocols.GetValueOrDefault());
104104
}
105105

106106
[Theory]
@@ -121,9 +121,9 @@ public void SslProtocols_UsingIntegerValue()
121121
// The below scenario is for cases where the *targeted*
122122
// .NET framework version (e.g. .NET 4.0) doesn't define an enum value (e.g. Tls11)
123123
// but the OS has been patched with support
124-
const int integerValue = (int)(SslProtocols.Tls11 | SslProtocols.Tls12);
124+
const int integerValue = (int)(SslProtocols.Tls12 | SslProtocols.Tls13);
125125
var options = ConfigurationOptions.Parse("myhost,sslProtocols=" + integerValue);
126-
Assert.Equal(SslProtocols.Tls11 | SslProtocols.Tls12, options.SslProtocols.GetValueOrDefault());
126+
Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, options.SslProtocols.GetValueOrDefault());
127127
}
128128

129129
[Fact]
@@ -203,7 +203,7 @@ public void ConfigurationOptionsIPv6Parsing(string configString, AddressFamily f
203203
public void CanParseAndFormatUnixDomainSocket()
204204
{
205205
const string ConfigString = "!/some/path,allowAdmin=True";
206-
#if NET472
206+
#if NETFRAMEWORK
207207
var ex = Assert.Throws<PlatformNotSupportedException>(() => ConfigurationOptions.Parse(ConfigString));
208208
Assert.Equal("Unix domain sockets require .NET Core 3 or above", ex.Message);
209209
#else
@@ -793,6 +793,6 @@ public void CheckHighIntegrity(bool? assigned, bool expected, string cs)
793793
Assert.Equal(cs, clone.ToString());
794794

795795
var parsed = ConfigurationOptions.Parse(cs);
796-
Assert.Equal(expected, options.HighIntegrity);
796+
Assert.Equal(expected, parsed.HighIntegrity);
797797
}
798798
}

tests/StackExchange.Redis.Tests/SSLTests.cs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
using System.Net;
88
using System.Net.Security;
99
using System.Reflection;
10+
using System.Runtime.InteropServices;
1011
using System.Security.Authentication;
1112
using System.Security.Cryptography.X509Certificates;
1213
using System.Text;
1314
using System.Threading.Tasks;
15+
using NSubstitute.Exceptions;
1416
using StackExchange.Redis.Tests.Helpers;
1517
using Xunit;
1618
using Xunit.Abstractions;
@@ -182,34 +184,35 @@ public async Task ConnectToSSLServer(bool useSsl, bool specifyHost)
182184
[InlineData(SslProtocols.Ssl3 | SslProtocols.Tls12 | SslProtocols.Tls13, true)]
183185
[InlineData(SslProtocols.Ssl2, false, TlsCipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TlsCipherSuite.TLS_AES_256_GCM_SHA384)]
184186
#pragma warning restore CS0618 // Type or member is obsolete
187+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "Yes, we know.")]
185188
public async Task ConnectSslClientAuthenticationOptions(SslProtocols protocols, bool expectSuccess, params TlsCipherSuite[] tlsCipherSuites)
186189
{
187190
Fixture.SkipIfNoServer();
188191

189-
var config = new ConfigurationOptions()
192+
try
190193
{
191-
EndPoints = { TestConfig.Current.SslServerAndPort },
192-
AllowAdmin = true,
193-
ConnectRetry = 1,
194-
SyncTimeout = Debugger.IsAttached ? int.MaxValue : 5000,
195-
Ssl = true,
196-
SslClientAuthenticationOptions = host => new SslClientAuthenticationOptions()
194+
var config = new ConfigurationOptions()
197195
{
198-
TargetHost = host,
199-
CertificateRevocationCheckMode = X509RevocationMode.NoCheck,
200-
EnabledSslProtocols = protocols,
201-
CipherSuitesPolicy = tlsCipherSuites?.Length > 0 ? new CipherSuitesPolicy(tlsCipherSuites) : null,
202-
RemoteCertificateValidationCallback = (sender, cert, chain, errors) =>
196+
EndPoints = { TestConfig.Current.SslServerAndPort },
197+
AllowAdmin = true,
198+
ConnectRetry = 1,
199+
SyncTimeout = Debugger.IsAttached ? int.MaxValue : 5000,
200+
Ssl = true,
201+
SslClientAuthenticationOptions = host => new SslClientAuthenticationOptions()
203202
{
204-
Log(" Errors: " + errors);
205-
Log(" Cert issued to: " + cert?.Subject);
206-
return true;
203+
TargetHost = host,
204+
CertificateRevocationCheckMode = X509RevocationMode.NoCheck,
205+
EnabledSslProtocols = protocols,
206+
CipherSuitesPolicy = tlsCipherSuites?.Length > 0 ? new CipherSuitesPolicy(tlsCipherSuites) : null,
207+
RemoteCertificateValidationCallback = (sender, cert, chain, errors) =>
208+
{
209+
Log(" Errors: " + errors);
210+
Log(" Cert issued to: " + cert?.Subject);
211+
return true;
212+
},
207213
},
208-
},
209-
};
214+
};
210215

211-
try
212-
{
213216
if (expectSuccess)
214217
{
215218
using var conn = await ConnectionMultiplexer.ConnectAsync(config, Writer);
@@ -376,12 +379,12 @@ public void SSLHostInferredFromEndpoints()
376379
},
377380
Ssl = true,
378381
};
379-
Assert.True(options.SslHost == "mycache.rediscache.windows.net");
382+
Assert.Equal("mycache.rediscache.windows.net", options.SslHost);
380383
options = new ConfigurationOptions()
381384
{
382385
EndPoints = { { "121.23.23.45", 15000 } },
383386
};
384-
Assert.True(options.SslHost == null);
387+
Assert.Null(options.SslHost);
385388
}
386389

387390
private void Check(string name, object? x, object? y)
@@ -528,7 +531,7 @@ public void SSLParseViaConfig_Issue883_ConfigString()
528531
[Fact]
529532
public void ConfigObject_Issue1407_ToStringIncludesSslProtocols()
530533
{
531-
const SslProtocols sslProtocols = SslProtocols.Tls12 | SslProtocols.Tls;
534+
const SslProtocols sslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13;
532535
var sourceOptions = new ConfigurationOptions
533536
{
534537
AbortOnConnectFail = false,

tests/StackExchange.Redis.Tests/ServerSnapshotTests.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Diagnostics.CodeAnalysis;
23
using System.Linq;
34
using System.Runtime.Serialization;
45
using Xunit;
@@ -9,9 +10,11 @@ namespace StackExchange.Redis.Tests;
910
public class ServerSnapshotTests
1011
{
1112
[Fact]
12-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
13-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2013:Do not use equality check to check for collection size.", Justification = "Explicit testing")]
14-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
13+
[SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
14+
[SuppressMessage("Assertions", "xUnit2013:Do not use equality check to check for collection size.", Justification = "Explicit testing")]
15+
[SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
16+
[SuppressMessage("Performance", "CA1829:Use Length/Count property instead of Count() when available", Justification = "Explicit testing")]
17+
[SuppressMessage("Performance", "CA1860:Avoid using 'Enumerable.Any()' extension method", Justification = "Explicit testing")]
1518
public void EmptyBehaviour()
1619
{
1720
var snapshot = ServerSnapshot.Empty;
@@ -52,14 +55,19 @@ public void EmptyBehaviour()
5255
[InlineData(5, 0)]
5356
[InlineData(5, 3)]
5457
[InlineData(5, 5)]
55-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
56-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
58+
[SuppressMessage("Assertions", "xUnit2012:Do not use boolean check to check if a value exists in a collection", Justification = "Explicit testing")]
59+
[SuppressMessage("Assertions", "xUnit2029:Do not use Empty() to check if a value does not exist in a collection", Justification = "Explicit testing")]
60+
[SuppressMessage("Assertions", "xUnit2030:Do not use Assert.NotEmpty to check if a value exists in a collection", Justification = "Explicit testing")]
61+
[SuppressMessage("Performance", "CA1829:Use Length/Count property instead of Count() when available", Justification = "Explicit testing")]
62+
[SuppressMessage("Performance", "CA1860:Avoid using 'Enumerable.Any()' extension method", Justification = "Explicit testing")]
5763
public void NonEmptyBehaviour(int count, int replicaCount)
5864
{
5965
var snapshot = ServerSnapshot.Empty;
6066
for (int i = 0; i < count; i++)
6167
{
68+
#pragma warning disable SYSLIB0050 // Type or member is obsolete
6269
var dummy = (ServerEndPoint)FormatterServices.GetSafeUninitializedObject(typeof(ServerEndPoint));
70+
#pragma warning restore SYSLIB0050 // Type or member is obsolete
6371
dummy.IsReplica = i < replicaCount;
6472
snapshot = snapshot.Add(dummy);
6573
}

tests/StackExchange.Redis.Tests/StackExchange.Redis.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net481;net8.0</TargetFrameworks>
44
<AssemblyName>StackExchange.Redis.Tests</AssemblyName>
55
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
66
<SignAssembly>true</SignAssembly>

toys/TestConsole/TestConsole.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net6.0;net472</TargetFrameworks>
5+
<TargetFrameworks>net8.0;net472</TargetFrameworks>
66
<DefineConstants>SEV2</DefineConstants>
77
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
88
</PropertyGroup>

0 commit comments

Comments
 (0)