()
| 85 | } |
| 86 | |
| 87 | export function subprocessEnv(): NodeJS.ProcessEnv { |
| 88 | // CCR upstreamproxy: inject HTTPS_PROXY + CA bundle vars so curl/gh/python |
| 89 | // in agent subprocesses route through the local relay. Returns {} when the |
| 90 | // proxy is disabled or not registered (non-CCR), so this is a no-op outside |
| 91 | // CCR containers. |
| 92 | const proxyEnv = _getUpstreamProxyEnv?.() ?? {} |
| 93 | |
| 94 | if (!isEnvTruthy(process.env.CLAUDE_CODE_SUBPROCESS_ENV_SCRUB)) { |
| 95 | return Object.keys(proxyEnv).length > 0 |
| 96 | ? { ...process.env, ...proxyEnv } |
| 97 | : process.env |
| 98 | } |
| 99 | const env = { ...process.env, ...proxyEnv } |
| 100 | for (const k of new Set([ |
| 101 | ...GHA_SUBPROCESS_SCRUB, |
| 102 | ...GITHUB_PROVIDER_SECRET_ENVS, |
| 103 | ...getConfiguredProviderSecretEnvNames(), |
| 104 | ])) { |
| 105 | delete env[k] |
| 106 | // GitHub Actions auto-creates INPUT_<NAME> for `with:` inputs, duplicating |
| 107 | // secrets like INPUT_ANTHROPIC_API_KEY. No-op for vars that aren't action inputs. |
| 108 | delete env[`INPUT_${k}`] |
| 109 | } |
| 110 | return env |
| 111 | } |
no test coverage detected