Skip to content

Commit e4e05a0

Browse files
aygalinclukebakken
andauthored
chore: bump regular System.Text.RegularExpressions due to a known CVE in earlier versions (#1735)
* * Bump regular System.Text.RegularExpressions due to detected cve * Increment the nuget cache version to invalidate the cache * Add `Directory.Packages.props` to GHA NuGet cache * * Set `TestTfmsInParallel` to `false` --------- Co-authored-by: Luke Bakken <[email protected]>
1 parent 58ac949 commit e4e05a0

File tree

8 files changed

+37
-10
lines changed

8 files changed

+37
-10
lines changed

.github/workflows/build-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
path: |
2121
~/.nuget/packages
2222
~/AppData/Local/NuGet/v3-cache
23-
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
23+
key: ${{ runner.os }}-v2-nuget-${{ hashFiles('**/*.csproj','projects/Directory.Packages.props') }}
2424
restore-keys: |
25-
${{ runner.os }}-v1-nuget-
25+
${{ runner.os }}-v2-nuget-
2626
- name: Build (Debug)
2727
run: dotnet build ${{ github.workspace }}\Build.csproj
2828
- name: Verify
@@ -142,9 +142,9 @@ jobs:
142142
path: |
143143
~/.nuget/packages
144144
~/.local/share/NuGet/v3-cache
145-
key: ${{ runner.os }}-v1-nuget-${{ hashFiles('**/*.csproj') }}
145+
key: ${{ runner.os }}-v2-nuget-${{ hashFiles('**/*.csproj','projects/Directory.Packages.props') }}
146146
restore-keys: |
147-
${{ runner.os }}-v1-nuget-
147+
${{ runner.os }}-v2-nuget-
148148
- name: Build (Debug)
149149
run: dotnet build ${{ github.workspace }}/Build.csproj
150150
- name: Verify

projects/Directory.Packages.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
-->
1717
<PackageVersion Include="System.IO.Pipelines" Version="8.0.0" />
1818
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
19+
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
20+
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
1921
<PackageVersion Include="System.Threading.RateLimiting" Version="8.0.0" />
2022
<PackageVersion Include="WireMock.Net" Version="1.5.62" />
2123
<PackageVersion Include="xunit" Version="2.9.0" />
@@ -33,13 +35,9 @@
3335
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
3436
<PackageVersion Include="System.Memory" Version="4.5.5" />
3537
<PackageVersion Include="System.Threading.Channels" Version="8.0.0" />
36-
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
3738
<PackageVersion Include="System.Net.Http.Json" Version="8.0.1" />
3839
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
3940
</ItemGroup>
40-
<ItemGroup Condition="$(TargetFramework)=='net472'">
41-
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
42-
</ItemGroup>
4341
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
4442
<GlobalPackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
4543
</ItemGroup>

projects/Test/Common/Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
</ItemGroup>
2727

2828
<ItemGroup>
29+
<PackageReference Include="System.Text.Json" />
2930
<PackageReference Include="EasyNetQ.Management.Client" />
3031
<PackageReference Include="xunit" />
3132
<PackageReference Include="xunit.abstractions" />

projects/Test/Integration/Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
-->
4040

4141
<ItemGroup>
42+
<PackageReference Include="System.Text.Json" />
4243
<PackageReference Include="Microsoft.NET.Test.Sdk" />
4344
<PackageReference Include="xunit" />
4445
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />

projects/Test/Integration/TestExchangeDeclare.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public async Task TestConcurrentExchangeDeclareAndDelete()
112112
var exchangeNames = new ConcurrentBag<string>();
113113
var tasks = new List<Task>();
114114
NotSupportedException nse = null;
115+
Exception unexpectedException = null;
115116
for (int i = 0; i < 256; i++)
116117
{
117118
var t = Task.Run(async () =>
@@ -129,13 +130,24 @@ public async Task TestConcurrentExchangeDeclareAndDelete()
129130
{
130131
nse = e;
131132
}
133+
catch (Exception ex)
134+
{
135+
unexpectedException = ex;
136+
}
132137
});
133138
tasks.Add(t);
134139
}
135140

136141
await Task.WhenAll(tasks);
137142

138-
Assert.Null(nse);
143+
if (nse is not null)
144+
{
145+
Assert.Fail($"got unexpected NotSupportedException: {nse}");
146+
}
147+
if (unexpectedException is not null)
148+
{
149+
Assert.Fail($"got unexpected Exception: {unexpectedException}");
150+
}
139151
tasks.Clear();
140152

141153
foreach (string exchangeName in exchangeNames)
@@ -154,13 +166,24 @@ public async Task TestConcurrentExchangeDeclareAndDelete()
154166
{
155167
nse = e;
156168
}
169+
catch (Exception ex)
170+
{
171+
unexpectedException = ex;
172+
}
157173
});
158174
tasks.Add(t);
159175
}
160176

161177
await Task.WhenAll(tasks);
162178

163-
Assert.Null(nse);
179+
if (nse is not null)
180+
{
181+
Assert.Fail($"got unexpected NotSupportedException: {nse}");
182+
}
183+
if (unexpectedException is not null)
184+
{
185+
Assert.Fail($"got unexpected Exception: {unexpectedException}");
186+
}
164187
}
165188
}
166189
}

projects/Test/OAuth2/OAuth2.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<ItemGroup>
3030
<PackageReference Include="Microsoft.NET.Test.Sdk" />
31+
<PackageReference Include="System.Text.RegularExpressions" />
3132
<PackageReference Include="xunit" />
3233
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
3334
<PackageReference Include="System.Net.Http" />

projects/Test/SequentialIntegration/SequentialIntegration.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<SignAssembly>true</SignAssembly>
1818
<IsTestProject>true</IsTestProject>
1919
<LangVersion>12.0</LangVersion>
20+
<TestTfmsInParallel>false</TestTfmsInParallel>
2021
</PropertyGroup>
2122

2223
<ItemGroup>
@@ -38,6 +39,7 @@
3839
</ItemGroup>
3940

4041
<ItemGroup>
42+
<PackageReference Include="System.Text.Json" />
4143
<PackageReference Include="Microsoft.NET.Test.Sdk" />
4244
<PackageReference Include="OpenTelemetry.Exporter.InMemory" />
4345
<PackageReference Include="xunit" />

projects/Test/Unit/Unit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27+
<PackageReference Include="System.Text.Json" />
2728
<PackageReference Include="Microsoft.NET.Test.Sdk" />
2829
<PackageReference Include="xunit" />
2930
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />

0 commit comments

Comments
 (0)