docs/cache-harness-threat-model.md

Cache Harness Threat Model

This threat model covers the v2 cache harness: prompt sections, context packs, cache policies, provider cache hints, trajectory records, and episode packages.

Assets

Trust Boundaries

Threats And Mitigations

ThreatRiskMitigationVerification
Cross-workspace cache reuseA prefix from one workspace influences another workspace.Cache policy derives a workspace/account/org-scoped key and uses provider salts where supported.Provider adapter tests cover vLLM cache_salt; cache-policy tests cover scope-derived keys.
Explicit cache handle reuseA stale or cross-workspace Gemini cached-content handle is reused.Explicit cached-content handles are opt-in, scoped by policy, and treated as missing/expired when not configured.Google adapter tests cover explicit cachedContent request shape and cached-token parsing.
Incorrect Anthropic breakpointDynamic message content is marked with cache_control and becomes part of a provider cache prefix.Breakpoints are derived from stable section ids only and dynamic suffix sections are non-cacheable by default.Anthropic adapter tests cover tool/system/message cache-control placement.
Raw prompt report leakageLocal prompts, code, memory, or tool output appear in public reports.Episode packages run public-safe redaction and privacy audit before export.pnpm exec tsx scripts/security/verify-cache-privacy.ts.
Dynamic data promoted into prefixTool output, timestamps, budget counters, or provider raw responses become cacheable.Prompt sections carry stability labels; turn-dynamic sections are placed late and are non-cacheable by default.Core provider-planning test asserts dynamic suffix isolation; cache harness tests assert section hashing.
Provider cache policy overrideCache warmth changes an explicit user provider/model choice.Routing treats cache warmth only as a tiebreaker after user preference, capability, and budget.packages/providers/test/routing.test.ts.
Ad or sponsor context injectionAd targeting or sponsor data affects model prompts.Ads remain outside context-pack builders and public-safe report content.Core and privacy scans check ad metadata absence.
Telemetry leakageRaw prompt, code, memory, credentials, env vars, or tool output enter telemetry.Telemetry scrubbers reject prohibited keys and values; cache harness reports are scanned separately.Telemetry privacy tests and cache privacy script.
Benchmark escapeA benchmark run succeeds by reading hidden answers, copied outputs, git history, or forbidden paths.Benchmark-escape scenarios declare forbidden paths and invalid shortcut policy; H3 reports include failure attribution.scenarios/cache-harness/benchmark-escape/ and harness verification reports.
Stale memory poisoningOld or irrelevant memory enters stable prefix and persists bad behavior.Memory selection caps token budget, records omitted reasons, and marks stale facts non-cacheable.Memory-heavy scenario and memory retrieval tests.
Shared session raw replayPublic session share exposes raw trajectory evidence.Shared-session rendering redacts raw prompt/tool/provider evidence while keeping hashes and counts.Sessions sharing tests and dashboard public-safe replay tests.

Default Posture

Residual Risks