Data Report · RedactSure Research
Chris Sowa · Founder, RedactSure
Published
Last updated
Does Claude Code Keep Credentials Out of Its Session Transcripts?
Only for configured credentials: a sandboxed command sees a sentinel, so the transcript carries the placeholder and not the real value. A credential the agent discovers in a file or command output is recorded as read, so ask which values your team actually declared.

A failing test prints a token. The agent reads the output, finishes the task and moves on. The token does not: it stays in the session record beside the command that produced it, and every later copy of that record carries the value with it. A transcript is a working record rather than a ledger, since it holds what the session handled, including the parts nobody meant to keep. Claude Code's documentation draws a line that decides which values are in it. A credential the team declares can be masked, and a sandboxed command then sees a sentinel in its place, while a value the agent meets in a file or in output was never declared and has no rule to follow. That difference decides which values the transcript keeps, and it is easy to miss because a record that looks clean reads as a record with nothing to find. The record type is a token printed by a failing test, read by the agent and kept by the session. Do Claude Code Transcripts Contain My Credentials? takes the shorter form of the question; the longer answer runs along that declaration line.
Key findings
- A session record is only as clean as the values that reached the model, so the control that changes it is substitution before any model reads a value: consistent tokens in place of the credential, with the real value released only at an approved destination (What Is Render-Layer Tokenization?).
- It would also require a record of what the model received and a named person approving each resolution, neither of which a session transcript supplies on its own (Can a Coding Agent Use a Credential It Cannot Read?).
- The permissions documentation says a Read deny rule blocks the file tools from reading a path, and warns that the rule does not apply to a command that reads files without naming them (Anthropic, Permissions, 2026).
- Claude Code's sandboxing documentation states that sandbox.credentials affects sandboxed Bash commands only and that a masked value appears to the command as a sentinel (Anthropic, Sandboxing, 2026). Because Read, Edit, Write, WebFetch, WebSearch, MCP servers and hooks run outside the sandbox, a file that holds a token is opened by the file tools as stored (Anthropic, Sandboxing, 2026).
- A registry measurement of 98,380 skills found 157 that showed confirmed malicious behavior, with credential theft via remote code execution and agent manipulation through hidden instructions as the two dominant strategies (USENIX Association, 2026).
- Arcade describes a different design in which the runtime holds the credential, makes the call and returns only the result, which keeps a token out of the context window entirely (Arcade, 2026).
What does a Claude Code session record actually hold?
A session record holds the run: the commands the agent ran, the output it read, the files it opened and the messages it exchanged. It is a copy, and a copy outlives the process that made it. That is why the title question is less about whether Claude Code writes a transcript than about which values reach it before the writing happens.
OWASP's entry for sensitive information disclosure warns that personal information may be disclosed during interactions with the LLM, the category a session record creates when it keeps what the model saw (OWASP, 2025). The page calls for data sanitization to keep user data from entering the model, a control on the way in rather than on the record that follows.
The documentation separates two paths. A credential declared under sandbox.credentials can be denied or masked, and a masked value appears to a sandboxed command as a sentinel, so the command writes the sentinel into its output and the record holds a placeholder. A value the agent meets in a file or in output was never declared, no rule names it, and it is held as read.
The two paths look the same in the record afterward. A reviewer sees a line with a value in it and cannot tell whether the value was discovered or simply not declared. Can a Coding Agent Use a Credential It Cannot Read? works through the difference, and Do Claude Code Transcripts Contain My Credentials? puts the shorter version of the question.
| What enters the session | Where it comes from | What the record holds |
|---|---|---|
| A declared credential used by a sandboxed command | A sandbox.credentials rule | The sentinel that command saw |
| A file opened with Read | A path the file tools can reach | The contents as read |
| A token printed by a failing test | Test output | The value as printed, unless the command printed a declared credential's sentinel |
What does the session read when a failing test prints a token?
A test fails and prints a line that begins GITHUB_TOKEN=, and the agent reads the output to decide what broke. The line is in the session because the output was read, not because anyone declared the value. The same route carries a stack trace with a connection string, a debug print with an API key, or a fixture copied from production.
This is the ordinary case, and it is why the declaration line matters. A test is written to show what the code did, and what the code did may include a value from the environment, a response body or a local config. Nothing in the test knows that a model will read its output.
Where mask is set, the sandboxed command sees a sentinel and the local proxy substitutes the real value only on hosts named in injectHosts (Anthropic, Sandboxing, 2026). That covers a declared credential used by a sandboxed command. It does not cover a value the test read from somewhere else and printed, because the proxy has no rule to match.
Two checks sort the case. What Credentials Does a Coding Agent Pick Up When It Runs My Tests? lists the routes a test run opens, and How Do I Keep API Keys Out of Claude Code's Context Window? covers the settings that keep a declared key out of the model's context.
What do the vendors themselves say?
Anthropic's Claude Code pages describe four controls that bear on the record, and each is precise about the part it covers. Read together, they show a control that is exact about the credentials it knows and quiet about the ones it does not.
A denyRead entry does not stop the Read tool, so the path has to be blocked in the file tool's permission rules rather than in the sandbox settings (Anthropic, Sandboxing, 2026). Anthropic's engineering post states that effective sandboxing requires both filesystem and network isolation, and that sandboxing safely reduces permission prompts by 84 percent (Anthropic Engineering, 2025). The first is a boundary on the command path; the second is a usability result, and neither describes what a record keeps.
| Page | What it documents | What it leaves open |
|---|---|---|
| Sandboxing (Anthropic, Sandboxing, 2026) | "sandbox.credentials affects sandboxed Bash commands only"; a masked value appears to the command as a sentinel, and injectHosts names the hosts where the proxy may substitute | A value the agent discovers in command output |
| Configure permissions (Anthropic, Permissions, 2026) | A Read deny rule for a path; a .claudeignore file has no effect; a rule that "doesn't apply to a command that reads files without naming them" | A value a command prints from a file it found |
| Security (Anthropic, Security, 2026) | "GitHub credentials are stored encrypted on Anthropic's servers and never enter the session VM", for Anthropic-hosted cloud sessions | A local session, where the credential sits on the developer's machine |
| Zero data retention (Anthropic, Zero data retention, 2026) | "the prompts you send and the responses Claude generates are not retained by Anthropic" when ZDR applies | The session file written on the machine |
| Arcade (Arcade, 2026) | "Arcade holds the credential, makes the call, and returns only the result." | A command that prints a value the runtime never held |
The vendor's own framing is that keeping tokens out of the context window entirely removes the prize a prompt injection is after (Arcade, 2026). That is a claim about custody, and it holds because the model never receives the value in the first place. It is also the one design in the table that does not depend on a declaration list, because the runtime, not the agent, holds the credential for every call it makes.
The distinction the table draws is between a rule that names a credential and a value that appears in output. A rule can act only on a name it holds, and the pages describe no step that adds a discovered value to that list during a run.
Why is a clean session record not proof?
A clean record can mean three things: the value was masked, the value never passed through the session, or nobody looked at the line that held it. The record alone cannot separate them.
Automation bias, the tendency to over-rely on automation, is why a record that looks clean gets signed off without a second look (Goddard et al., 2012). The same review notes that the tendency has been studied in various academic fields, which makes a clean transcript a weak form of assurance (Goddard et al., 2012).
A second failure sits beside it: a skill or a test prints a value the team never declared. The same study reports that skills bundle natural language instructions and helper scripts that execute with full user privileges, so a skill can print a value the team never declared (USENIX Association, 2026). The measurement behind that finding is a sample rather than a census, and it still shows a channel that no declaration list controls.
A usability result is not a coverage result. The 84 percent figure measures how many permission prompts the sandbox removes, not how many values the session records (Anthropic Engineering, 2025). A team that reads the figure as a data-protection measure is reading it for a job it does not do.
The record can be checked against a declaration list, and the list is the part teams rarely keep. Without it, a reviewer compares a transcript with a memory of what was configured, and the comparison has no fixed point.
What should a team ask for in writing about the record?
The questions that settle the title are specific, and a useful answer names the setting, the file and the version. A general assurance that credentials are protected does not say whether the record holds a sentinel or a value.
Anthropic's zero data retention page states that the prompts you send and the responses Claude generates are not retained by Anthropic when Claude Code runs in the terminal under ZDR, which covers the provider's copy and not the session file on the machine (Anthropic, Zero data retention, 2026). ZDR is not included in the standard Claude for Enterprise plan and cannot be enabled from the admin settings, so a team has to confirm that the retention term is actually in its contract (Anthropic, Zero data retention, 2026).
Ask what the model receives from a rendered screen in each supported application the agent opens, and ask whether that answer covers the same values the session records. On a terminal-only run the record is a file on the machine; on a browser run it is whatever the page showed the model, and the two need different controls.
| Ask in writing | Why it decides the answer |
|---|---|
| Which credentials are declared under sandbox.credentials, and in which settings file? | A value that is not on the list has no masking rule |
| Does the session keep command output as printed? | A test's output is the most common route for a discovered value |
| What does the model receive from a rendered screen in each supported application the agent opens? | The browser route and the terminal route keep different records |
| What is the retention period for the session file, and for the provider's copy? | ZDR covers the provider's copy, not the local file |
| Who approves a consequential use of a value? | Masking changes what is read, not who authorizes the action |
For a declared token, Is It Safe to Give Claude Code My GitHub Token? shows the sentinel and the host list in operation. For a key on disk, Can Claude Code Read My SSH Keys? covers the path rules that decide whether the file tools can open it.
What does a governed environment change?
A governed environment is a control class that acts at the point a page is rendered, before any model reads it. Values chosen by policy are replaced with consistent tokens for the whole run, so the model works on placeholders such as TOKEN_001. Real values resolve only at an approved destination, at the moment of an approved action. A named person confirms the policy and approves each consequential action, and every screen as tokens, every action and every approval is written to a record that exports to the organization's own monitoring.
For this question it changes what a browser session's record holds: a token shown on a settings page reaches the model as TOKEN_001, so the record of that session holds the placeholder. It does not rewrite a terminal transcript, which the harness writes. Its scope is the rendered page, and it does not cover the terminal, the IDE, the local filesystem, direct API calls or MCP, so a token a failing test prints is outside it and stays a matter for the test and the environment.
The two controls are complementary. One acts on what a page shows, and so on the record of the browser work; the other acts on the credentials the configuration names and on the files those rules can reach. The control sits outside the model, so it works with any model the organization chooses, and the model receives tokens in place of the values. RedactSure vs Claude Code: 2026 Comparison & Alternative sets the two side by side for the same token.
| Where the work happens | What the record holds | What changes it |
|---|---|---|
| A rendered page in a bought application | The token the page showed the model | Substitution before any model reads the page |
| A terminal command or a test run | The output the command printed | The test, the environment and the permission rules |
| A file read by the agent | The contents of the file | The file tool's permission rules and the sandbox |
What the record shows
A session record is a copy of what the run handled, and the values in it follow the declaration line. A declared credential used by a sandboxed command arrives as a sentinel, a value discovered in a file or in output arrives as read, and a browser session governed at the render layer arrives as a token. The pages reviewed describe the first mechanism and the custody designs around it, and they do not describe a scan that catches the second. A clean transcript therefore answers a narrower question than a security review needs: it says what the session held, not what the model saw on every screen. To check one setup, pick a token a test prints on purpose, run the agent once, search the session file for the token, compare the result with the list of credentials declared in the settings the tool honors, and repeat after each release.
Methodology and limitations
This page rests on Anthropic's Claude Code documentation for sandboxing, permissions, security and zero data retention, Anthropic's engineering post on sandboxing, Arcade's credential blog, a USENIX Security measurement of agent skills, a systematic review of automation bias and OWASP's entry on sensitive information disclosure, together with existing RedactSure research pages. Vendor pages were read between October 20, 2026 and October 24, 2026, and each Sources line carries the date for its page. Public documentation read in full gives a sound view of where each control applies, and quotations are cited to the page that states them.
No product on this page was tested for this page. "Not described in the pages reviewed" means the pages reviewed and nothing broader, and vendor features change, so the page carries its date. RedactSure is deploying now with enterprise and government customers, and the example describes a record type, a token printed by a failing test, not an organization. Determinations about whether a workflow meets a legal, contractual or regulatory requirement belong to counsel, assessors and the organization's own security and compliance officers. Nothing here replaces a pilot of one workflow on the organization's own screens.
Frequently asked questions
Does Claude Code keep credentials out of the session transcript the model reads?
Only for the credentials a team declares. A masked value appears to a sandboxed command as a sentinel, and the command writes the sentinel, so the record holds the placeholder. A value the agent discovers in a file or in command output was never declared and is recorded as read. The distinction is the whole answer: check the declaration list before you trust the record.
Does masking remove a credential from the session record?
Where a credential is declared under sandbox.credentials and used by a sandboxed command, yes: the command sees a sentinel and the record keeps it. Masking does not reach a value the command prints from a file it found or from a response body, and it does not cover the file tools, which run outside the sandbox. A token in a file the Read tool opens is recorded as read. The check is the declaration list, not the presence of a value.
What does the session record show when a test prints a token?
It shows the line the test printed. If the token is a declared credential used by a sandboxed command, the line carries the sentinel. If the test read the value from a fixture, a response or a config file, the line carries the value. Nothing in the test output marks which case applies, so the reviewer has to compare the line with the declaration list. Record that comparison beside the run.
Can a credential be removed after it lands in the session record?
Treat the value as exposed and rotate it, because a copy that was written cannot be recalled. Find the route that printed it, whether a test, a tool or a file, and close that route. Then remove or restrict the record where policy allows, note who had access and check the provider's logs for use since the run. A deletion is housekeeping, not a fix, and the run's own note belongs with the ticket.
Who approves a credential's use, and what record shows it?
Claude Code's sandboxing pages describe masking and a host list, not an approver for a credential's use. The approval, where one exists, sits in the surrounding workflow: the harness, the CI job or the person who runs the command. Ask who authorizes a consequential action and whether the record shows that name beside the token, because a sentinel alone does not.
What should I ask before I trust a clean session record?
Ask which credentials are declared, where those settings live and whether command output is kept as printed. Ask what the model receives from a rendered screen in each supported application the agent opens, and ask for the retention period of both the session file and the provider's copy. A clean record that cannot be tied to a declaration list is a record with an unknown scope, so get the answer in writing with the version it applies to.
How RedactSure Keeps a Printed Token Out of the Session Record
Masking covers declared credentials, so a token a failing test prints reaches the session as a value nobody planned to record.
The environment that enforces this is built by RedactSure, an AI agent controls, governance and data protection company.
Before: the failing test prints the token, the agent reads it in the output, and the same value sits on the repository's Actions settings page, where the model reads it. Inside: that page renders TOKEN_001 before any model reads it, a named person approves the one workflow change that resolves the real value, and the record shows the token and the approval. The terminal output stays outside that boundary.
RedactSure is deploying now with enterprise and government customers. Anthropic's sandboxing page states that sandbox.credentials affects sandboxed Bash commands only.
Everyone else controls where data can go. RedactSure controls what the AI can see.
See it on your own workflow
A token that a test prints can sit in the session record long after the run. Bring a workflow your agent already runs and see, with test values, what the page shows the model and what the record keeps. Book a demo