Skip to content

Doesn't allow multiple nupkg files for trusted-signers add command#3993

Merged
erdembayar merged 2 commits intodevfrom
dev-eryondon-10624-TrustedSignersAddInconsistentArgument
Apr 24, 2021
Merged

Doesn't allow multiple nupkg files for trusted-signers add command#3993
erdembayar merged 2 commits intodevfrom
dev-eryondon-10624-TrustedSignersAddInconsistentArgument

Conversation

@erdembayar
Copy link
Copy Markdown
Contributor

@erdembayar erdembayar commented Apr 12, 2021

Bug

Fixes: NuGet/Home#10647

Regression? Last working version:

Description

Considering other certificate/security commands doesn't accept multiple files for add/trust action we'll throw if multiple nupkg files detected on path.

Here are examples of other certificate/security commands doesn't accept multiple files:

  • Windows' certutil -addstore root <file path>, which adds a certificate to a trusted certificate store as a trusted root authority, disallows wildcards in the file path. The file path must resolve to a single file.
  • PowerShell's Import-Certificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath <file path>, which adds a certificate to a certificate store as a trusted root authority, disallows wildcards in the file path.

Here sample command which can cause problem:
nuget trusted-signers add C:\MyPackages\*.nupkg -Name signer -Author

PR Checklist

…indly, we have to be specific for better security practice.
@erdembayar erdembayar requested a review from a team as a code owner April 12, 2021 18:11
@erdembayar
Copy link
Copy Markdown
Contributor Author

@dtivel @heng-liu @kartheekp-ms
Please review this is package sign related change.

Copy link
Copy Markdown
Contributor

@heng-liu heng-liu left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this issue!
LGTM
By the way, we might also need to call it out it in the doc https://docs.microsoft.com/en-us/nuget/reference/cli-reference/cli-ref-trusted-signers.

@zivkan
Copy link
Copy Markdown
Member

zivkan commented Apr 21, 2021

The docs Heng linked currently explicitly say "one or more nupkgs", so it definately needs to be changed. By the way, any pull request that changes behaviour from a customer point of view (basically, all PRs that are not bug fixes or infrastructure) should require docs changes, so when filling out the PR template don't select "N/A" out of habit.

@erdembayar
Copy link
Copy Markdown
Contributor Author

@heng-liu @zivkan
Thank you for calling it out, I created the follow up document update issue.

@zivkan
Copy link
Copy Markdown
Member

zivkan commented Apr 22, 2021

What's the customer experience when they try to pass more than one file? The code throws an exception. Does the customer see a stack trace? Do they see "System.ArgumentException"?

@erdembayar
Copy link
Copy Markdown
Contributor Author

erdembayar commented Apr 22, 2021

What's the customer experience when they try to pass more than one file? The code throws an exception. Does the customer see a stack trace? Do they see "System.ArgumentException"?

They'll see Multiple nupkg files detected on '*.nupkg' path to trust, only 1 is allowed. error message.
Please note this command was failing even before my change if there're more than 1 file, since author name must be unique.

image

@erdembayar erdembayar merged commit b819f33 into dev Apr 24, 2021
@erdembayar erdembayar deleted the dev-eryondon-10624-TrustedSignersAddInconsistentArgument branch April 24, 2021 01:31
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.

Trusted-signers Add has inconsistent arguments

4 participants