Insights
How to Prevent an LLM from Accessing Confidential Development Data
Keep confidential data out of LLM context with isolated workspaces, sanitized inputs, retrieval authorization, tool permissions and boundary tests.

On this page
The most reliable way to keep an LLM away from confidential development data is to never give it that data. That means controlling what enters the model's context and limiting what the software running it is allowed to do. In practice, use a sanitized workspace, synthetic test data, narrowly scoped credentials, authorized retrieval and tool permissions that are enforced outside the model.
Keep secrets out of prompts, logs and training datasets. A "never reveal secrets" instruction won't protect you, and neither will a training opt-out or an encrypted connection. If you send data to a model, the model processes it.
In short:
- Withhold, don't hide: keep confidential data out of the model's context in the first place.
- Enforce outside the model: permissions belong in application code, not in prompts.
- Test with harmless markers: prove the boundary holds before real data gets near it.
Decide what the assistant must never receive
Start with the data boundary, then choose a control for each route into the assistant. Your checks should cover proprietary content as well as personally identifiable informationOpens in a new tab (PII).
- Classify prohibited data. Include credentials, customer records, proprietary source code and unreleased designs. Decide what can appear in an approved development copy and what must stay completely out of reach.
- Identify the entry points. A coding assistant may read workspace files or terminal output. An application agent may retrieve documents, query databases or call tools with credentials from its runtime.
- Enforce before the model sees anything. Apply file isolation, input checks, retrieval authorization or tool-execution checks before content reaches the model, and grant access only to the data a specific user or process needsOpens in a new tab.
A short inventory makes the boundaries concrete:
| Entry point | What's at risk | Control before model access |
|---|---|---|
| Prompts | Pasted records or designs | Review and sanitize input |
| Files | Credentials, restricted code | Approved workspace, restricted mounts |
| Terminal output | Environment values, diagnostic records | Restrict commands, sanitize results |
| Connectors | Private documents, database rows | User-specific authorization |
| Logs | Prompt traces, tool results | Sanitize before storing or reusing |
For coding assistants, workspace and runtime restrictions come first. Once an assistant has connectors, database access or execution tools, retrieval authorization and tool gating become essential.
Give the assistant a sanitized workspace
Give the assistant an allowlisted working copy that contains only approved source, documentation and synthetic test fixtures. That's far easier to reason about than a sensitive workspace with exclusions bolted on afterward.
- Build the approved copy. Include the files the task needs, not your whole development environment. Keep production exports, private keys,
.envfiles and confidential documents outside the assistant's filesystem. - Restrict the runtime. If the agent has shell access, run it in an isolated environment with only the mounts it needs. Don't let it inherit production credentials from the host.
- Check tool-specific exclusions. A repository ignore file controls repository behavior, not necessarily an assistant's file access. Confirm that documented exclusions cover direct reads, indexing, search and shell tools.
- Verify the boundary. Put a harmless marker in a prohibited test file and try to reach it through every enabled route. If any route returns it, fix that route before any confidential material goes near the assistant.
An agent with shell access needs sandboxing and oversightOpens in a new tab. Hiding a file in an editor doesn't prove the agent's runtime can't read it. For example, an approved code copy can use synthetic fixtures while the original production export stays outside every mounted directory. These are general implementation steps, not settings for any particular editor.
Remove sensitive content before prompts, indexing and training
Sanitize data before it enters a prompt, a document index or a training set. Filtering the model's answer is too late, because the model has already seen the input.
- Scan approved inputs. Review code, documentation, logs and connector content before ingestion, looking for recognizable secrets and organization-specific confidential material.
- Replace or remove sensitive content. Use synthetic records instead of customer exports, and redact restricted designs and proprietary content, not just credential patterns.
- Keep credentials out of model-visible results. Store operational credentials in a secrets manager. A tool can use a credential without ever returning its value to the assistant.
- Sanitize retained copies. Check prompt traces, retrieved context and saved summaries before they're stored or reused.
The usual advice is to scrub data, vault secrets and monitor AI logs before connecting internal systemsOpens in a new tab. Pattern-based detection can miss sensitive material, especially when something is confidential because of its business context and not its format. Add organization-specific rules and human review for those cases.
Review provider processing, retention, training and third-party-tool policies separately. A training opt-out only covers training. It doesn't mean your request isn't processed. Self-hosting doesn't help either, because your own model still receives whatever you submit. Recheck these controls whenever your integrations change, since platform interfaces and control mechanisms keep evolvingOpens in a new tab.
Runtime permissions can block future retrieval, but fine-tuning needs clean data before training startsOpens in a new tab. Changing permissions later won't remove confidential material from trained weights.
Enforce permissions on retrieval and tool execution
Put access decisions in application code or an authorization service, outside the model. Treat a tool call generated by the model as a proposal, not as permission to run.
- Use separate development identities. Give each workflow only the resources and operations it needs, and never hand it a developer's broad production credentials.
- Allowlist tools and validate arguments. Permit narrow operations against approved resources. Prefer APIs that return approved fields over arbitrary SQL or unrestricted shell access.
- Authorize every execution. Look up the authenticated user's permissions and check the proposed resource and operation before the tool runs.
- Authorize retrieved content before it enters context. Filter searches by the asking user's permissions, then recheck access to each source document before adding its content to the prompt.
A good pattern is propose, review, execute: the model proposes a call, external logic reviews it, and the call runs only after approval (see this patternOpens in a new tab). Never infer a user's authorization from model outputOpens in a new tab.
For retrieval-augmented generation (RAG), where retrieved documents are added to the model's context, an index filter shouldn't be the final authority. Check current access against the source system before including a retrieved chunkOpens in a new tab, because an older index entry may not reflect a recent permission change.
Read-only credentials can still leak data. If a sensitive read needs human approval, get that approval before retrieval, not after the model has the result. Apply the same external checks to database tools, APIs and tools exposed through MCP.
Keep sessions, caches and derived data isolated
Treat summaries, embeddings and cached tool results as confidential records. Moving information out of the original document doesn't make it safe to share across users or environments.
- Attach boundary metadata. Key saved state by tenant, user and environment, and write tenant metadata alongside embeddings so similarity searches can filter on itOpens in a new tab.
- Enforce boundaries on reads and writes. Keep development and production stores separate, and don't share agent context between users with different permissions.
- Manage derived copies. Summaries, caches and indexes need retention rules and a deletion path linked to the original records. Every derived store needs a retention period and a reachable way to delete itOpens in a new tab.
For example, a cached document summary shouldn't become available to another user just because it's shorter than the original. Check the requester's permissions before loading it into context, and account for permissions that have changed since it was cached.
A tenant-aware output check can catch some mistakes, but it's a backstop. It can't replace authorization before the model receives another tenant's content.
Limit network reach, but don't confuse it with data access
Make development services reachable only by the intended devices and identities, then enforce resource permissions separately. Network controls limit where an agent can connect. Application controls decide what it can read or run once connected.
Use firewall rules to restrict access to services, and outbound-destination controls to cut unnecessary connections. Test both the allowed and the denied paths. An allowed destination can still receive a sensitive payload, so destination filtering has to go together with input sanitizing and tool authorization.
For private connectivity, doxx.net is a private network with firewalls, domain filtering, private domains, private PKI certificates, agent identity and authorized API/MCP tools for network management. Those capabilities support network configuration. You'll still need application-level checks for database rows, documents and tools. To get started, create an accountOpens in a new tab, download the appOpens in a new tab and connect a device or agent.
Encryption protects the transport, but it doesn't hide a request from the model service that receives it. Private connectivity doesn't stop prompt injection or every kind of leak, so keep the model's proposed actions under external authorization even when the connection is private.
Verify denied access with harmless test data
Test your boundaries in an authorized environment using harmless, unique markers, never live credentials. Use a low-privilege account, not the account that built the assistantOpens in a new tab, so broad development permissions don't hide failures.
- Prepare permitted and prohibited test resources. Put markers in test files, documents and caches that have deliberately different access permissions.
- Exercise every enabled route. Test file reads, retrieval, tools, network connections and session state.
- Inspect the control decisions. Look at retrieval results, execution decisions and sanitized request traces, not just the model's answer.
- Fix failures and repeat. Suspend the affected integration, fix the boundary and rerun both the denied and the allowed tests.
| Test | Expected result | If it fails |
|---|---|---|
| Read an excluded file | Denied or unavailable; marker absent from model input | Fix workspace exposure, mounts or tool exclusions |
| Retrieve another user's document | Rejected before context is built | Fix search filters and source-permission checks |
| Invoke a denied tool | Rejected by the external gate | Fix identity permissions and argument validation |
| Connect to an unapproved endpoint | Blocked by network controls | Correct destination restrictions |
| Read another session's cache | Denied; marker absent from context | Fix session keys and read authorization |
| Use an approved file or tool | Content arrives or operation succeeds | Repair the integration if the allowed path fails too |
A refusal like "I can't reveal that" doesn't prove the model lacked access, and prompt-based restrictions can be bypassedOpens in a new tab. Check whether the prohibited content ever entered context at all. Passing these tests supports the boundaries you tested. It isn't a guarantee against every leak or attack.
If confidential data has already reached the model
Stop the affected workflow and treat the incident as a disclosure that needs review. Changing a prompt or a permission prevents future access, but it can't undo what the model already received.
- Contain access. Suspend the affected connector, tool or workflow, and notify your security team or data owner through your incident process.
- Revoke or rotate exposed credentials. If a working credential was submitted, deal with the credential itself. Deleting the conversation isn't enough.
- Trace retained copies. Review conversations, logs, caches, indexes and downstream services. A secret exposed in logged processing steps can leave several copies behindOpens in a new tab.
- Use available deletion mechanisms. Check what each one actually covers, and clear derived stores through their own deletion paths. Don't assume that deleting a conversation removes provider records, downstream copies or trained model content.
Keep the information your process requires without spreading the confidential payload into new tickets or logs. Record which boundaries failed, which copies you cleaned up and which deletion limits remain.
If confidential material reached fine-tuning data, runtime authorization can't remove it. Handle the affected dataset and model through the responsible owner's procedures. As the guidance says, dataset hygiene belongs before trainingOpens in a new tab, not after deployment.