Skip to content

Commit 44fca65

Browse files
authored
recommend usage of trusted package sources (#3318)
1 parent 107b92e commit 44fca65

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

docs/concepts/Security-Best-Practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ For more information about Dependabot alerts & security updates, [see the follow
117117

118118
**📦 Package Consumer**
119119

120-
When using multiple public & private NuGet source feeds, a package can be downloaded from any of the feeds. To ensure your build is predictable and secure from known attacks such as [Dependency Confusion](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610), knowing what specific feed(s) your packages are coming from is a best practice. You can use a single feed or private feed with upstreaming capabilities for protection.
120+
Use package sources that you trust. When using multiple public & private NuGet source feeds, a package can be downloaded from any of the feeds. To ensure your build is predictable and secure from known attacks such as [Dependency Confusion](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610), knowing what specific feed(s) your packages are coming from is a best practice. You can use a single feed or private feed with upstreaming capabilities for protection.
121121

122122
For more information to secure your package feeds, see [3 Ways to Mitigate Risk When Using Private Package Feeds](https://azure.microsoft.com/resources/3-ways-to-mitigate-risk-using-private-package-feeds/en-us/).
123123

docs/consume-packages/consuming-packages-authenticated-feeds.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ms.topic: conceptual
1010
# Consuming packages from authenticated feeds
1111

1212
Many NuGet operations, such as restore and install, require communication with one or more package sources, which [can be configured in *nuget.config* files](../reference/nuget-config-file.md#packagesources).
13+
14+
> [!NOTE]
15+
> Use package sources that you trust.
16+
1317
For HTTP feeds, NuGet will make an unauthenticated request, and if the server responds with an HTTP 401 response, NuGet will search for credentials in the following order:
1418

1519
1. [An environment variable `NuGetPackageSourceCredentials_{name}`](#credentials-in-environment-variables).
@@ -37,11 +41,11 @@ This approach provides an extra layer of security by storing the credentials in
3741
For more information, refer to the section on [credentials in *nuget.config* files](#credentials-in-nugetconfig-files).
3842

3943
> [!NOTE]
40-
> Be aware that encrypted passwords are only supported on Windows.
44+
> Be aware that encrypted passwords are only supported on Windows.
4145
> Moreover, they can only be decrypted on the same machine and by the same user who originally encrypted them.
4246

4347
1. **Using Environment Variable Macros in nuget.config**: If using encrypted credentials is not possible, consider storing the credentials in the *nuget.config* file with environment variable macros.
44-
This approach allows you to reference environment variables that contain the actual credentials.
48+
This approach allows you to reference environment variables that contain the actual credentials.
4549
It enhances transparency and helps end users understand how their credentials are configured.
4650
For more information, refer to the section on [credentials in *nuget.config* files](#credentials-in-nugetconfig-files).
4751

docs/reference/cli-reference/cli-ref-sources.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ ms.topic: reference
1313

1414
Manages the list of sources located in the user scope configuration file or a specified configuration file. The user scope configuration file is located at `%appdata%\NuGet\NuGet.Config` (Windows) and `~/.nuget/NuGet/NuGet.Config` (Mac/Linux).
1515

16+
> [!NOTE]
17+
> Use package sources that you trust.
18+
1619
Note that the source URL for nuget.org is `https://api.nuget.org/v3/index.json`.
1720

1821
## Usage
@@ -54,7 +57,7 @@ where `<operation>` is one of *List, Add, Remove, Enable, Disable,* or *Update*,
5457
Specifies the password for authenticating with the source.
5558

5659
> [!NOTE]
57-
> Be aware that encrypted passwords are only supported on Windows.
60+
> Be aware that encrypted passwords are only supported on Windows.
5861
> Moreover, they can only be decrypted on the same machine and by the same user who originally encrypted them.
5962
6063
- **`-src|-Source`**

docs/reference/nuget-config-file.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Lists all known package sources. The order is ignored during restore operations
117117
| :-- | :-- |
118118
| **Key** | (name to assign to the package source) |
119119
| **Value** | The path or URL of the package source. |
120-
| **protocolVersion** | The NuGet server protocol version to be used. The current version is "3". Defaults to version "2" when not pointing to a package source URL ending in `.json` (e.g. https://api.nuget.org/v3/index.json). Supported in [NuGet 3.0+](/nuget/release-notes/nuget-3.0.0). See [NuGet Server API](/nuget/api/overview) for more information about the version 3 protocol. |
120+
| **protocolVersion** | The NuGet server protocol version to be used. The current version is "3". Defaults to version "2" when not pointing to a package source URL ending in `.json` (e.g. <https://api.nuget.org/v3/index.json>). Supported in [NuGet 3.0+](/nuget/release-notes/nuget-3.0.0). See [NuGet Server API](/nuget/api/overview) for more information about the version 3 protocol. |
121121
| **allowInsecureConnections** | When false, or not specified, NuGet will emit a warning when the source uses http, rather than https. If you are confident that communication with this source will never be at risk of interception attacks, you can set the value to true to suppress the warning. Supported in NuGet 6.8+. |
122122
| **disableTLSCertificateValidation** | This configuration property allows you to disable SSL/TLS certificate validation for your HTTPS server. When set to true, the server will ignore any errors related to SSL/TLS certificates, such as expired or self-signed certificates, and establish the connection without validation. Supported in NuGet 6.11+. |
123123

@@ -134,6 +134,9 @@ Lists all known package sources. The order is ignored during restore operations
134134
</packageSources>
135135
```
136136

137+
> [!NOTE]
138+
> Use package sources that you trust.
139+
137140
> [!NOTE]
138141
> When using the CLI, you can express a [`RestoreSources`](../reference/msbuild-targets.md#restore-properties) MSBuild property or [`--source`(.NET CLI)](/dotnet/core/tools/dotnet-restore#options) | [`-Source`(NuGet CLI)](/nuget/reference/cli-reference/cli-ref-restore#options) to override the `<packageSources>` defined in the NuGet.config.
139142
@@ -303,7 +306,7 @@ Identifies to the currently active source or indicates the aggregate of all sour
303306

304307
## trustedSigners section
305308

306-
Stores trusted signers used to allow package while installing or restoring. This list cannot be empty when the user sets `signatureValidationMode` to `require`.
309+
Stores trusted signers used to allow package while installing or restoring. This list cannot be empty when the user sets `signatureValidationMode` to `require`.
307310

308311
This section can be updated with the [`nuget trusted-signers` command](../reference/cli-reference/cli-ref-trusted-signers.md).
309312

@@ -439,7 +442,6 @@ The table below show environnment variable syntax and path separator support for
439442
| `$MY_VAR` | `/` | No | No | No | No |
440443
| `$MY_VAR` | `\` | No | No | No | No |
441444

442-
443445
## Example config file
444446

445447
Below is an example `nuget.config` file that illustrates a number of settings including optional ones:

0 commit comments

Comments
 (0)