cgagentharness-otel-hardening
Statically re-verify CG-agent-harness's telemetry-kill contract — the per-spawn-site child environments (gh, git, sandboxed checks, MCP servers, desktop sidecar), the telemetry-free Cargo lock graphs,
SKILL.md.claude/skills/cgagentharness-otel-hardening/SKILL.md
GitHubotel-hardening (CG-agent-harness)
Port of CyClaw's otel-hardening. Same contract, different mechanism: CyClaw's
Python dependencies phone home unless env vars are set before import, so its
kill switch is one canonical env block applied at every entry point. Rust crates
do not phone home; here the contract is (a) no telemetry SDK in either lock
graph, (b) every child environment the harness builds carries the opt-outs
for the external binary it launches, and (c) every network-capable
component is classified so a new crate, binary or spawn site cannot land
unlabeled. No pair below is a network kill switch: they silence vendor
telemetry readers, they close no socket. The sandbox denies network; the pairs
are its second layer, and on Windows (Job Object, sockets still work) the only
one.
Where the contract lives
| Piece | File | What |
|---|---|---|
| shared builder | src/common/child_env.rs |
one opt-out table per child kind (Gh, VerificationCheck, McpServer), applied last at each routed site; in common, so no crate::agentic (I6) |
| gh + git builder | src/agentic/git.rs environment() |
runtime, GitHub auth/config and SSH-agent allowlist + git hygiene + Gh arm. git's credential.helper is !gh auth git-credential, so git's env is gh's env |
| gh builder | src/agentic/gh_client.rs gh_env() |
Git allowlist without provider keys + GIT_TERMINAL_PROMPT=0 + Gh arm; every RunSpec in gh_client.rs/writer.rs passes env: Some(&gh_env()) |
| verifier builder | src/agentic/executor/runner.rs scrubbed_env() |
ALLOWED_ENV_VARS (6) + NO_PROXY=*, PIP_NO_INDEX, PIP_DISABLE_PIP_VERSION_CHECK, CARGO_NET_OFFLINE + VerificationCheck arm |
| MCP stdio | src/common/mcp.rs spawn() + mcp_worker.rs |
env_clear(), operator env through filter_env() (SECRET_ENV + HIJACK_ENV dropped), then McpServer arm (operator env cannot override it), fixed PATH/locale, scratch HOME |
| desktop | desktop/src/backend.rs start(), main.rs prepare_cargo()/external_link() |
sidecar + python helper carry RUSTUP_AUTO_INSTALL=0; the opener runs env_clear() with a fixed PATH |
| lock graphs | Cargo.lock, desktop/Cargo.lock |
no opentelemetry*, sentry*, posthog*, *telemetry*, *analytics* crate |
| oracle + inventory | check_otel.py |
the independent second copy of every pair, allowlist and strip list, plus the category 1–5 row for every crate, binary, launcher and provider |
The builder closed parity O6. The oracle credits each site only with the arm it actually calls, and an arm's names are never re-pinned at a site.
Steps
Static contract check (offline; reads files, never builds):
python3 .claude/skills/cgagentharness-otel-hardening/check_otel.py --strict --as-of $(date +%F)T1 builders present · T2 exact pairs per site, literals plus the arm it calls (missing / extra / flipped / unrouted all FAIL) · T3 allowlists and strip lists exact · T4 inventory staleness (120d) · T5 lock-graph telemetry-crate denylist, both crates · T6 verified-pin drift (reqwest, rmcp, axum, rustls, hyper, keyring, tantivy, tracing-subscriber, tauri;
DEFAULT_MIN_GH) · T7 everyCommand::new(file is listed andsrc/serverhas none · T8 no literal re-enable,remove_varorset_varof a kill name · T9 every gh/gitRunSpecroutes through its builder; the three external-binary sites carryDO_NOT_TRACK=1+GH_TELEMETRY=false· T10 every direct dependency, external binary and finetune requirement classified; dynamic launcher markers present · T11 MCP spawn/worker clear, opener clears, sidecar pins its home · T12 sandbox network-denial literals present:--unshare-net,--net, deny-default Seatbelt with(allow network*)only underUnrestricted.Mutation self-test — a checker that cannot fail proves nothing:
bash .claude/skills/cgagentharness-otel-hardening/verify.shOne mutation per rule, each asserting it changed the file. Neither script is in
.claude/settings.json's allowlist or any workflow: expect a permission prompt, and treat a red run as work, not as advisory.Live vendor sweep (network) — for each category-1/2 row whose
reviewedis old or whose pin drifted (T6), re-read the row's URL and confirm the control still exists with the same name, values and read timing:Vendor Re-verify gh (floor 2.40.0) gh help environmentstill documentsGH_TELEMETRYtrue/false/log andGH_NO_UPDATE_NOTIFIER? The names were inherited from CyClaw's 2026-08-27 read, not re-read at port time. IsGH_NO_EXTENSION_UPDATE_NOTIFIERstill separate?rustup RUSTUP_AUTO_INSTALL=0still the auto-install switch?cargo / pip CARGO_NET_OFFLINE,PIP_NO_INDEX,PIP_DISABLE_PIP_VERSION_CHECKunchanged?reqwest / rmcp / tauri changelog since the verified pin: any new default egress (update checks, crash reporting, a telemetry feature flag)? huggingface_hub / chromadb still the names a verified Python repo reads (CyClaw's rows are the reference) Close a real gap (additive, low-risk): change the Rust site AND
check_otel.py's oracle AND the inventory row (reviewed, evidence) in one commit, add averify.shmutation for any new rule, re-run steps 1–2, thencargo test(the sites have unit tests:git.rs,mcp.rssecret_env_names_are_stripped,child_env.rs). A new opt-out goes in achild_envarm, never a site literal. The lock-graph half is CI-enforced:[bans].denyindeny.tomlanddesktop/deny.tomllists the T5 families by exact crate name; a new family's names go in both files.Classify anything new; retire anything gone. A new crate, binary, provider, connector or spawn site gets an
INVENTORYrow or alias with exactly one category: 1 unsolicited telemetry with an official control (the pair must be delivered by aSITESbuilder — never invent one) · 2 update/version/toolchain-fetch egress · 3 intentional policy-gated feature traffic (controls stay empty) · 4 local-only, or network denied by the sandbox · 5 no mechanism found (evidence + date). T10 reads both manifests andfinetune/requirements.txtwhen present, but an external binary is swept only if named inKNOWN_EXTERNAL_BINARIES, and a run-time-chosen executable (MCP servers, caller checks) lives inDYNAMIC_LAUNCHER_SITESwith the source marker that proves it still spawns. Remove the alias and row when a pin or site goes.
Guardrails
- I6 is untouched by this skill: it reads; it never adds a server-side
spawn. T7 fails on any
Command::new(undersrc/server. - Category-3 traffic is gated by harness policy, never by a kill pair: the cloud providers, web search, webhooks, MCP clients, gh writes. Never block them with an env pair and never weaken a gate to simplify one.
- Write gates stay closed:
agentic.enabled,deepagent_github.enabled,allow_git_write_toolsship false; this skill changes none of them. - The checker keeps zero side effects: no cargo, no network, no writes.
Gotchas
Command::new(is the sweep marker.Command::newinside a string (the governance regex) oruse tokio::process::Command;does not match; a spawn built another way (posix_spawnvia libc) would not either — add a marker.- The bypass sweep strips from the first
#[cfg(test)]to end of file. A test-only item placed mid-file hides the production code after it from T7/T8 (false negative, never a false positive). Keep tests last. ANONYMIZED_TELEMETRYis lower-casefalsehere,Falsein CyClaw. Both parse the same; do not "align" one side and break its oracle.NO_PROXY=*bypasses proxies; it does not fail-close networking. The sandbox does. Windows is env-only.- Ollama has no telemetry switch to set.
POST /api/ollama/pullasks the daemon to fetch a model; the daemon's registry egress is outside this process. Do not add a speculativeOLLAMA_*pair. cargo denybans exact names; T5 matches patterns. A telemetry crate under a name neitherdeny.tomllists passes CI until both list it; T5 still catches it. Verify a name on crates.io before adding it.- The desktop lock resolves two
reqwestmajors (0.12 via the harness, 0.13 via tauri); duplicate versions are warn-only policy, reported as INFO.