Unset proxy env

This commit is contained in:
Marco Gario 2025-01-29 11:04:28 +00:00
parent 14b9c0ec59
commit f98f14dd82
6 changed files with 29 additions and 2 deletions

8
lib/analyze-action.js generated
View file

@ -160,6 +160,14 @@ async function run() {
let dbCreationTimings = undefined; let dbCreationTimings = undefined;
let didUploadTrapCaches = false; let didUploadTrapCaches = false;
util.initializeEnvironment(actionsUtil.getActionVersion()); util.initializeEnvironment(actionsUtil.getActionVersion());
// Unset the CODEQL_PROXY_* environment variables, as they are not needed
// and can cause issues with the CodeQL CLI
// Check for CODEQL_PROXY_HOST: and if it is empty but set, unset it
if (process.env.CODEQL_PROXY_HOST === "") {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
// Make inputs accessible in the `post` step, details at // Make inputs accessible in the `post` step, details at
// https://github.com/github/codeql-action/issues/2553 // https://github.com/github/codeql-action/issues/2553
actionsUtil.persistInputs(); actionsUtil.persistInputs();

File diff suppressed because one or more lines are too long

View file

@ -99,6 +99,10 @@ async function runWrapper() {
core.saveState("proxy-log-file", proxyLogFilePath); core.saveState("proxy-log-file", proxyLogFilePath);
// Get the configuration options // Get the configuration options
const credentials = (0, start_proxy_1.getCredentials)(logger, actionsUtil.getOptionalInput("registry_secrets"), actionsUtil.getOptionalInput("registries_credentials"), actionsUtil.getOptionalInput("language")); const credentials = (0, start_proxy_1.getCredentials)(logger, actionsUtil.getOptionalInput("registry_secrets"), actionsUtil.getOptionalInput("registries_credentials"), actionsUtil.getOptionalInput("language"));
if (credentials.length === 0) {
logger.info("No credentials found, skipping proxy setup.");
return;
}
logger.info(`Credentials loaded for the following registries:\n ${credentials logger.info(`Credentials loaded for the following registries:\n ${credentials
.map((c) => credentialToStr(c)) .map((c) => credentialToStr(c))
.join("\n")}`); .join("\n")}`);

File diff suppressed because one or more lines are too long

View file

@ -202,6 +202,15 @@ async function run() {
let didUploadTrapCaches = false; let didUploadTrapCaches = false;
util.initializeEnvironment(actionsUtil.getActionVersion()); util.initializeEnvironment(actionsUtil.getActionVersion());
// Unset the CODEQL_PROXY_* environment variables, as they are not needed
// and can cause issues with the CodeQL CLI
// Check for CODEQL_PROXY_HOST: and if it is empty but set, unset it
if (process.env.CODEQL_PROXY_HOST === "") {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
// Make inputs accessible in the `post` step, details at // Make inputs accessible in the `post` step, details at
// https://github.com/github/codeql-action/issues/2553 // https://github.com/github/codeql-action/issues/2553
actionsUtil.persistInputs(); actionsUtil.persistInputs();

View file

@ -99,6 +99,12 @@ async function runWrapper() {
actionsUtil.getOptionalInput("registries_credentials"), actionsUtil.getOptionalInput("registries_credentials"),
actionsUtil.getOptionalInput("language"), actionsUtil.getOptionalInput("language"),
); );
if (credentials.length === 0) {
logger.info("No credentials found, skipping proxy setup.");
return;
}
logger.info( logger.info(
`Credentials loaded for the following registries:\n ${credentials `Credentials loaded for the following registries:\n ${credentials
.map((c) => credentialToStr(c)) .map((c) => credentialToStr(c))