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

Can not get API key with glob pattern to work #10053

Open
thaiknguyen opened this issue Jun 25, 2024 · 2 comments
Open

Can not get API key with glob pattern to work #10053

thaiknguyen opened this issue Jun 25, 2024 · 2 comments

Comments

@thaiknguyen
Copy link

NuGet Product Used

NuGet.exe

Product Version

nuget.exe

Worked before?

No response

Impact

Other

Repro Steps & Context

Create an API key with glob pattern: alpha

I'm unable to push packages with that pattern in the name.. for example:

nuget push thaitest.alpha.AppLogger.3.0.0.nupkg -Source https://api.nuget.org/v3/index.json
Pushing thaitest.alpha.AppLogger.3.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
PUT https://www.nuget.org/api/v2/package/
Forbidden https://www.nuget.org/api/v2/package/ 268ms
Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.).

I'm actually trying to only allow pushing '-alpha' version packages for this API key, but also tried the package name; both failed. If I changed the glob pattern to just *, then the above works.

Verbose Logs

nuget push thaitest.alpha.AppLogger.3.0.0.nupkg -Source https://api.nuget.org/v3/index.json -verbosity detailed
NuGet Version: 6.10.0.107
Pushing thaitest.alpha.AppLogger.3.0.0.nupkg to 'https://www.nuget.org/api/v2/package'...
  PUT https://www.nuget.org/api/v2/package/
  Forbidden https://www.nuget.org/api/v2/package/ 311ms
Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have permission to access the specified package.).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at NuGet.Protocol.Core.Types.PackageUpdateResource.EnsureSuccessStatusCode(HttpResponseMessage response, Nullable`1 codeNotToThrow, ILogger logger)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<>c__DisplayClass26_0.<PushPackageToServer>b__0(HttpResponseMessage response)
   at NuGet.Protocol.HttpSource.<ProcessResponseAsync>d__20`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageToServer>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageCore>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackagePath>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at NuGet.Protocol.Core.Types.PackageUpdateResource.<Push>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.PushRunner.<Run>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
@jgonz120 jgonz120 transferred this issue from NuGet/Home Jun 28, 2024
@jgonz120
Copy link

The API is rejecting the request based on the GLOB pattern, since this is handled by the server I transferred the issue.

@erdembayar
Copy link
Contributor

@thaiknguyen
Should it be *alpha? Could you please try that one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants