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", 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 9b1095ee3..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 @@ -114,7 +114,7 @@ export async function setupSdk( } const { apiBaseUrl = getDefaultApiBaseUrl() } = opts - const ProxyAgent = apiProxy?.startsWith('http:') + const ProxyAgent = apiBaseUrl?.startsWith('http:') ? HttpProxyAgent : HttpsProxyAgent