Disable DynamicLinq to fix CVE (#1242)

* Disable DynamicLinq

* Disable DynamicLinq functionality
This commit is contained in:
Stef Heyenrath
2025-01-22 10:30:52 +01:00
committed by GitHub
parent 888d913729
commit 12d2219752
96 changed files with 107 additions and 3912 deletions

View File

@@ -59,8 +59,11 @@ internal class MatcherMapper
throw new NotSupportedException("It's not allowed to use the 'CSharpCodeMatcher' because WireMockServerSettings.AllowCSharpCodeMatcher is not set to 'true'.");
case nameof(LinqMatcher):
return new LinqMatcher(matchBehaviour, matchOperator, stringPatterns);
case "LinqMatcher":
throw new NotSupportedException("It's not allowed to use the 'LinqMatcher' due to CVE.");
//case nameof(LinqMatcher):
// return new LinqMatcher(matchBehaviour, matchOperator, stringPatterns);
case nameof(ExactMatcher):
return new ExactMatcher(matchBehaviour, ignoreCase, matchOperator, stringPatterns);

View File

@@ -58,6 +58,12 @@
<DefineConstants>$(DefineConstants);TRAILINGHEADERS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Json\DynamicPropertyWithValue.cs" />
<Compile Remove="Json\JObjectExtensions.cs" />
<Compile Remove="Matchers\LinqMatcher.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JsonConverter.Abstractions" Version="0.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@@ -177,7 +183,7 @@
<ItemGroup>
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.9" />
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.9" />
<!--<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.9" />-->
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.9" />
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.9" />
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.9" />