Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not warn http sources in push/delete scenarios when allowInsecureConnections is set to true. #5381

Conversation

heng-liu
Copy link
Contributor

@heng-liu heng-liu commented Aug 28, 2023

Bug

Fixes: NuGet/Home#12789

Regression? Last working version:

Description

When allowInsecureConnections property in packageSources section is set to true in NuGet.Config files, do not warn for HTTP sources in push/delete scenarios.
For push scenario, set allowInsecureConnections property to true for push source will opt out the http warning for both package and symbol source.

The PR enable the HTTP warnings in this scenario is: #4552

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@heng-liu heng-liu marked this pull request as ready for review August 28, 2023 17:49
@heng-liu heng-liu requested a review from a team as a code owner August 28, 2023 17:49
(packageSource.ProtocolVersion == 3 || packageSource.Source.EndsWith("json", StringComparison.OrdinalIgnoreCase)))
{
logger.LogWarning(string.Format(CultureInfo.CurrentCulture, Strings.Warning_HttpServerUsage, "delete", packageSource.Source));
}
var packageUpdateResource = await CommandRunnerUtility.GetPackageUpdateResource(sourceProvider, packageSource);

bool allowInsecureConnections = packageSource.AllowInsecureConnections;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: just pass packageSource.AllowInsecureConnections directly in line 46 without new variable allowInsecureConnections

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

Comment on lines 2583 to 2584
string expectedSymbolWarning = $"WARNING: You are running the 'push' operation with an 'HTTP' source, '{pushSymbolsUri}/'";
if (isHttpWarningExpected)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Could we add an empty line before this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an empty line. Thanks!

@heng-liu heng-liu requested a review from aortiz-msft August 29, 2023 16:10
@heng-liu heng-liu merged commit 53c01de into dev-feature-optoutHttpWarnings Aug 29, 2023
@heng-liu heng-liu deleted the dev-hengliu-optoutHttpWarning-pushDelete branch August 29, 2023 23:07
heng-liu added a commit that referenced this pull request Sep 8, 2023
heng-liu added a commit that referenced this pull request Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants