AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Does Sourcegraph Cody Store or Train AI Models on Your Proprietary Codebase? Zero-Retention Guarantees, LLM Gateway Boundaries, and Telemetry Explained

Vanessa Morais · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

The short, legally binding answer is no. Under Sourcegraph Cody Enterprise and Pro agreements, neither Sourcegraph nor its third-party model providers—Anthropic, OpenAI, or Google—use your proprietary code, prompts, or generated completions to train foundational AI models.

At 365Finds, we know that an executive summary on a legal terms page rarely satisfies a Chief Information Security Officer (CISO) or a cautious architecture review board. When a software engineering team connects an AI assistant to core algorithmic IP, proprietary trading engines, or regulated healthcare workflows, "trust us, it is in our terms of service" is never enough. Security leaders need to see the wire protocols, the boundary proxies, the transient memory lifecycles, and the telemetry escape hatches.

Here is how Sourcegraph Cody actually handles your source code across the wire, how Zero Data Retention (ZDR) operates in production, where Cody Gateway sits in the trust boundary, and the concrete steps required to audit and lock down the entire transmission pipeline.


The Core Question: Does Any Code Stay Behind?

When evaluating Sourcegraph Cody, enterprise risk teams face two distinct fears:

  1. Model Contamination: Could private code fragments be sucked into next-generation foundation model weights, later to be regurgitated in another company's editor?
  2. Persistent Storage & Leakage: Does Sourcegraph, an upstream LLM vendor, or an intermediary cloud proxy store prompt payloads, file paths, or generated diffs on disk where they could be subpoenaed, breached, or exposed via log dumps?

For Sourcegraph Cody Enterprise, both risks are addressed through contractual guarantees backed by architectural isolation.

DimensionCody FreeCody ProCody Enterprise (Default Gateway)Cody Enterprise (BYOK / Private VPC)
Model Training on Customer CodeNo (unless explicit consent given)Strictly NoStrictly NoStrictly No (governed by your model provider agreement)
LLM Provider RetentionTransient / Standard provider termsZero Data Retention (ZDR)Zero Data Retention (ZDR)Governed directly by your cloud vendor agreement
Cody Gateway Intermediary StorageTransient proxyTransient proxyTransient proxy; no prompt loggingCompletely bypassed; direct VPC routing
Customer Content OwnershipUser owns inputs & outputsUser owns inputs & outputsCustomer owns all inputs & outputsCustomer owns all inputs & outputs
IP IndemnificationNoneLimitedFull uncapped IP indemnification availableStandard enterprise agreement terms
Telemetry Opt-OutLimited editor togglesEditor togglesFull air-gapped / telemetry export disablementFull air-gapped / telemetry export disablement

At 365Finds, we appreciate the clarity of Sourcegraph's contractual stance: in their Enterprise Terms of Use, customer content is strictly segregated, model training is explicitly barred, and intellectual property indemnification is offered without standard arbitrary liability caps if you use their filtering mechanisms.

Contracts, however, are merely legal remedies after an incident. What prevents the incident is system architecture.


The Journey of a Code Snippet: How Context Travels

Sourcegraph Cody does not simply push your entire Git repository into an external model context window. That would be computationally prohibitive, slow, and a massive security violation.

Instead, Cody relies on Sourcegraph's code graph engine. When an engineer triggers an autocomplete event or types a chat prompt in VS Code or JetBrains, the following sequence occurs:

[ Developer Editor (IDE) ]
           │
           │ (1) User Prompt + Local Context Selection
           ▼
[ Sourcegraph Instance (Self-Hosted / Cloud) ]
   ├── AST / Symbol Search & Code Graph Lookup
   ├── Repository Permission Validation (ACL Check)
   └── Context Assembly (Selected Snippets Only)
           │
           │ (2) Curated LLM Prompt (HTTPS / TLS 1.3)
           ▼
[ Cody Gateway (cody-gateway.sourcegraph.com) ]
   ├── License & Quota Validation
   ├── Rate Limiting & Routing
   └── Zero Persistence Proxy Pipeline
           │
           │ (3) Upstream API Call under ZDR Contract
           ▼
