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

Disable TLS certificate validation when disableTLSCertificateValidation is set in the config file for a source. #5514

Conversation

Nigusu-Allehu
Copy link
Contributor

@Nigusu-Allehu Nigusu-Allehu commented Nov 17, 2023

Bug

Fixes: NuGet/Home#13023

Regression? Last working version:

Description

Disable TLS certificate validation for the HTTP client handler when disableTLSCertificateValidation is set in the config file.

  • By default, the built in certificate validation is used, however, this PR allows to ignoring TLS certificate problems completely.

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

@Nigusu-Allehu Nigusu-Allehu requested a review from a team as a code owner November 17, 2023 22:14
@Nigusu-Allehu Nigusu-Allehu self-assigned this Nov 17, 2023
Copy link
Contributor

@kartheekp-ms kartheekp-ms left a comment

Choose a reason for hiding this comment

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

IMHO, we need to improve the test coverage for this change. For example, we should ensure that the restore succeeds when disableTLSCertificateValidate is set to true, and the mock server implementation includes a self-signed certificate in the chain. I am not an expert on what constitutes good test coverage for this change. Perhaps I am overcomplicating the issue regarding test coverage.

@jeffkl jeffkl marked this pull request as draft November 21, 2023 18:19
@Nigusu-Allehu Nigusu-Allehu marked this pull request as ready for review November 29, 2023 23:00
@Nigusu-Allehu Nigusu-Allehu marked this pull request as draft November 30, 2023 21:10
@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 7, 2023
@ghost
Copy link

ghost commented Dec 7, 2023

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@ghost ghost removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 11, 2023
@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 19, 2023
@ghost
Copy link

ghost commented Dec 19, 2023

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@ghost ghost closed this Dec 26, 2023
@Nigusu-Allehu Nigusu-Allehu reopened this Dec 28, 2023
@ghost ghost removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Dec 28, 2023
@Nigusu-Allehu Nigusu-Allehu marked this pull request as ready for review December 28, 2023 23:11
@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Jan 31, 2024
@ghost
Copy link

ghost commented Jan 31, 2024

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@kartheekp-ms kartheekp-ms removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Feb 6, 2024
@kartheekp-ms
Copy link
Contributor

Team Triage: Please consider adding some dotnet integration tests https://github.com/NuGet/NuGet.Client/blob/dev/test/TestUtilities/Test.Utility/FileSystemBackedV3MockServer.cs

@Nigusu-Allehu Nigusu-Allehu marked this pull request as draft February 13, 2024 18:00
@dotnet-policy-service dotnet-policy-service bot added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Feb 20, 2024
@Nigusu-Allehu Nigusu-Allehu reopened this Feb 28, 2024
@dotnet-policy-service dotnet-policy-service bot removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Feb 28, 2024
@Nigusu-Allehu Nigusu-Allehu marked this pull request as ready for review February 28, 2024 18:36
@Nigusu-Allehu
Copy link
Contributor Author

@kartheekp-ms @zivkan , I added some integration tests that are focused on dotnet restore.

@Nigusu-Allehu Nigusu-Allehu requested a review from zivkan March 4, 2024 20:11
@jeffkl jeffkl requested a review from a team March 5, 2024 18:07
public TcpListenerServer()
{ }

private static X509Certificate2 GenerateSelfSignedCertificate()
Copy link
Contributor

Choose a reason for hiding this comment

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

GenerateSelfSignedCertificate method has same logic in this class and also SelfSignedCertificateMockServer. If possible, please consider removing the code duplication in a follow-up PR.

@Nigusu-Allehu Nigusu-Allehu merged commit 2baabcf into dev-feature-disable-TLS-certificate-verification Mar 8, 2024
16 checks passed
@Nigusu-Allehu Nigusu-Allehu deleted the dev-nyenework-disableTLScertificateValidation branch March 8, 2024 04:01
@Nigusu-Allehu Nigusu-Allehu restored the dev-nyenework-disableTLScertificateValidation branch March 8, 2024 04:24
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.

7 participants