Skip to content

Commit be8517a

Browse files
authored
Merge pull request #3356 from NuGet/main
NuGetAuditMode default change respects SdkAnalysisLevel (#3354)
2 parents 386628b + 00c4eef commit be8517a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

docs/concepts/Auditing-Packages.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Auditing package dependencies for security vulnerabilities
33
description: How to audit package dependencies for security vulnerabilities and acting on security audit reports.
44
author: JonDouglas
55
ms.author: jodou
6-
ms.date: 07/19/2024
76
ms.topic: conceptual
87
---
98

@@ -44,11 +43,12 @@ We recommend that audit is configured at a repository level.
4443

4544
| MSBuild Property | Default | Possible values | Notes |
4645
|------------------|---------|-----------------|-------|
47-
| NuGetAuditMode | all (1) | `direct` and `all` | If you'd like to audit both top-level and transitive dependencies, you can set the value to `all`. NuGetAuditMode is not applicable for packages.config projects |
46+
| NuGetAuditMode | all | `direct` and `all` | If you'd like to audit top-level dependencies only, you can set the value to `direct`. NuGetAuditMode is not applicable for packages.config projects. |
4847
| NuGetAuditLevel | low | `low`, `moderate`, `high`, and `critical` | The minimum severity level to report. If you'd like to see `moderate`, `high`, and `critical` advisories (exclude `low`), set the value to `moderate` |
4948
| NuGetAudit | true | `true` and `false` | If you wish to not receive security audit reports, you can opt-out of the experience entirely by setting the value to `false` |
5049

51-
(1) NuGetAuditMode defaulted to `direct` when it was introduced in [the .NET 8.0.100 SDK and VS 17.8](../release-notes/NuGet-6.8.md). In [.NET 9.0.100 SDK and VS 17.12](../release-notes/NuGet-6.12.md) the default changed to `all`.
50+
Note: In .NET 8, the default value of NuGetAuditMode is `direct`.
51+
Therefore, setting [SdkAnalysisLevel](/dotnet/core/project-sdk/msbuild-props#sdkanalysislevel) to `8.0.400` changes the default value of NuGetAuditMode accordingly.
5252

5353
#### Audit Sources
5454

@@ -111,7 +111,7 @@ Alternatively, if you want to keep low and moderate vulnerabilities as warnings,
111111
## `dotnet list package --vulnerable`
112112

113113
Once a project is successfully restored, [`dotnet list package`](/dotnet/core/tools/dotnet-list-package) has a `--vulnerable` argument to filter the packages based on which packages have known vulnerabilities.
114-
Note that `--include-transitive` is not default, so should be included
114+
Note that `--include-transitive` is not default, so should be included.
115115

116116
## Actions when packages with known vulnerabilities are reported
117117

docs/reference/errors-and-warnings/NU1901-NU1904.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ For example `<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-g3q
5151

5252
If you do not want NuGet to check for packages with known vulnerabilities during restore, add `<NuGetAudit>false</NuGetAudit>` inside a `<PropertyGroup>` in your project file, or a [`Directory.Build.props` file](/visualstudio/msbuild/customize-by-directory).
5353
If you would like to run NuGet Audit on developer machines, but disable it on CI pipelines, you can take advantage of MSBuild importing environment variables, and create a NuGetAudit environment variable set to `false` in your pipeline definition.
54+
55+
In NuGet 6.12 (Visual Studio/MSBuild 17.12 and .NET 9.0.100 SDK), NuGet changed the default for `NuGetAuditMode` to `all`, which means report on transitive packages with known vulnerabilities.
56+
The value can be explicitly set to `direct` to revert back to .NET 8's default. Alternatively, [the property `SdkAnalysisLevel`](/dotnet/core/project-sdk/msbuild-props#sdkanalysislevel) can be set to `8.0.400` to temporarily disable all new warnings and errors introduced in newer versions of the SDK. Specifically in this case, the default value of `NuGetAuditMode` is changed back to `direct`.

0 commit comments

Comments
 (0)