fix: gate preconnectAnthropicApi behind isEssentialTrafficOnly()
CC_Pure: was the last un-gated outbound connection — it unconditionally sent a TCP+TLS handshake to api.anthropic.com on every startup. Now checked against the central privacy gate (CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1) and skipped when enabled. Verified via strace: zero remote connections after fix.
This commit is contained in:
parent
144c4f551c
commit
6ddad59d2f
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
import { getOauthConfig } from '../constants/oauth.js'
|
import { getOauthConfig } from '../constants/oauth.js'
|
||||||
import { isEnvTruthy } from './envUtils.js'
|
import { isEnvTruthy } from './envUtils.js'
|
||||||
|
import { isEssentialTrafficOnly } from './privacyLevel.js'
|
||||||
|
|
||||||
let fired = false
|
let fired = false
|
||||||
|
|
||||||
|
|
@ -32,6 +33,9 @@ export function preconnectAnthropicApi(): void {
|
||||||
if (fired) return
|
if (fired) return
|
||||||
fired = true
|
fired = true
|
||||||
|
|
||||||
|
// CC_Pure: skip preconnect when non-essential traffic is disabled
|
||||||
|
if (isEssentialTrafficOnly()) return
|
||||||
|
|
||||||
// Skip if using a cloud provider — different endpoint + auth
|
// Skip if using a cloud provider — different endpoint + auth
|
||||||
if (
|
if (
|
||||||
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
|
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user