-
Notifications
You must be signed in to change notification settings - Fork 255
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
Trusted-signers Add has inconsistent arguments #10647
Comments
@erdembayar - Could we address this in the dotnet.exe implementation as first step? |
|
Hi @erdembayar , the command is
|
@zkat @dtivel @joelverhagen @loic-sharma @nkolev92 @zivkan @JonDouglas |
I see from the code that, yes, we'll throw that error. That said, I thought it was possible to have, say, multiple Am I misunderstanding how this command works? I would expect this to append new signers. See also: #10628 (comment) These are the assumptions I was working under with the spec. |
I tried with multiple nupkgs in the path, like: |
But here you're only passing single Name not multiple. Can we pass comma separated names? |
I tried, multiple |
I am aware that the code will fail as-is. I'm asking about the configuration itself. The spec says that if something already exists under |
Let's assume there were 3 files in that
Only concern with this approach is doing wholesale blind adding may result, just adding 1 unwanted (test certificate or remnant from old deployment ...) certificate among many then it might open security hole. #10628 (comment) is more about convenience but security and convenience may not go hand in hand sometimes. I see pain point on your local development but it could be problem for CI/CD pipeline, on really secure environment user better be explicit about what to trust. |
I'm not overly concerned about this causing major trip-ups, tbh. Maybe @dtivel has a different opinion on what should be done? I'd rather have the wildcard feature, because it's something folks have asked for before (if I understand correctly something that Heng said) |
I agree that the current behavior is broken. It should be possible to add a new certificate to an existing trusted-signer. We should fix this. Separately, there is a concern that allowing multiple .nupkgs --- either by wildcard or multiple explicit file paths --- could lead to unintentional grant of trusted signer status to one or more package signers. Initially, I considered other cases where wildcards could lead to unintended behavior. For example, I could shoot myself in the foot if my wildcard pattern is too broad: del .\*.dll If I wanted @erdembayar's concern is around the persistent trust which may be accidentally conferred by such a mistake. I looked around for precedents and found:
In fact, across its many cmdlets PowerShell has multiple parameter names for file path ( Based on @erdembayar's concern and these prominent precedents, I'm inclined to err on the side of caution and disallow wildcards for the file path argument of the |
There is no cross-platform way to disallow wildcards while allowing multiple arguments. We either go with a single file argument, or we don't. |
If detect multiple files then just throw exception here? |
looks about right, yeah |
Thanks for @loic-sharma 's question in #10628 (comment)
In NuGet.exe command, the package path could be wildcard, so there might be multiple paths after parsing.
But there is a checking on "Name" to reject any existing "Name" at https://github.com/NuGet/NuGet.Client/blob/ac97d923e633f4ee65eec5ec690c4d99d7a922f3/src/NuGet.Core/NuGet.Commands/TrustedSignersCommand/TrustedSignerActionsProvider.cs#L243
So when there are multiple packages, the first one will be added successfully, but the rest will fail for
A trusted signer 'Test' already exists.
Apparently this is a bug. We should make the two consistent.
That is, do not accept multiple paths, or, accept multiple 'Name'.
The text was updated successfully, but these errors were encountered: