How to Block Customer Data Files from the OpenAI Code Interpreter Tool
Block files from OpenAI Code Interpreter in layers. Disable or remove the tool wherever you control configuration, restrict which identities and routes can reach AI endpoints, and enforce policy on tool calls and file attachments at runtime. Configuration covers only the paths it applies to. Enforcement in the execution path applies one decision to every request routed through it and records each decision as evidence.
Evidence to retain for each decision
- Timestamp and request identifier
- Calling identity, application and surface
- Tool requested and file attributes: name, detected type, size, hash
- Policy version and the rule that matched
- Decision (allow, redact, block, escalate) and approver where applicable
- Storage location and retention period for the record
How customer files reach Code Interpreter
Code Interpreter ingests uploaded or attached files, such as spreadsheets, CSVs and documents, and processes them in a sandboxed execution environment. The sandbox limits what the code can do on the host. It does not decide whether a customer data file should have been sent in the first place.
Files reach the tool through four kinds of path: people working in the ChatGPT interface, applications calling the Assistants API, applications calling the Responses API, and agent frameworks that declare the tool on a user's behalf. The actors differ. Interface use is driven by individual employees. API and agent paths are driven by developers, and a file can be attached by code that no reviewer ever sees at the moment of use.
The exposure is a data-handling problem, not only a tooling one. The FTC has noted that customers of model-as-a-service companies may reveal sensitive or confidential information, including their own users' data, and that there is no AI exemption from the laws on the books. Treat a file sent to Code Interpreter as a disclosure decision that needs a policy and an owner.
Which control layer addresses which path
No single layer covers every path. Each of the four below removes a different part of the exposure and leaves a different gap. A January 2026 federal request for information on AI agent security lists data or tool restrictions and continuous monitoring as separate system-level control categories. It is an information request, not a rule, but the separation matches how these controls behave in practice.
For every setting you rely on, confirm what it covers by testing it from each surface with a seeded test file, rather than assuming its scope.
- Configuration-level disablement: Turns the tool off where the setting applies. Coverage ends at the boundary of the account, workspace or project the setting was applied to.
- Tool definitions in API requests: Applications omit the tool from the requests they build. This covers code you own. It does not stop other applications, scripts or direct calls made with valid credentials.
- Identity and network restrictions: Limit which identities and egress routes can reach AI endpoints. This narrows the path and supports a single enforcement point, but it does not inspect files or tool calls.
- Runtime policy enforcement: Evaluates each tool call and attachment in the execution path. It is consistent across every surface routed through it, and it only sees traffic that passes through it.
Classifying files and tool calls in the request path
Enforcement needs a reliable way to recognize a customer data file. Use several signals together, because any one of them can be wrong or evaded.
Start with the tool call itself. A request that declares Code Interpreter, or an agent step that invokes it, is the first decision point and can be policy-checked before any file is read. Next, check attachment attributes: declared file type, the actual type detected from file contents rather than the extension, size, and file name. Then use metadata and origin, such as the calling application, the user's group, or a sensitivity label from the source system. Finally, apply content patterns, such as identifier formats, account numbers or column headers that indicate customer records. For structured files, inspect a sample of rows as well as the header.
The decision options need different handling. Redaction works for inline text but is unreliable for spreadsheets and documents, so block is the safer default for files. Use escalation for human approval where a legitimate business need exists. Treat archives, encrypted files and unreadable content as deny by default, since they cannot be classified. Expect a tradeoff between false positives and coverage, and tune rules against real traffic before tightening them.
Where runtime enforcement fits
Trussed enforces policy in the execution path across models, agents, tools and MCP servers. For this use case, that means evaluating Code Interpreter tool calls and file attachments at the level of individual interactions. Each interaction is allowed, redacted, blocked, rate limited or escalated for human approval, and the decision is enforced at runtime, not reviewed after the fact.
The same decision point applies across every surface routed through it, so policy does not depend on which interface or framework a team chose. Enforcement generates audit-ready evidence for each decision, mapped to frameworks including HIPAA and NIST. Trussed can be deployed self-managed in the customer cloud, with configurable retention and data residency, which matters when the evidence itself contains sensitive details. Trussed has run continuously in production at a regulated enterprise for more than 18 months.
This layer complements the others. It does not replace configuration settings or credential controls, and it cannot see traffic that bypasses it.
Layers that keep customer data files away from the tool
Configuration
Disable or remove the tool where you own the setting.
Identity and network
Limit who and what can reach AI endpoints.
Runtime policy
Evaluate each tool call and attachment: allow, redact, block.
Evidence
Record every decision with the rule that produced it.
Enforce file policy where the tool call happens
See how policy on tool calls and attachments is enforced in the execution path, and how each decision becomes audit-ready evidence.
Explore Agent and Tool-Call Enforcement