Skip to content

Add proxy_binary input to start-proxy action #2871

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/start-proxy-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/start-proxy-action-post.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/start-proxy-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/start-proxy-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/start-proxy-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ async function runWrapper() {
// Kill the running proxy
const pid = core.getState("proxy-process-pid");
if (pid) {
process.kill(Number(pid));
try {
process.kill(Number(pid));
} catch (error) {
logger.error(`Failed to kill proxy process: ${getErrorMessage(error)}`);
}
}

const config = await configUtils.getConfig(
Expand Down
4 changes: 3 additions & 1 deletion src/start-proxy-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ async function runWrapper() {
};

// Start the Proxy
const proxyBin = await getProxyBinaryPath();
const proxyBin =
actionsUtil.getOptionalInput("proxy_binary") ??
(await getProxyBinaryPath());
Comment on lines +122 to +124
Copy link
Contributor

Choose a reason for hiding this comment

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

What sort of error is emitted if proxy_binary doesn't exist or isn't executable? Is there a try-catch somewhere that emits a meaningful error message in this case?

await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger);
}

Expand Down
4 changes: 4 additions & 0 deletions start-proxy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: "CodeQL: Start proxy"
description: "[Experimental] Start HTTP proxy server. This action is for internal GitHub used only and will change without notice."
author: "GitHub"
inputs:
proxy_binary:
description: >-
A path for the proxy binary to use.
required: false
Comment on lines +5 to +8
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a question, not anything definitive. We're now giving the user an option of specifying an executable. Are there any security vulnerabilities that this opens up? Maybe the answer is "no" since this is already running in an action, which already allows execution of arbitrary code.

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 figured we allow the same sort of thing with the tools input to the init Action, so that option is already there. Although I didn't check whether we perform any kind of validation there to verify that we were are running is safe.

registry_secrets:
description: The URLs and credentials of package registries
required: false
Expand Down
Loading