Skip to content

Conversation

mbg
Copy link
Member

@mbg mbg commented Sep 11, 2025

Currently, the start-proxy action obtains the platform-specific update-job-proxy binary it needs from a hard-coded CodeQL CLI bundle release on the github/codeql-action repo, if it is not already in the runner's toolcache.

We will soon be including up-to-date versions of the update-job-proxy binaries with every CodeQL CLI bundle release.

This PR modifies the start-proxy action to search the release assets of the release pointed at by defaults.json for an appropriate update-job-proxy asset and downloads it, if it is not already in the runner's toolcache.

If the release pointed at by defaults.json doesn't contain the right asset for whatever reason, we revert to using the hard-coded release instead.

Because update-job-proxy isn't versioned, and we require a version for the toolcache, we use the CodeQL CLI version of the release the update-job-proxy is obtained from as its version.

I have added a few unit tests for this logic.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.
  • High risk: Changes are not fully under feature flags, have limited visibility and/or cannot be tested outside of production.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 18:03
@mbg mbg requested a review from a team as a code owner September 11, 2025 18:03
@mbg mbg requested a review from henrymercer September 11, 2025 18:04
Copy link
Contributor

@Copilot 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 modifies the start-proxy action to fetch proxy binaries from the current CodeQL CLI bundle release instead of a hard-coded release. The main purpose is to ensure the proxy binaries are always up-to-date with the CLI bundle version specified in defaults.json.

Key changes:

  • Adds dynamic proxy binary discovery from the current CLI bundle release
  • Implements fallback mechanism to hard-coded release if dynamic discovery fails
  • Uses CLI version for proxy binary versioning in toolcache

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/start-proxy.ts Adds new functions for dynamic proxy binary URL resolution and platform detection
src/start-proxy.test.ts Adds unit tests for the new proxy binary discovery logic
src/start-proxy-action.ts Updates proxy binary path resolution to use dynamic URL discovery
lib/start-proxy-action.js Generated JavaScript code (no review needed per guidelines)

for (const asset of cliRelease.data.assets) {
if (asset.name === proxyPackage) {
logger.info(
`Found '${proxyPackage}' in release '${defaults.bundleVersion}' at '${asset.url}'`,
Copy link
Preview

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Logging the asset URL could potentially expose sensitive information. Consider logging only the asset name and release version instead of the full URL.

Suggested change
`Found '${proxyPackage}' in release '${defaults.bundleVersion}' at '${asset.url}'`,
`Found '${proxyPackage}' in release '${defaults.bundleVersion}'.`,

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

We include the asset URL in the log in setup-codeql.ts as well. I don't think there should be any sensitive information, since the releases are public.

let proxyBin = toolcache.find(proxyFileName, proxyInfo.version);
if (!proxyBin) {
const temp = await toolcache.downloadTool(proxyURL);
const temp = await toolcache.downloadTool(proxyInfo.url);
Copy link
Preview

Copilot AI Sep 11, 2025

Choose a reason for hiding this comment

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

The URL from proxyInfo.url is downloaded without validation. When using the GitHub API asset URL, consider adding verification that the URL is from a trusted GitHub domain to prevent potential security issues.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Looks good, couple of minor comments.

Comment on lines +10 to +12
export const UPDATEJOB_PROXY_VERSION = "v2.0.20250624110901";
export const UPDATEJOB_PROXY_URL_PREFIX =
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.22.0/";
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: Rename to include _FALLBACK_?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not going to bother, since we can hopefully just remove the fallback logic once the next CodeQL CLI release has happened?

@mbg mbg merged commit dc9a47d into main Sep 12, 2025
290 checks passed
@mbg mbg deleted the mbg/proxy/fetch-from-release branch September 12, 2025 11:38
@github-actions github-actions bot mentioned this pull request Sep 25, 2025
8 tasks
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