Skip to content

Conversation

@jurre
Copy link
Member

@jurre jurre commented Jun 16, 2025

In order to allow us to pass centrally managed registry credentials, this PR implements a basic version that grabs the Base64 encoded credential blob from the environment and passes them to the Proxy.

Right now by default these credentials will not be passed.

Copilot AI review requested due to automatic review settings June 16, 2025 14:34
@jurre jurre requested a review from a team as a code owner June 16, 2025 14:34
Copy link
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

This PR enables injecting centrally managed registry credentials via the GITHUB_REGISTRIES_PROXY environment variable and merges them with credentials fetched from the API.

  • Import the new Credential type and default getCredentials() to an empty list.
  • Add credentialsFromEnv() to decode, parse, and mask base64-encoded credentials from GITHUB_REGISTRIES_PROXY.
  • Update tests to set GITHUB_REGISTRIES_PROXY for the new behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main.ts Imported Credential, updated credential merging logic, and added credentialsFromEnv
tests/main.test.ts Set GITHUB_REGISTRIES_PROXY in the test setup
Comments suppressed due to low confidence (3)

tests/main.test.ts:45

  • Tests currently only set a valid env var; consider adding cases for invalid base64, invalid JSON, and verifying that secrets are masked via core.setSecret.
process.env.GITHUB_REGISTRIES_PROXY = Buffer.from(

src/main.ts:222

  • Add a JSDoc comment describing the expected format of GITHUB_REGISTRIES_PROXY (base64-encoded JSON array of Credentials) and the function’s behavior on parse errors.
function credentialsFromEnv(): Credential[] {

src/main.ts:223

  • [nitpick] The variable name registriesProxyStr is a bit generic; consider renaming to encodedRegistryCredentials or similar for clarity.
const registriesProxyStr = process.env.GITHUB_REGISTRIES_PROXY

@jurre jurre force-pushed the jurre/registry-credentials branch 2 times, most recently from 8a46224 to 2fb55ab Compare June 16, 2025 14:43
@jurre jurre force-pushed the jurre/registry-credentials branch 8 times, most recently from 0dcdbfd to 5e9e1e1 Compare June 20, 2025 10:36
core.setSecret(e['auth-key'])
}

// TODO: Filter down to only credentials relevant to this job.
Copy link
Member

Choose a reason for hiding this comment

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

At the rate we're adding ecosystems, some of which overlap (e.g. dotnet_sdk and nuget) I think we should inject all secrets to all job types.

Copy link
Member

@jakecoffman jakecoffman Jun 20, 2025

Choose a reason for hiding this comment

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

Or the filtering should be done in the UI somehow per-repo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like it should be fairly straight forward to figure out which ones we need? This is what Secret Scanning does:

https://github.com/github/codeql-action/blob/ac30a39d8c6142a41d62949496fef51750e6f1bf/src/start-proxy.ts#L83-L87

I'm ok punting for now and revisiting though

@jurre jurre force-pushed the jurre/registry-credentials branch from bbd4eab to 7cc5ee6 Compare June 20, 2025 15:04
jurre and others added 3 commits June 20, 2025 15:04
In order to allow us to pass centrally managed registry credentials,
this PR implements a basic version that grabs the Base64 encoded
credential blob from the environment and passes them to the Proxy.
@jurre jurre force-pushed the jurre/registry-credentials branch from 7cc5ee6 to e4bcc78 Compare June 20, 2025 15:04
@jurre jurre merged commit d5e9c82 into main Jun 25, 2025
9 checks passed
@jurre jurre deleted the jurre/registry-credentials branch June 25, 2025 14:11
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.

3 participants