Skip to content

Commit c010288

Browse files
authored
Update dotnet-restore-audit.md
1 parent 8e70c7e commit c010288

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,44 @@ 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+
<WarningsNotAsErrors>NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
40+
</PropertyGroup>
41+
```
3342

3443
- 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`.
3544

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

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

63+
```xml
64+
<PropertyGroup>
65+
...
66+
<NuGetAudit>false</NuGetAudit>
67+
</PropertyGroup>
68+
```
69+
4070
## See also
4171

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

0 commit comments

Comments
 (0)