Data Report · RedactSure Research
Chris Sowa · Founder, RedactSure
Published
Last updated
Does Cursor Send Your Code and API Keys to Its Servers?
Cursor's documentation does not say what its agent sends to a model provider. It documents approval prompts for terminal commands and MCP connections and a path block in .cursorignore, so check what the agent can open before you treat a project file as out of reach.

A developer asks the coding agent to fix a database connection error. The agent opens docker-compose.yml, reads the service's POSTGRES_PASSWORD value, and works from it, because the host, the port and the environment block arrive together in the same tool result. The value is in the request before anyone decides whether it should be.
Whether that value travels to a model provider is a separate question from what the file says, and it is the question a security review has to answer in writing. A storage commitment answers what happens after a provider has the data; it does not describe what the request carried. Cursor documents two controls that bear on the path: an approval prompt before a terminal command or an MCP connection runs, and .cursorignore, which blocks the paths it lists from the agent's code access. Each is a rule about an action or a resource. A database password or an API key in an open file is neither, and the consequence is concrete: a value in the context can be repeated in a summary, written into a commit message, or used by an instruction hidden in a file the agent opens next.
Key findings
- For a database password in a project file to stay out of the request, the value would have to be replaced with a consistent token before any model reads it, and the real password released only at the destination a named person approved (What Is Render-Layer Tokenization?).
- It would also require a named person approving each use of the credential and a record of what the model received, which are properties of the run rather than of a setting that decides what is kept afterward (Does Cursor's Privacy Mode Keep API Keys Out of the Model?).
- Cursor's security page does not state what the agent sends to a model provider; it describes approval prompts for terminal commands and MCP connections, and a prompt before a command runs does not change what an open file put in the request (Cursor, Security, 2026).
- Cursor's ignore page blocks "Code accessible by Agent, Tab, and Inline Edit" for the paths listed in .cursorignore, and says the terminal and MCP tools "cannot block access to code governed by .cursorignore" (Cursor, Ignore files, 2026).
- DAPLab's incident list records that "Cursor's agent deleted PocketOS's production database via a single rogue API call", an action an approval prompt can catch and a reading cannot (DAPLab, 2026).
- The IETF's OAuth guidance treats storage and transfer as two duties, telling a resource server not to "store or transfer them in plaintext", so a retention commitment is not a statement about what crosses the network (IETF, 2025).
What does the agent read when it opens a docker-compose file?
A service will not start because the database host is wrong. The agent opens docker-compose.yml, finds the service whose host is misconfigured, and the tool returns the file to the model. The model needs the host, the port and the environment block to find the error, so POSTGRES_PASSWORD arrives with the part the task needs. Nothing in the step is an attack. The value is in the context because the file is, and the file was opened by an agent doing what it was asked.
A governed browser environment covers what an agent reads and does on a rendered page, and it does not cover the terminal, the IDE, the local filesystem, direct API calls or MCP. A compose file is read through the editor's tools, so the control that applies is a project rule rather than a page control, and the project rule Cursor documents is .cursorignore. Cursor says files in .gitignore and a default list that includes .env* are "automatically ignored", without saying which features that covers (Cursor, Ignore files, 2026). An ignored file is not a blocked one, and the page does not say which features ignore it. The distinction matters in a review: .cursorignore is the block the page describes, and the default list is an exclusion whose coverage the page leaves open.
The failure is ordinary rather than exotic. AgentDAM's authors report that web agents "are prone to inadvertent use of unnecessary sensitive information" (Zharmagambetov et al., 2025), and an agent that reads a whole compose file to fix one host is a small case of it: it uses the host and receives the password. The same password displayed on a hosting dashboard's connection settings page puts the question where a page control can reach it (What Happens When an AI Agent Can See API Keys in a Console or Settings Page?). One value, two places it can appear: a file a project rule can cover, and a page no project rule reaches.
What does Cursor's documentation say the model receives?
The security page answers a different question. It sets approval defaults for terminal commands and MCP connections, warns that "AI can behave unexpectedly due to prompt injection, hallucinations, and other issues" (Cursor, Security, 2026), and describes run modes that it calls best-effort guardrails. None of those sentences describes what leaves the machine for a model provider, and the page does not say how credentials are stored or protected. A reader looking for the transmission statement finds cautions about the agent's judgment instead.
A page that answered the title would name three things: what is sent (file contents, command output, conversation history), where it goes (a model provider and its subprocessors), and what is kept afterward. None of the three appears in the pages reviewed. The title's phrase, "its servers", covers the same gap: neither page reviewed names an endpoint, a provider or a retention period for the request. That is an absence worth stating plainly, because a team cannot sign off on a sentence it has not read.
A scope sentence decides coverage, which is why it deserves a close read. The PCI Council's FAQ 1588 says its SAQ A criterion "only applies to e-commerce merchants with a webpage that includes a TPSP's/payment processor's embedded payment page/form" and not to a merchant whose page redirects the customer to the processor (PCI Security Standards Council, 2025). The line marks where the control stops, and a merchant reads it before deciding which questionnaire applies. Cursor's approval and path sentences work the same way. They name a command and a path, and a request is neither, so the coverage they describe does not reach what the request carries.
What do the vendors themselves say?
Cursor sets the default plainly: "By default, terminal commands need your approval" and "All MCP connections need your approval", two gates on an action rather than on what a file read returns (Cursor, Security, 2026). The same page calls its run modes "best-effort guardrails rather than a hard security boundary" and does not say how credentials are stored or protected (Cursor, Security, 2026). Both are limits of where the control sits: an approval prompt and a run mode govern what the agent does, and the title asks what it sends.
The other documented pattern is older. OpenBSD's manual page describes ssh-agent as "a program to hold private keys used for public key authentication" and says that under forwarding "Authentication passphrases and private keys never go over the network", so the key stays in a process and a signature travels instead (OpenBSD, 2026). The same page warns that the agent's socket "is easily abused by root or another instance of the same user", which makes the holder a boundary with its own limits rather than a guarantee.
| Dimension | Cursor, per its documentation | What a buyer should verify |
|---|---|---|
| Action approval | "By default, terminal commands need your approval" and "All MCP connections need your approval" | Which tools the approval covers, and whether a file read is one |
| File paths | A .cursorignore entry blocks "Code accessible by Agent, Tab, and Inline Edit" | Whether every path that holds a credential is listed, and who maintains the list |
| Default exclusions | Files in .gitignore and a default list that includes .env* are "automatically ignored" | Which features that exclusion covers; the page does not say |
| Run modes | "best-effort guardrails rather than a hard security boundary" | Whether a team enforces a mode or each developer sets one |
| Storage and protection | The page does not say how credentials are stored or protected | How Cursor stores them, and what the provider keeps |
| Transmission | No statement on the pages reviewed about what the request carries | What is sent, to which provider, under which terms |
Which control acts before the model reads the request?
Two controls in Cursor's pages act before a request is assembled, and each covers a different unit. An approval prompt acts on a command or an MCP connection: it decides whether the action runs. .cursorignore acts on a path: it decides whether the agent's code tools can open a file. The first is a rule for a person at a keyboard, and the second is a standing rule for a project. A request is assembled from what the tools return, which is why neither unit matches the one the title asks about.
The automation-bias literature describes "the tendency to over-rely on automation" (Goddard et al., 2012), and a named setting is where that tendency lands. A team reads an approval default as a boundary around the run, when the page describes a boundary around one command, and it reads an ignore list as a boundary around the data, when the page describes a list of paths. The gap follows from where each control sits. It appears when a control is asked to answer a question its scope does not cover.
A record of the run is the check that would settle what the model read. The pages describe approvals; they do not describe an exported record of the content a model read. An agent's work is auditable at the screen only when the values it read were replaced first (Does Cursor Keep an Audit Log of What the Agent Did?). A codebase that contains customer data is the case a path rule is written for, and the rule stops at the repository rather than at the request (How Do You Use Cursor on a Codebase That Contains Customer Data?). The file rule can be complete for the paths it names and still leave the request to whatever the model does with what it was given.
Can the agent use a password it never reads?
Yes, with a control that holds the value outside the agent's reach, and the pattern is older than coding agents. A key stays in a process that signs with it, and a signature travels instead of the key. For a deployment credential, the same split is a build step that produces an artifact and a deploy step outside the agent that holds the key (How Do I Let a Coding Agent Deploy Without Giving It Deployment Credentials?). The agent's work ends at the artifact, and the credential belongs to a step it cannot reach.
A destination allowlist is the second control on the same path. Limiting where an agent can send data narrows where a request may go without changing what the request carries (How Do I Limit Where an AI Agent Can Send Data?). That is useful against a value leaving for the wrong host, and it is silent on a value that leaves for the right host with a password inside it. The two controls answer different questions: one asks who may receive, the other asks what is in the payload.
Each pattern has a limit worth stating. A holder is a boundary with its own access rules, and the OpenBSD page shows how much care that boundary needs. A destination list is a rule about the route, and it leaves the content alone. A team that needs the password out of the request has to replace the value before the model reads it, or accept that an open file is the request.
What does a governed environment change?
A governed environment is a control class, not a setting: values chosen by policy are replaced with consistent tokens on the rendered page before any model reads it, and the real values resolve only at the approved destination, at the moment a named person approves the action. The model receives tokens in place of the values, so a prompt injection collects a placeholder rather than the password. A token is consistent for the whole run, so the agent can follow the same record across screens without ever holding the value, and the real value resolves at the destination the policy names, at the moment of an approved action. Every screen as tokens, every action and every approval land in an exported record, which is what makes the control checkable afterward: a person can read what the model received, what the agent did and who approved each action, without the real values in the export.
The control has a scope, and the scope is the point. It acts on what is rendered, not on stored data, network traffic or the prompt itself. It covers the pages an application renders in the governed environment, which means supported workflows rather than universal coverage, and it does not cover the terminal, the IDE, the local filesystem, direct API calls or MCP.
The comparison page for Cursor sets the two designs side by side (RedactSure vs Cursor: 2026 Comparison & Alternative).
What the record shows
What a model receives is decided before any approval prompt appears: the request carries whatever the agent's tools returned, including the value in an open file. Cursor's documentation does not say what its agent sends to a model provider, and the controls it does describe act on a command and a path, not on the request. The exposure is testable, and a developer can check it without sending anything anywhere: create a dummy docker-compose file with a fake database password, ask the agent to diagnose a connection error, and read the summary it writes at the end. If the fake value appears in that summary, the value was in the context the model worked from, and no approval prompt or ignore entry changed that.
Methodology and limitations
This page rests on the public documentation for Cursor's agent security page and its ignore-files page, a manual page for OpenBSD's ssh-agent, a privacy-leakage benchmark for web agents, a systematic review of automation bias, an OAuth security best practice, a PCI Council FAQ and a position paper that records an agent incident. Public documentation read in full gives a sound view of where each product applies its control. Vendor pages were read between October 20, 2026 and October 22, 2026, and each Sources line carries the date for its page.
No product on this page was tested for this page. The statements are what the vendors' own pages say and what the cited research records, and the absence of a sentence is reported as an absence rather than as a capability a product does not have. The example describes a record type, not an organization. Cursor's features change, and the page carries its date. RedactSure is deploying now with enterprise and government customers. Determinations belong to the organization's counsel, its assessors and its own security and compliance officers, and nothing here replaces a pilot of one workflow on the organization's own screens.
Frequently asked questions
Does Cursor send my code and API keys to its servers?
Not from the pages reviewed. Cursor's security page sets approval defaults for terminal commands and MCP connections, and its ignore page blocks listed paths from the agent's code access, but neither page states what the request carries to a model provider. The security page also does not say how credentials are stored or protected. A team that needs the answer in writing has to ask the vendor for the request path. Until then, treat any file the agent can open as part of what the model works from.
Does a .cursorignore entry keep a password out of the model?
Yes, for the paths it lists, with the limits the page states. Cursor blocks "Code accessible by Agent, Tab, and Inline Edit" for those paths, so a listed file is not returned to the model's tools. The same page says the terminal and MCP tools "cannot block access to code governed by .cursorignore" and that blocking "isn't guaranteed due to LLM unpredictability". The rule covers the paths someone wrote down, which is why the list is worth reviewing before a run, not after one.
Which setting removes a password before the model reads it?
None of the pages reviewed describes one. The documented controls decide whether a command runs and which paths the code tools may open. They do not say that a value is replaced or withheld inside a file that is already open. Approval is a gate before an action, and a path block is a gate before a file read, and a value that passes either gate is the value the model works from. Ask the vendor for the request path in writing.
What record shows what the model received?
Only an exported record of the run would show it, and the pages reviewed describe approvals rather than such a record. Cursor documents the prompts a person answers and the paths it blocks. It does not describe an exported log of the content a model read. Without that, a record can show that a command ran, not what the command or the file carried into the request. That is the gap a screen-level record closes.
Who approves what the agent sends?
The person at the prompt approves a command or an MCP connection, and no page reviewed describes an approval for a file read. An approval answers whether an action runs. It does not change what the tool returned to the model before the prompt appeared. For a database password, the person who can stop the run is not the person who decides whether the value was in the request. That decision belongs to whatever replaces the value before the model reads it, or to nobody.
Can the agent use a password it never holds?
Yes, when something outside the agent holds the value and releases it at the point of use. A signing process can hold a key and sign with it without handing the key over, and a deploy step can hold a credential the build phase never receives. Both move the value out of reach and need an owner to scope what the holder will do. Cursor's pages describe neither pattern. They document an approval prompt and a path block, which govern the action and the file rather than the value.
How RedactSure Keeps a Database Password Out of the Request
A database password in a project file is read before any page renders, and the controls reviewed here gate commands and paths, not what the request itself carries.
The environment that enforces this is built by RedactSure, an AI agent controls, governance and data protection company.
On the hosting dashboard's connection settings page, the model used to receive the database password as the page printed it. Inside the governed environment the field renders as DB_PASS_001 for the whole task, and the real password resolves only at the connection a named person approved. For each task, RedactSure's Policy Planner proposes what the agent may see and what it may do.
RedactSure is deploying now with enterprise and government customers. Cursor's own page calls its run modes "best-effort guardrails rather than a hard security boundary" (Cursor, Security, 2026).
Everyone else controls where data can go. RedactSure controls what the AI can see.
See it on your own workflow
A password on a settings page stays in the model's context for the rest of the run. Bring one file and one page from your workflow and see, with test values, what the model reads and where the real value lands. Book a demo