Skip to content

Commit 32aeb14

Browse files
authored
Be explicit about recommended actions (#44411)
1 parent 7b25772 commit 32aeb14

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/core/compatibility/sdk/8.0/dotnet-restore-audit.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,45 @@ Many users want to know whether the packages they restore contain any known secu
2929

3030
## Recommended action
3131

32-
- To explicitly reduce the probability of this breaking your build due to warnings, you can consider your usage of `<TreatWarningsAsErrors>` and use `<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>` to ensure known security vulnerabilities are still allowed in your environment.
32+
The properties mentioned in the recommended actions can be set either in your project file (for example, \*.csproj or \*.fsproj file) or *Directory.Build.props* file.
33+
34+
- To explicitly reduce the probability of this breaking your build due to warnings, you can consider your usage of `<TreatWarningsAsErrors>` and set `<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>` to ensure known security vulnerabilities are still allowed in your environment.
35+
36+
```xml
37+
<PropertyGroup>
38+
...
39+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
40+
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
41+
</PropertyGroup>
42+
```
3343

3444
- If you want to set a different security audit level, add the `<NuGetAuditLevel>` property to your project file with possible values of `low`, `moderate`, `high`, and `critical`.
3545

46+
```xml
47+
<PropertyGroup>
48+
...
49+
<NuGetAuditLevel>low</NuGetAuditLevel>
50+
</PropertyGroup>
51+
```
52+
3653
- If you want to ignore these warnings, you can use `<NoWarn>` to suppress `NU1901-NU1904` warnings.
3754

55+
```xml
56+
<PropertyGroup>
57+
...
58+
<NoWarn>$(NoWarn);NU1901-NU1904</NoWarn>
59+
</PropertyGroup>
60+
```
61+
3862
- To disable the new behavior entirely, you can set the `<NuGetAudit>` project property to `false`.
3963

64+
```xml
65+
<PropertyGroup>
66+
...
67+
<NuGetAudit>false</NuGetAudit>
68+
</PropertyGroup>
69+
```
70+
4071
## See also
4172

4273
- [Audit for security vulnerabilities (`dotnet restore`)](../../../tools/dotnet-restore.md#audit-for-security-vulnerabilities)

0 commit comments

Comments
 (0)