Skip to content

add authentication to remote descriptor retrieval in fetchAttestation#1895

Open
refoo0 wants to merge 1 commit intomainfrom
fix-remote-auth-by-fetch-attestaions
Open

add authentication to remote descriptor retrieval in fetchAttestation#1895
refoo0 wants to merge 1 commit intomainfrom
fix-remote-auth-by-fetch-attestaions

Conversation

@refoo0
Copy link
Copy Markdown
Member

@refoo0 refoo0 commented Apr 22, 2026

No description provided.

…sForReference

Signed-off-by: rafi <refaei.shikho@hotmail.com>
Copilot AI review requested due to automatic review settings April 22, 2026 13:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds keychain-based authentication when retrieving the remote descriptor during attestation discovery, enabling access to private registries via existing Docker credentials.

Changes:

  • Add go-containerregistry authn import.
  • Pass remote.WithAuthFromKeychain(authn.DefaultKeychain) to the remote.Get call in fetchAttestationsForReference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


func fetchAttestationsForReference(ctx context.Context, ref name.Reference) ([]oci.Signature, error) {
desc, err := remote.Get(ref, remote.WithContext(ctx))
desc, err := remote.Get(ref, remote.WithContext(ctx), remote.WithAuthFromKeychain(authn.DefaultKeychain))
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Authentication is only added to the initial remote descriptor lookup. The subsequent attestation fetches via ociremote.Signatures are still configured with remote.WithContext(ctx) only, so private registries will likely still fail when pulling the attestation artifacts. Consider reusing a shared set of remote options (context + WithAuthFromKeychain(authn.DefaultKeychain)) and passing it both to remote.Get and to ociremote.WithRemoteOptions(...) in both branches.

Copilot uses AI. Check for mistakes.
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.

2 participants