[ Frontier LLM Provider (Anthropic / OpenAI / Google) ]
   ├── In-Memory Inference on GPUs
   ├── Streaming Response Generation
   └── Immediate Ephemeral Buffer Erasure (Zero Disk Retention)

1. Context Minimization at the Source

Cody uses precise code graph queries, symbol lookups, and embedding indexes to pinpoint only the relevant functions, interfaces, or type signatures needed to answer the prompt. If an engineer asks a question about an authentication handler, Cody grabs that specific file slice and referenced interfaces. It does not dump the adjacent payment processing logic. Crucially, Cody enforces Sourcegraph's existing access control lists (ACLs): a developer cannot extract context from repositories they lack permissions to read.

2. The Cody Gateway Boundary

By default, the assembled prompt leaves the Sourcegraph instance and travels to Cody Gateway (cody-gateway.sourcegraph.com). Cody Gateway acts as a managed routing proxy. It verifies your enterprise license key, monitors token consumption against your quota, and forwards the payload to the selected model provider (such as Anthropic Claude 3.5 Sonnet or OpenAI GPT-4o).

What does Cody Gateway store?

3. Upstream Model Inference and Transient Memory Wiping

The final hop lands in the enterprise API environment of the model provider. Under standard consumer terms, AI companies often log prompts for 30 days to monitor for trust and safety abuses.

Under Sourcegraph's negotiated enterprise partner agreements, this retention is explicitly converted to Zero Data Retention (ZDR). The incoming payload resides exclusively in volatile GPU/CPU memory during the forward inference pass. The moment the final token streams back to the client, those transient memory allocations are released. No text persists on the provider's disks, and no human annotators review the payloads.


The BYOK Dilemma: Is Bringing Your Own Key Actually Safer?

A recurring pattern 365Finds observes among enterprise security teams is an instinctive demand to use Bring Your Own Key (BYOK) or private cloud endpoints (such as AWS Bedrock or Azure OpenAI Service). The reasoning seems intuitive: cut out Cody Gateway, keep billing on existing cloud commitments, and eliminate an intermediary hop.

