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

Fix permission issue on PUT artifact manifest #331

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

shizhMSFT
Copy link
Contributor

Artifact manifests failed to PUT with the following error message:

Error: failed commit on ref "myregistry/myrepo": retry request, cannot reset the stream

The reason is that incorrect access token is used by the customized containerd implementation, and it tries to re-read the request body for new requests. Since piped I/O cannot be rewinded, the PUT fails.

Even if the request body is rewindable, the Authorizator reuses the old token with insufficient scope, which does not match the requested scope in the returned challenge of the 401 response.

This PR constructs a proper scope before doing any requests. The implementation follows the containerd implementation.

Signed-off-by: Shiwei Zhang <[email protected]>
Copy link
Contributor

@northtyphoon northtyphoon left a comment

Choose a reason for hiding this comment

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

LGTM

@shizhMSFT shizhMSFT changed the title [artifacts] Fix permission issue on PUT artifact manifest. Fix permission issue on PUT artifact manifest. Oct 28, 2021
@shizhMSFT shizhMSFT changed the title Fix permission issue on PUT artifact manifest. Fix permission issue on PUT artifact manifest Oct 28, 2021
@juliusl
Copy link

juliusl commented Oct 28, 2021

LGTM

Copy link
Contributor

@SteveLasker SteveLasker left a comment

Choose a reason for hiding this comment

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

LGTM

@SteveLasker SteveLasker merged commit 6d6ddbd into oras-project:artifacts Oct 29, 2021
@shizhMSFT shizhMSFT deleted the fix_push branch October 29, 2021 06:40
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.

5 participants