Skip to content

fix: pass _json_key_base64 GCR credentials as username and password - #3135

Open
maxpain wants to merge 1 commit into
aquasecurity:mainfrom
maxpain:fix-gcr-json-key-base64
Open

maxpain wants to merge 1 commit into
aquasecurity:mainfrom
maxpain:fix-gcr-json-key-base64

Conversation

@maxpain

@maxpain maxpain commented Nov 3, 2026

Copy link
Copy Markdown

Description

Scan jobs now use the GCR key file (GOOGLE_APPLICATION_CREDENTIALS) only when the registry username is _json_key, as ClientServer mode did before #2595, and other GCR and Artifact Registry credentials, such as _json_key_base64, get TRIVY_USERNAME and TRIVY_PASSWORD like any other registry.

The new TestStandalone_GCRJSONKeyBase64 fails without the change in image.go and passes with it, as does go test ./pkg/plugins/trivy/.... With Trivy 0.76.1, a real _json_key_base64 key scans a private Artifact Registry image as TRIVY_USERNAME and TRIVY_PASSWORD, and fails with DENIED: Unauthenticated request as a key file. This PR is independent of #3133.

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've added tests that prove my fix is effective or that my feature works.

This PR was written with help from Claude (Opus 5.5) and reviewed by me.

Scan jobs used the registry password as the GOOGLE_APPLICATION_CREDENTIALS
key file for any GCR or Artifact Registry image, but it is a JSON key only
when the user is _json_key. Other users, such as _json_key_base64, now get
TRIVY_USERNAME and TRIVY_PASSWORD.

Assisted-by: Claude:Opus-5.5
@maxpain
maxpain requested review from afdesk and eyalke as code owners November 3, 2026 16:24

This branch has not been deployed

No deployments
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.

_json_key_base64 GCR credentials fail because scan jobs use them as a key file

1 participant