While BYOK does give you perimeter isolation, it introduces an unexpected governance paradox that many security teams overlook:

  1. Loss of Sourcegraph's Master ZDR Coverage: Sourcegraph's enterprise terms explicitly state that if you configure Cody to route through your own LLM provider API credentials, Sourcegraph’s representations regarding Zero Retention, training exclusion, and data handling cease to apply to that traffic.
  2. The Default 30-Day Retention Trap: If you provide your own standard commercial API key from OpenAI or Anthropic without having a signed enterprise Zero Data Retention agreement in place directly with that vendor, your code requests will fall under your vendor’s default API terms—which frequently include 30-day abuse monitoring persistence.
  3. The Recommended Safe Path for BYOK: If your policy mandates BYOK, you must deploy through AWS Bedrock (where zero data retention and strict encryption are enforced within your AWS boundary) or Azure OpenAI Service with an approved Modified Customer Data Concurrence (which explicitly waives Azure's default 30-day prompt logging).

At 365Finds, our recommendation is blunt: do not switch to BYOK merely to feel in control unless your security team has already secured and verified zero-retention waivers directly from Microsoft, Amazon, or the model provider. If you have not done that paperwork, using Sourcegraph Cody's default enterprise gateway is contractually and architecturally safer.


Deconstructing Telemetry: What Leaves the Enterprise Perimeter?

Zero retention for model inference is only half the compliance equation. The other half is telemetry. Where do error logs, feature interactions, and diagnostic metrics go?

Sourcegraph splits operational telemetry into distinct categories:

1. Usage Data and Event Pings

Self-hosted Sourcegraph instances routinely generate high-level operational pings back to Sourcegraph infrastructure. These pings contain aggregate counts: total active users, completion acceptance rates, search query frequencies, and instance version numbers. They do not contain code snippets, repository names, or file contents.

2. The IDE Client Footprint

Within developer workstations, the Cody extension (available for VS Code, JetBrains, and Neovim) captures local events: whether a suggested inline completion was accepted, rejected, or partially edited.

In enterprise environments, these editor extensions can be locked down:

3. Disabling Telemetry Completely (Air-Gapped Operation)

Can an enterprise completely silence telemetry exports? Yes, but with an important operational caveat that 365Finds believes every CISO must understand.

On self-hosted instances, disabling all outbound telemetry exports requires a license key provisioned with air-gapped or telemetry-disabled tags (Allow air gapped or Allow disable telemetry export). When that license is present, administrators can safely update the site configuration:

{
  "update.channel": "none"
}

If an enterprise attempts to block outbound traffic at the network firewall without having an air-gapped license provisioned, the Sourcegraph instance will repeatedly fail its periodic license validation checks, eventually degrading administrative functionality. Telemetry shutdown is tied directly to your commercial licensing contract.


Verification Guide: How Security Teams Can Audit Cody

Trusting architecture diagrams is insufficient for compliance sign-off. 365Finds recommends that internal security and audit teams execute four practical verification controls:

┌──────────────────────────────────────────────────────────┐
│             Enterprise Security Audit Steps              │
├──────────────────────────────────────────────────────────┤
│ 1. Inspect Local Payloads:                               │
│    Enable "Cody › Debug: Verbose" in IDE settings to     │
│    review raw prompt construction and context windows.   │
│                                                          │
│ 2. Egress Traffic Inspection:                            │
│    Audit network egress to ensure traffic only flows to  │
│    approved endpoints (cody-gateway.sourcegraph.com or   │
│    internal AWS Bedrock/Azure OpenAI VPC endpoints).     │
│                                                          │
│ 3. SOC 2 Type II & ISO Portal Verification:              │
│    Pull Sourcegraph's latest SOC 2 Type II audit,        │
│    ISO/IEC 27001, and ISO 42001 (AI Management) reports │
│    via security.sourcegraph.com.                         │
│                                                          │
│ 4. Repository Access Permission Parity:                  │
│    Verify that Cody's context retrieval strictly matches │
│    Git branch permissions and organizational ACLs.       │
└──────────────────────────────────────────────────────────┘
  1. Inspect IDE Client Payloads: Enable verbose logging in developer IDEs by toggling Cody › Debug: Verbose. Open the editor output panel to inspect the exact JSON structures being dispatched. You will observe that the context payload contains only isolated code excerpts directly relevant to the open file or symbol, not background repository dumps.
  2. Audit Outbound Network Egress: In self-hosted deployments, verify that all AI traffic routes exclusively through either https://cody-gateway.sourcegraph.com or your designated internal cloud endpoint. Any unexpected outbound network attempts to external AI endpoints should trigger firewall alerts.
  3. Verify Third-Party Certifications: Request the current SOC 2 Type II audit report, ISO/IEC 27001 certificate, and ISO 42001 documentation directly from Sourcegraph’s Trust Center (security.sourcegraph.com). Review Section III of the SOC 2 report to verify testing around data handling, tenant segregation on Google Cloud Platform, and access control boundaries.
  4. Audit Context Permissions: Conduct a black-box test across your repository hierarchy. Ensure that a user without permissions to read a specific repository (e.g., core financial clearing modules) cannot extract information from that repository through Cody chat by using @-mentions or code graph queries.

The 365Finds Assessment

For organizations with mission-critical intellectual property, Sourcegraph Cody provides one of the cleanest enterprise privacy architectures currently available in the AI developer tool ecosystem. By placing a governed proxy layer (Cody Gateway) between the source code graph and frontier foundation models, and backing that layer with contractual Zero Data Retention and uncapped IP indemnification, Sourcegraph effectively eliminates the risk of model weight contamination.

The operational responsibility, however, rests squarely on your enterprise configuration:

Sourcegraph Cody provides the architectural controls; enterprise compliance depends on configuring them correctly.


References