CC_Pure: disable telemetry, GrowthBook, analytics sinks and gates
4-layer defense-in-depth: Layer 1 (wrapper): CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 + redundant guards Layer 2 (init.ts): Cut GrowthBook/1P Event Logging init + doInitializeTelemetry() early return Layer 3 (sinks.ts): Do not attach initializeAnalyticsSink() Layer 4 (main.tsx): Do not call initializeAnalyticsGates() No functional code modified. Only init paths and sink attachment are cut. config.ts preserved as-is (no hardcoded return true). Modified: 3 source files (init.ts, sinks.ts, main.tsx) Plus: config.ts restored from earlier return-true experiment back to original. Verified: - bun run build: OK (491 files bundled) - strace --version: 0 external connections - strace --help: 0 external connections - strace -p prompt: 0 api.anthropic / statsig / sentry / datadog / growthbook connections
This commit is contained in:
parent
72ab9bc764
commit
dd9bfcbbec
|
|
@ -92,8 +92,10 @@ export const init = memoize(async (): Promise<void> => {
|
|||
// loading OpenTelemetry sdk-logs at startup). growthbook.js is already in
|
||||
// the module cache by this point (firstPartyEventLogger imports it), so the
|
||||
// second dynamic import adds no load cost.
|
||||
// CC_Pure: GrowthBook + 1P Event Logging 已永久禁用
|
||||
// (原代码保留以供参考)
|
||||
// CC_Pure: GrowthBook remote config and 1P Event Logging are permanently disabled.
|
||||
// Rationale: prevent startup-time remote feature flag fetching and Anthropic 1P event export.
|
||||
// Original code kept below for auditability.
|
||||
//
|
||||
// void Promise.all([
|
||||
// import('../services/analytics/firstPartyEventLogger.js'),
|
||||
// import('../services/analytics/growthbook.js'),
|
||||
|
|
@ -289,8 +291,9 @@ export function initializeTelemetryAfterTrust(): void {
|
|||
}
|
||||
|
||||
async function doInitializeTelemetry(): Promise<void> {
|
||||
// CC_Pure: 遥测已完全禁用
|
||||
return;
|
||||
// CC_Pure: Telemetry initialization is permanently disabled.
|
||||
// Rationale: avoid loading OpenTelemetry SDK and prevent metrics/logs/traces setup.
|
||||
return
|
||||
|
||||
// Set flag before init to prevent double initialization
|
||||
telemetryInitialized = true
|
||||
|
|
|
|||
|
|
@ -688,7 +688,8 @@ export function startDeferredPrefetches(): void {
|
|||
void countFilesRoundedRg(getCwd(), AbortSignal.timeout(3000), []);
|
||||
|
||||
// Analytics and feature flag initialization
|
||||
// CC_Pure: Analytics gate 初始化已永久禁用
|
||||
// CC_Pure: Analytics gate initialization is permanently disabled.
|
||||
// Rationale: avoid GrowthBook-backed analytics/feature-gate evaluation during startup.
|
||||
// void initializeAnalyticsGates();
|
||||
void prefetchOfficialMcpUrls();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,13 @@ import { isTelemetryDisabled } from '../../utils/privacyLevel.js'
|
|||
* - Privacy level is no-telemetry or essential-traffic
|
||||
*/
|
||||
export function isAnalyticsDisabled(): boolean {
|
||||
// CC_Pure: 永久禁用所有遥测上报(Anthropic 数据收集已完全移除)
|
||||
return true;
|
||||
return (
|
||||
process.env.NODE_ENV === 'test' ||
|
||||
isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ||
|
||||
isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ||
|
||||
isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ||
|
||||
isTelemetryDisabled()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { initializeAnalyticsSink } from '../services/analytics/sink.js'
|
|||
*/
|
||||
export function initSinks(): void {
|
||||
initializeErrorLogSink()
|
||||
// CC_Pure: Analytics sink 已永久禁用
|
||||
// CC_Pure: Analytics sink is permanently disabled.
|
||||
// Rationale: keep local error logging, but do not attach telemetry/analytics event pipelines.
|
||||
// initializeAnalyticsSink()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user