mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Fix vulnerability found in Microsoft.AspNetCore dependency #295
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @APIWT on GitHub (Sep 28, 2020).
Originally assigned to: @StefH on GitHub.
Is your feature request related to a problem? Please describe.
Our application is scanned with Snyk, and the results of the scan have this popping up:
Describe the solution you'd like
My guess is that it would be possible to get rid of the dependency on
Microsoft.AspNetCorefor projects targetingnetcoreapp3.1(though honestly this isn't my area of expertise.Describe alternatives you've considered
I could likely suppress this warning since we only use
WireMock.Netin our test projects, but I don't know if I can get our customer to buy in on this.Additional context
I really appreciate any help or consideration here!
@StefH commented on GitHub (Sep 28, 2020):
Hello @APIWT,

I see that WhiteSource also describes the same issue:
I'll take a look on how to fix this.
@APIWT commented on GitHub (Sep 28, 2020):
Thanks @StefH! Please let me know if there is anything I can do to help.
@StefH commented on GitHub (Sep 28, 2020):
Can you try WireMock.Net.1.3.0-ci-13770 from MyGet ? (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
@APIWT commented on GitHub (Sep 28, 2020):
I think I may be doing something silly, but I am getting an error in the restore step. Here is my
nuget.config:Here is the restore error:
@APIWT commented on GitHub (Sep 28, 2020):
@StefH So I figured out the restore issue. Here are the two vulnerabilities that appear when I use the preview release:
@StefH commented on GitHub (Sep 28, 2020):
1] Should be fixed, please install new MyGet version (can take a few minutes to build and to become available...)
2]
https://snyk.io/vuln/SNYK-DOTNET-MICROSOFTASPNETCORE-174184
Remediation
There is no fixed version for Microsoft.AspNetCore.
@APIWT commented on GitHub (Sep 28, 2020):
Hey again! For number 2, I think it is possible to fix this for applications targetting netcoreapp3.1 which use the
Microsoft.NET.Sdk.WebSDK. These do not actually need to useMicrosoft.AspNetCoreas far as I can tell. Does that make sense? TheMicrosoft.AspNetCorepackage is end of life.,@APIWT commented on GitHub (Sep 28, 2020):
Here is some supporting documentation if it helps: https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#remove-obsolete-package-references
@StefH commented on GitHub (Sep 28, 2020):
Can you test if item
1]is solved?About item 2:
Maybe adding a new target with .NET Core 3.1 could solve it, however I don't know yet the replacement for Microsoft.AspNetCore. I'll need to take a look....
@StefH commented on GitHub (Sep 29, 2020):
For now, I think the best I could do, is done now.
In case you want to use WireMock in a NetCoreApp 3.1 hosted application, I think the best way to move forward is to follow this idea : https://github.com/WireMock-Net/WireMock.Net/issues/498
What do you think about that?
@StefH commented on GitHub (Sep 29, 2020):
@APIWT Is it ok that I close this issue and create a new NuGet?
@APIWT commented on GitHub (Sep 29, 2020):
Sure! It is funny that you mention that approach, we do something similar for a mobile app.
@StefH commented on GitHub (Sep 29, 2020):
OK, Please keep a watch on #498 and add a comment if needed.
@APIWT commented on GitHub (Sep 29, 2020):
@StefH Good news, I think I may have a possible solution that doesn't require removing the wire portion of WireMock.Net :)
I was able to add
netcoreapp3.0;netcoreapp3.1to<TargetFrameworks>inside the csproj.Next, I changed:
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2'">To:
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.0' or '$(TargetFramework)' == 'netcoreapp3.1'">Then I added the following ItemGroup:
The magic here is that I use a
FrameworkReferenceinstead of thePackageReferencestuff forMicrosoft.AspNetCore.Lastly, I needed to make a minor tweak to
HttpClientHandlerinCreateHttpClient. I changed:#if NETSTANDARDTo:
#if NETSTANDARD || USE_ASPNETCOREThis seems to allow me to target netcoreapp3.0 and netcoreapp3.1 without an underlying reference to the
Microsoft.AspNetCore*packages.Is this something that we could potentially see in a future release?
@StefH commented on GitHub (Sep 29, 2020):
You can make PR for this.
@APIWT commented on GitHub (Sep 30, 2020):
Great news, I just tried out CI build 13791 and Snyk is very happy :)
I really appreciate your help.