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

raise warning if insecure sha-1 certificate fingerprint is passed to nuget.exe sign command #5924

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

kartheekp-ms
Copy link
Contributor

@kartheekp-ms kartheekp-ms commented Jul 15, 2024

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/2931

Description

Deprecate the usage of SHA-1 fingerprints in NuGet.exe sign command especially for CertificateFingerprint option. Instead, allow nuget.exe sign command to accept SHA-2 (SHA-256, SHA-384 and SHA-512) family fingerprints for searching a local certificate store for the certificate.

Here is how the nuget.exe sign command works after this PR has been merged:

  • Validates the certificate fingerprint to ensure it is either SHA-1, SHA-256, SHA-384, or SHA-512 algorithm. Throws an error otherwise.
  • Raises a warning if a SHA-1 certificate fingerprint is provided. This warning will be promoted to an error in the future.
  • While searching for a certificate from the local store, if a SHA-1 hash is provided, finds the certificate using the existing API i.e. store.Certificates.Find(X509FindType.FindByThumbprint, options.Fingerprint, validOnly);
  • If a SHA-256, SHA-384, or SHA-512 certificate fingerprint is provided, loops through the certificates in the store to find the certificate with the matching hash.

I made similar changes to the dotnet sign command in #5895.

PR Checklist

@kartheekp-ms kartheekp-ms requested a review from a team as a code owner July 15, 2024 17:57
@kartheekp-ms kartheekp-ms merged commit 6b9e448 into dev Jul 17, 2024
28 of 29 checks passed
@kartheekp-ms kartheekp-ms deleted the dev-kmps-nuget.exe-sign-sha1-warning branch July 17, 2024 23:32
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