Skip to content

Commit 43918b9

Browse files
Update NuGet auditing details for dotnet restore (#50367)
* Update NuGet auditing details for dotnet restore * Update docs/core/tools/dotnet-restore.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
1 parent f114494 commit 43918b9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/core/tools/dotnet-restore.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,19 @@ Starting in .NET 8, `dotnet restore` includes NuGet security auditing. This audi
199199

200200
To opt out of the security auditing, set the `<NuGetAudit>` MSBuild property to `false` in your project file.
201201

202-
To retrieve the known vulnerability dataset from the NuGet.org central registry, define the following in the *nuget.config* file:
202+
To get vulnerability data, starting in .NET 9, you can use [`auditSources`](/nuget/reference/nuget-config-file#auditsources) in addition to [`packageSources`](/nuget/reference/nuget-config-file#packagesources). If no audit sources are provided, `dotnet restore` uses package sources instead. NuGet audits any source as long as the source provides the [`VulnerabilityInfo` resource](/nuget/api/vulnerability-info).
203+
204+
To list NuGet.org as an audit source, define the following in the *nuget.config* file:
203205

204206
```xml
205-
<packageSources>
206-
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
207-
</packageSources>
207+
<configuration>
208+
<auditSources>
209+
<clear />
210+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
211+
</auditSources>
212+
</configuration>
208213
```
209214

210-
NuGet.org is the only package source that provides a vulnerability dataset for NuGet auditing. However, NuGet audits any source as long as the source provides the [`VulnerabilityInfo` resource](/nuget/api/vulnerability-info).
211-
212215
You can configure the level at which auditing will fail by setting the `<NuGetAuditLevel>` MSBuild property. Possible values are `low`, `moderate`, `high`, and `critical`. For example if you only want to see moderate, high, and critical advisories, you can set the property to `moderate`.
213216

214217
In .NET 8 and .NET 9, only *direct* package references are audited by default. Starting in .NET 10, NuGet audits both *direct* and *transitive* package references by default. You can change the mode by setting the `<NuGetAuditMode>` MSBuild property to `direct` or `all`.

0 commit comments

Comments
 (0)