From acdadee053cbab2f06f42ccdfbafd6de849c0c5f Mon Sep 17 00:00:00 2001 From: barslev Date: Thu, 11 Sep 2025 13:03:55 +0200 Subject: [PATCH 1/3] Fix HTTP proxy handling for HTTPS requests --- src/utils/sdk.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/sdk.mts b/src/utils/sdk.mts index 9b1095ee3..235379b55 100644 --- a/src/utils/sdk.mts +++ b/src/utils/sdk.mts @@ -114,7 +114,7 @@ export async function setupSdk( } const { apiBaseUrl = getDefaultApiBaseUrl() } = opts - const ProxyAgent = apiProxy?.startsWith('http:') + const ProxyAgent = apiBaseUrl?.startsWith('http:') ? HttpProxyAgent : HttpsProxyAgent From b1e1c84c517f63e40cd4d8d3e15cf663d5a5bbfb Mon Sep 17 00:00:00 2001 From: barslev Date: Thu, 11 Sep 2025 13:08:04 +0200 Subject: [PATCH 2/3] Pass proxy to Coana through SOCKET_CLI_API_PROXY --- src/utils/coana.mts | 7 ++++++- src/utils/sdk.mts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/coana.mts b/src/utils/coana.mts index c8ba4b7b4..c26e2cd03 100644 --- a/src/utils/coana.mts +++ b/src/utils/coana.mts @@ -2,7 +2,7 @@ import { readJsonSync } from '@socketsecurity/registry/lib/fs' import { getDefaultOrgSlug } from '../commands/ci/fetch-default-org-slug.mts' import constants from '../constants.mts' -import { getDefaultApiToken } from './sdk.mts' +import { getDefaultApiToken, getDefaultProxyUrl } from './sdk.mts' import shadowBin from '../shadow/npm/bin.mts' import type { ShadowBinOptions } from '../shadow/npm/bin.mts' @@ -52,6 +52,11 @@ export async function spawnCoana( } } + const proxyUrl = getDefaultProxyUrl() + if (proxyUrl) { + mixinsEnv['SOCKET_CLI_API_PROXY'] = proxyUrl + } + try { const { spawnPromise } = await shadowBin( 'npx', diff --git a/src/utils/sdk.mts b/src/utils/sdk.mts index 235379b55..2e85d4209 100644 --- a/src/utils/sdk.mts +++ b/src/utils/sdk.mts @@ -24,7 +24,7 @@ function getDefaultApiBaseUrl(): string | undefined { } // The Socket API server that should be used for operations. -function getDefaultProxyUrl(): string | undefined { +export function getDefaultProxyUrl(): string | undefined { const apiProxy = constants.ENV.SOCKET_CLI_API_PROXY || getConfigValueOrUndef('apiProxy') return isUrl(apiProxy) ? apiProxy : undefined From 681a379c9d3d1e5927c198485a9d580ed2d19a42 Mon Sep 17 00:00:00 2001 From: barslev Date: Thu, 11 Sep 2025 13:10:51 +0200 Subject: [PATCH 3/3] Update CLI version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9aecdfad7..7d6b7ed1f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "socket", - "version": "1.1.6", + "version": "1.1.7", "description": "CLI for Socket.dev", "homepage": "https://github.com/SocketDev/socket-cli", "license": "MIT",