Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable auditing for package vulnerabilities #66

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<EnableStrictModeForCompatibleFrameworksInPackageValidation>true</EnableStrictModeForCompatibleFrameworksInPackageValidation>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
<DisablePackageBaselineValidation Condition=" $(PackageValidationBaselineVersion) == $(VersionPrefix) or $(PackageValidationBaselineVersion) == '0.0.0' ">true</DisablePackageBaselineValidation>
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<NuGetAuditLevel>low</NuGetAuditLevel>
</PropertyGroup>

<PropertyGroup Condition=" '$(BuildNumber)' != '' ">
Expand Down
6 changes: 4 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="NuGet.CommandLine" Version="6.6.2" />
<PackageVersion Include="NuGet.Configuration" Version="6.6.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.6.1" />
<PackageVersion Include="NuGet.Configuration" Version="6.10.1" />
<PackageVersion Include="NuGet.Packaging" Version="6.10.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.10.1" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Polly" Version="7.2.4" />
<PackageVersion Include="System.Formats.Asn1" Version="8.0.1" />
<PackageVersion Include="XmlDocMarkdown.Core" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Faithlife.Build/DotNetClassicTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static DotNetClassicTool CreateFrom(string projectPath, string packageNam

var bestMatch = VersionRange.Parse(packageVersion).FindBestMatch(packageDirectories) ??
throw new BuildException($"Found restored NuGet package folder but no version is a best match: {packageFullPath}");
var packageBestMatchPath = Path.Combine(packagesPath, packageName.ToLowerInvariant(), bestMatch.OriginalVersion);
var packageBestMatchPath = Path.Combine(packagesPath, packageName.ToLowerInvariant(), bestMatch.OriginalVersion ?? bestMatch.ToString());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed due to a nullability analysis warning. Not sure if ! would have worked OK here (i.e., if OriginalVersion is guaranteed to be non-null with the way we initialize it).


if (!Directory.Exists(packageBestMatchPath))
throw new BuildException($"Missing restored NuGet package that was a best match: {packageBestMatchPath}");
Expand Down
2 changes: 2 additions & 0 deletions src/Faithlife.Build/Faithlife.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
<PackageReference Include="McMaster.Extensions.CommandLineUtils" />
<PackageReference Include="NuGet.CommandLine" />
<PackageReference Include="NuGet.Configuration" />
<PackageReference Include="NuGet.Packaging" />
<PackageReference Include="NuGet.Protocol" />
<PackageReference Include="Polly" />
<PackageReference Include="System.Formats.Asn1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions tools/Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<ItemGroup>
<PackageReference Include="Faithlife.Build" VersionOverride="5.*" />
<PackageReference Include="NuGet.Packaging" />
<PackageReference Include="System.Formats.Asn1" />
</ItemGroup>

</Project>