-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use authentication challenge for unauthenticated container registry repository #1797
Merged
+110
−8
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix NRE when getting scope Fix call to realm Fix scope Add content to the webrequest Remove extra debug Fix error message
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
…into MCRAuthChallenge
22710de
to
54d9cf0
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
anamnavi
approved these changes
Feb 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
alerickson
approved these changes
Feb 21, 2025
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
This pull request includes several changes to improve the handling and testing of unauthenticated access tokens for container registries. The most important changes include updating token templates, modifying access token retrieval logic, and adding new tests for unauthenticated repositories.
Improvements to token handling:
src/code/ContainerRegistryServerAPICalls.cs
: Updated thecontainerRegistryAccessTokenTemplate
to includeregistry:catalog:*
scope and added a newdefaultScope
constant.Modifications to access token retrieval logic:
src/code/ContainerRegistryServerAPICalls.cs
: Modified theGetContainerRegistryAccessToken
method to retrieve and return an anonymous access token if available. [1] [2]src/code/ContainerRegistryServerAPICalls.cs
: Updated theIsContainerRegistryUnauthenticated
method to check for an authentication challenge header and retrieve an anonymous access token if present.Code simplification:
src/code/ContainerRegistryServerAPICalls.cs
: Simplified theFindPackages
method to handle repository names with and without thepsresource/
prefix.Testing improvements:
test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1
: Modified a test to ensure all resources are found given the name*
.test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1
: Added a new test for finding resources in an unauthenticated ACR repository.PR Context
Unauthenticated ACR other than MCR respond with an auth challenge to acquire an anonymous token. This token is required for further operations.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.