Skip to content

Commit d42f55f

Browse files
authored
Add doc for allowInsecureConnections (#3144)
1 parent 2a8ca03 commit d42f55f

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

docs/reference/errors-and-warnings/NU1803.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@ You may need to do one of the following:
2121

2222
- Correct the specified url. You may have mistyped the source url. Change the url to explicitly request the `HTTPS` version of the source.
2323
- Work with the owner of the source and ask them to migrate to `HTTPS`.
24+
- If you are absolutely certain the 'HTTP' server you are connecting to is trustworthy, you may opt out of this warning by setting `allowInsecureConnections` to `true` for this package source, in [Package source sections](..\nuget-config-file.md#package-source-sections) of your NuGet.Config file. (Supported in NuGet 6.8+)
25+
26+
**Example**:
27+
28+
```xml
29+
<packageSources>
30+
<clear />
31+
<add key="http-source1" value="http://httpsource1trusted/" allowInsecureConnections="true">
32+
<add key="http-source2" value="http://httpsource2trusted/" protocolVersion="3" allowInsecureConnections="true">
33+
</packageSources>
34+
```
2435

2536
To learn more, refer to the [HTTPS everywhere](https://devblogs.microsoft.com/nuget/https-everywhere) blog.

docs/reference/nuget-config-file.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ Note that the source URL for nuget.org is `https://api.nuget.org/v3/index.json`.
113113

114114
Lists all known package sources. The order is ignored during restore operations and with any project using the PackageReference format. NuGet respects the order of sources for install and update operations with projects using `packages.config`.
115115

116-
| Key | Value | protocolVersion |
117-
| --- | --- | --- |
118-
| (name to assign to the package source) | The path or URL of the package source. | 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. |
116+
| XML Attribute | Purpose |
117+
| :-- | :-- |
118+
| **Key** | (name to assign to the package source) |
119+
| **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. |
121+
| **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+. |
119122

120123
**Example**:
121124

@@ -124,6 +127,7 @@ Lists all known package sources. The order is ignored during restore operations
124127
<clear />
125128
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
126129
<add key="Contoso" value="https://contoso.com/packages/" />
130+
<add key="http-source" value="http://httpsourcetrusted/" allowInsecureConnections="true" />
127131
<add key="Test Source" value="c:\packages" />
128132
</packageSources>
129133
```

0 commit comments

Comments
 (0)