Claude Code & coding agents

SecurityPassDetector explained: which passwords and API keys are sitting in your AI history?

Claude Code and Codex keep every conversation as plain text on your disk, including every .env file the agent read. SecurityPassDetector searches it for passwords and API keys. Explained for beginners, with real tests and what the program misses.

Erik van de Blaak
Erik van de Blaak
22 min read • 20 views
SecurityPassDetector explained: which passwords and API keys are sitting in your AI history?

Say the database behind your web shop is unreachable and you ask Claude Code to take a look. The agent reads your .env, sees that the host name is wrong and fixes it. Two minutes of work. What you don't see afterwards: the whole conversation is now a text file on your disk, with the contents of that .env in it. The database password, the key for your payment provider, everything the agent got to read.

The agent is doing nothing wrong here. Without that file it cannot resume a conversation. But hardly anyone ever looks in that folder, so hardly anyone knows what is in it. SecurityPassDetector does the looking for you. It searches the history of Claude Code and OpenAI Codex for passwords, API keys and personal data, and tells you for each hit where it is and what to do about it.

This article is for people who have never revoked an API key. First the terms, then installing and the first scan, then how to read a finding. Further down is what the program misses. In my own test it left four out of five made-up passwords on the table, and that belongs in an honest write-up.

SecurityPassDetector is my own program, free and open source (Apache-2.0). All output in this article comes from tests on 27 November 2026 with version 0.1.0 of the command line tool on Windows 11. I only scanned made-up test data: the demo data the program creates itself and two small text files of my own, in an isolated test folder. My real history was not involved. I did not re-test the desktop app or the installers for this article. What I write about them comes from the documentation in the repository, and the screenshots come from the app's demo mode. This article was written with help from Claude Code.

Short answer. Claude Code and Codex keep every conversation as plain text on your computer, including everything a tool read along the way. SecurityPassDetector searches that with 98 rules for secrets and personal data and points to every hit down to the line and the column. It only reads, changes nothing, has no network connection and never stores the secret itself. If you find a real key, revoke it at the provider first. Deleting the file does not make a leaked key invalid.

What is SecurityPassDetector?

SecurityPassDetector (SPD for short) is a local program that searches the session history of the AI coding agents Claude Code and OpenAI Codex for passwords, API keys, private keys and personal data such as a Dutch citizen service number (BSN) or an IBAN. It consists of a desktop app and a command line tool, spd. Version 0.1.0 was released on 27 November 2026 for Windows (64-bit). There is no account, no cloud and no telemetry.

You can download it from the SecurityPassDetector download page. The source code is on GitHub.

The overview page of SecurityPassDetector in demo mode, with made-up data and the interface set to Dutch: a security posture of 3 out of 100, 21 findings of which 17 critical, and a list of the biggest risks, including a database password and a GitHub token. All values are masked with asterisks. The bottom left corner reads 'local only, no network'.

Three terms you need

What is an API key?

An API key is a long string of characters that a program uses to identify itself to a service. It is a password for software. Your web shop uses one to create payments at the payment provider, your script uses one to call an AI model. The service does not ask who you are. Whoever sends the key gets served, and the bill goes to the owner of the key.

A leaked key therefore means someone else using your pass. With an Anthropic or OpenAI key, another person can call models at your expense. A GitHub token gives access to your repositories. A database password gives access to your customer data. The first costs money and the second your source code. With the third you have to work out whether it is a data breach you must report.

What is the session history of an AI agent?

A session history is the log an AI coding agent keeps of every conversation, on your own computer. One conversation is one file, a transcript. It holds every question you typed, every answer from the model, every command the agent ran and the full output of that command. The agent needs the file to continue a conversation later.

The word that matters is full. If the agent runs cat .env, the whole .env is in the transcript. If you paste an error message with a password in it, that is in there too. The Claude Code documentation is plain about it: transcripts and prompt history are not encrypted at rest, your operating system's file permissions are the only protection, and if a tool reads a .env file, that value is written to the transcript.

What does "local and read-only" mean?

Local means the program runs on your own computer and sends nothing out. SecurityPassDetector contains no network code: it does not look for updates and does not check a found key with the provider either. That last part is a deliberate choice, because such a check means sending the secret across the internet.

Read-only means it opens your files for reading and never changes or deletes them. I measured that: the SHA-256 hash of all twelve files in the test folder was the same before and after a full scan. Cleaning up is your job, and that is how it should be. You don't want a program that starts cutting into your history unasked.

Where is that history, and what is in it?

Claude Code keeps everything in the .claude folder in your home directory, on Windows %USERPROFILE%\.claude. Codex uses .codex. They are ordinary folders with ordinary text files.

PlaceWhat is in itHow long
.claude/projects/…/<session>.jsonlThe transcript: messages, tool calls and tool output. Also the transcripts of subagents.30 days by default
.claude/history.jsonlEvery prompt you typedUntil you delete it yourself
.claude/paste-cache/Large chunks of text you pasted30 days by default
.claude/file-history/Copies of files from before Claude changed them30 days by default
.codex/sessions/ and archived_sessions/Codex's sessions ("rollouts"), older ones compressed as .zstNot checked by me
.codex/history.jsonlTyped promptsNot checked by me

The 30 days is the default of Claude Code's cleanupPeriodDays setting. Note the second row: according to the documentation, history.jsonl is not covered by it. A password you typed into a prompt in March is still there in November. The Codex layout comes from Codex's source code and from the research in the SPD repository. I did not look into how long Codex keeps things.

Diagram in three columns. Column 1, how a secret gets in: you type or paste it (user message), a tool reads or runs something such as cat .env (tool output), or the model writes it (assistant output). Column 2, the agent writes everything to your disk: Claude Code in the .claude folder with transcripts, history.jsonl, paste-cache and file-history, and OpenAI Codex in the .codex folder with sessions, archived_sessions and history.jsonl. Everything is plain text and not encrypted. The login files .credentials.json and auth.json are never read. Column 3, SecurityPassDetector reads along: read-only, 98 rules in 9 categories, and it keeps only a masked value, a fingerprint, the location as file, line and column, and severity, confidence and exposure. No network.

SPD always skips two files: Claude Code's .credentials.json and Codex's auth.json. They hold the agent's own login. Every scan would "find" it, and then your own login token ends up in a report. In my test, spd sources list counted ten files in a folder that held twelve. The two missing ones were exactly these.

Installing and the first scan

There are three downloads. The installer (SecurityPassDetector_0.1.0_x64-setup.exe, 4.5 MB) is the normal choice. It installs per user into %LOCALAPPDATA%\SecurityPassDetector, asks for no administrator rights and adds no service, scheduled task or autostart entry. The MSI is meant for managed workplaces and does need administrator rights. According to the documentation it was built but not install-tested, so I would leave that one alone for now. The third download is the standalone command line tool, spd-0.1.0-windows-x64.exe, which works without installing.

Step 1: check what you downloaded

Version 0.1.0 is not digitally signed. A certificate through the SignPath Foundation has been applied for and not yet granted. Windows SmartScreen may therefore warn that the program is unknown. That warning is fair: Windows cannot tell who the file comes from. What you can check yourself is whether the file is unchanged. Calculate the hash in PowerShell:

Get-FileHash .\SecurityPassDetector_0.1.0_x64-setup.exe -Algorithm SHA256

Compare the result with the line in SHA256SUMS.txt that comes with the release. For the installer it starts with 27f51480 and ends in 4a95126f, for the standalone spd tool it starts with 86e01fe6 and ends in 682b945b. If the hash does not match, do not install.

Step 2: look around with demo data first

On first start the app walks you through seven steps: what the program does, the privacy promise, which AI sources it finds, what may be scanned, your scan preferences, the first scan and the result. Choose Explore with demo data in that wizard if you want to see what it looks like first. Demo mode uses made-up data in a separate database and does not read your real history. A DEMO badge is shown while it is on.

The command line works the same way. Below, the program is called spd; I renamed the downloaded file to spd.exe for that. This command creates a folder with fake Claude Code and Codex history:

spd demo C:\temp\spd-demo

The program then prints three environment variables for you to set in PowerShell, so that it looks at the demo folder instead of your real profile:

$env:CLAUDE_CONFIG_DIR='C:\temp\spd-demo\claude'
$env:CODEX_HOME='C:\temp\spd-demo\codex'
$env:SPD_HOME='C:\temp\spd-demo\spd-data'

Step 3: see what is there, then scan

spd sources list shows which history is on the computer. For that it reads only file names, sizes and dates, no contents yet. In my test folder it printed this (the path is shortened):

Claude Code  found  …\demo\claude
  from CLAUDE_CONFIG_DIR
  7 files · 4.8 KB · 3 sessions · last change 2026-11-27T18:11:30Z
    claude.projects             3 files     4.3 KB
    claude.history              1 files      391 B
    claude.paste-cache          1 files       46 B
    claude.file-history         1 files       54 B
    claude.shell                1 files       36 B

OpenAI Codex  found  …\demo\codex
  from CODEX_HOME
  3 files · 1.9 KB · 2 sessions · last change 2026-11-27T18:11:30Z
    codex.sessions              1 files     1.5 KB
    codex.archived              1 files      309 B
    codex.history               1 files      117 B

Credential stores (.credentials.json, auth.json) are never read.

Then the scan itself. spd scan without options does a full scan of both agents. These are seven of the twenty-six lines from the real output, with the header and the summary:

SecurityPassDetector · local, read-only · nothing leaves this machine
Scanned 10 files (6.8 KB, 27 records) in 0.08s

CRITICAL  94 GitHub token                       ghp_****************g8n0     user message
CRITICAL  84 OpenAI API key                     sk-proj-****************Re2z user message
CRITICAL  82 AWS access key ID                  AKIA************AGNU         tool output
HIGH      65 Burgerservicenummer (BSN)          *********                    user message
HIGH      55 JSON Web Token                     eyJhbGciOi****************l… assistant output
MEDIUM    51 IBAN                               NL91**********4300           user message
LOW       25 E-mail address                     ja****************.org       user message

26 findings (14 unique secrets) · 17 critical, 5 high, 1 medium, 2 low, 1 info · posture 3/100
Nothing was modified. Rotate real credentials first — editing a transcript does not revoke them.

In the real output each line is followed by the file with line and column, and an id. I left those out here, along with a notice about one incomplete record that comes back further down. The number after the severity is the risk score. "26 findings (14 unique secrets)" means that fourteen different secrets sit in twenty-six places between them. One reason is that Claude Code puts the output of a tool twice into the same line of the transcript. Anyone who wants to clean the file by hand needs both spots.

When you are done looking, remove the three variables again (close the PowerShell window) and run spd scan on your real history. A full scan the first time. After that spd scan --quick is enough, because it only reads files that changed since the previous scan.

Reading a finding: severity, confidence and exposure

A finding has three properties that SPD deliberately keeps apart. spd findings show with the id shows all three. For the GitHub token from the demo data (shortened, without the advice that follows it):

CRITICAL GitHub token
  ghp_****************g8n0

  What             GitHub token (authentication, 40 characters)
  Rule             github-token (builtin:authentication.toml)
  Confidence       95/100 (very high)
  Exposure         Tool output exposure — found in tool output
  Risk             92/100 (Critical)
                      +68  Base impact: Critical (GitHub token)
                       +6  Detection confidence 95/100
                       +6  Tool output that was fed into the model context
                       +6  Same secret found 4 times
                       +2  Appears in 2 sessions
                       +4  Exposed to more than one AI agent
  Fingerprint      30850f4370aa91da

Occurrences (4)
  …\claude\projects\C--Work-demo-shop\0d7c1a52-….jsonl:3:268  tool output
  …\claude\projects\C--Work-demo-shop\0d7c1a52-….jsonl:3:684  tool output
  …\claude\projects\C--Work-demo-shop\0d7c1a52-….jsonl:4:284  tool call
  …\codex\archived_sessions\rollout-….jsonl.zst (zstd) line 2 col 52  user message

Severity says how much damage this kind of secret can do. It depends on the type: a GitHub token is critical, an e-mail address is low. Confidence says how sure the detection is. A token with a fixed prefix such as ghp_ scores 95, a password in an ordinary sentence 65. Exposure says how the value got into the conversation.

OriginWhat it means
User messageYou typed or pasted it. It was part of your request to the model.
Tool outputA tool read it, for example from a .env file, and the output went to the model.
Assistant output or tool callThe model wrote it. It may be an invented example, but it is often copied from the rest of the conversation.
File snapshot or cacheFound only in a local file.

I find that third property the most useful one, because it changes what you have to do. The JSON Web Token from the scan above has severity high, but the model had written it itself. SPD takes 8 points off for that ("Written by the AI: may be an invented example") and arrives at a risk score of 55, level medium. For the GitHub token the points go the other way: four locations, two sessions, two different agents.

The score itself is a sum you can check: 68 + 6 + 6 + 6 + 2 + 4 = 92. It is not a probability. The documentation calls it a transparent heuristic, and that is how to use it: to decide where to start.

The detail panel of a single finding in the desktop app, in demo mode with made-up data and the interface set to Dutch. At the top the masked value ghp_ followed by asterisks and g8n0, with a note that the full value is never stored, shown or copied. Below it the type (GitHub token), the exposure (possibly sent to AI), the rule that made the detection, the confidence of 95 percent and the build-up of the risk score of 94.

Why you never get to see the secret itself

Everywhere it says ghp_****************g8n0 and nowhere the whole token. For each hit SPD keeps a masked value and a fingerprint. That fingerprint is a code calculated from the secret with a key that exists only on your computer. The same secret twice gives the same fingerprint. That is how SPD knows that the token in the Claude transcript is the same one as in the Codex archive, without keeping the token.

This is necessary because otherwise the scanner becomes the leak. A report with all your passwords in readable form is worse than the scattered transcripts it started from. I checked it with the demo data: a script took eight complete fake secrets from the source files and searched for them in SPD's database, in the key file, in the HTML and JSON reports and in a redacted copy. Zero hits in all five. The built-in spd selftest does the same check with its own test values.

You found a real key. Now what?

Revoke first, clean up afterwards

Rotating means creating a new key at the provider and declaring the old one invalid. That is step one, and deleting the file is no substitute. The key is valid because the provider accepts it. Your transcript is only one of the places where it is written down. Throw the transcript away and the provider accepts the key exactly as before.

There is a second reason. What is in a transcript was very likely already sent to the AI provider as part of the conversation. So you can no longer say the secret only ever sat on your own disk. GitHub gives the same advice for repositories in its guide on sensitive data: revoke or rotate a leaked secret first, and only then start cleaning up the history.

SPD gives a short list per type. For the GitHub token: revoke it under Settings → Developer settings, create a new token with fewer rights if you still need one, and check the security log for activity with the token. For a database password it adds the question whether the database can be reached from the internet.

Then: record it and clean up

Record what you did, or a month from now you will be working out all over again whether that one key had been rotated:

spd findings status 30850f4370aa91da rotated --note "revoked on github.com"

The status applies to every location of that secret at once. In my test the token's risk score then dropped from 92 to 18, because a handled secret still counts for a fifth.

For the clean-up itself you have three options, from light to heavy.

  • Keep less. Set cleanupPeriodDays in Claude Code's settings lower than the default of 30. The minimum is 1. Do not forget history.jsonl: that file is outside this clean-up.
  • Delete a project. claude purge removes the transcripts of one project and the matching lines from history.jsonl. It first shows what it is going to delete and asks for confirmation.
  • Make a clean copy. If you want to share a transcript, for a bug report for example, spd redact writes a copy in which the found values are replaced. The original stays where it is.

And prevent the next one. In Claude Code's settings you can forbid the agent to read .env files. This example comes from the documentation:

{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)"
    ]
  }
}

What can go wrong

What you seeCauseFixHow to check
No AI agent data found.SPD looks in the default folders. Your history is somewhere else, or the agent was never used under this account.Point to the folder with spd scan --path, or set CLAUDE_CONFIG_DIR correctly.spd doctor shows which folders it uses.
error: output file already existsspd redact never overwrites an existing file.Choose another path for the copy.The message is gone and you see Redacted copy written.
1 file/record issue (partial or malformed records were still scanned as text)A line in a transcript is not valid JSON, for instance because it was cut off.Nothing. The line was scanned as ordinary text.The findings in that file are in the list as usual.
A location in a .zst file that you cannot openCodex compresses older sessions. Line and column refer to the decompressed content.Rotate the secret. You cannot open the spot directly in an editor.The output says (zstd) line … col … instead of :line:column.
A finding that is not a secretDetection is a rule of thumb. An example from a manual looks like a real key.spd exceptions add fingerprint with the fingerprint and a reason.The finding is then no longer in spd findings list.

I tried the last row with the JSON Web Token from the demo data: after the exception the list had thirteen unique secrets instead of fourteen. The summary straight after a new scan still gave the old total of 26 findings. That line counts what the scan came across, not what you have handled.

What SecurityPassDetector does not find

Detecting secrets is pattern matching. A token with a fixed start, such as ghp_ or sk-ant-, is easy. A password is just a word, and it can only be recognised by what surrounds it. To see where the limit is, I made a file of eight lines with made-up values and scanned it.

Line in the fileFound?Why
DB_PASSWORD=Zomer-Kaas-4821xYesKnown name, real value
DB_PASSWORD=$DB_PASSNo, correctlyA reference to a variable, not a password
DB_PASSWORD=$ecretKaas4821No, missedStarts with $ and is therefore taken for a variable
API_KEY=your-api-key-hereNo, correctlyA fill-in example
A password in base64No, missedEncoded values are not unpacked
Het wachtwoord van de testserver is Herfst-Soep-9154kNo, missedThere are words between "wachtwoord" (password) and "is"
The password for the test server is Lente-Vla-2267mNo, missedThe same, in English
password: "changeme"No, correctlyA well-known placeholder

Five of the eight lines contain a real password. SPD found one. Three times it was right to say nothing. The misses with $ and base64 are in the list of known limitations. The two sentences were new to me. With "The password is Lente-Vla-2267m" it did work. So the rule expects "is" to follow the word password directly, and people do not always talk like that. That limitation was not in the documentation yet. After this test the rule was changed: in the source code on GitHub SPD now finds both sentences, and the limitations with $, base64 and sentences are now documented. That goes into the next version.

It also says something about the numbers in the documentation. They give a precision and recall of 1.000 on 160 test cases. That is correct, I ran spd selftest --quality and got the same table. But those test cases were written together with the rules, and the documentation itself adds that it is a guard against regressions and not a statement about practice. My eight lines show why that caveat is there. A clean scan means "nothing recognised". It does not mean there is nothing.

Also good to know:

  • SPD looks after the fact. It sees what has already been stored and stops nothing. The live monitor in the app is a file watcher too, scanning after the write.
  • A hit does not prove that a key still works. That is deliberately not checked online.
  • Only Claude Code and Codex are understood. The folders of Cursor, Gemini CLI, Copilot and other agents can be scanned as ordinary folders, but without origin labels.
  • There is a version for Windows and one for Linux. The Linux version was tested on Ubuntu 24.04, the base of Linux Mint 22, but not yet on a real Mint desktop.
  • File paths and project names are stored readably in SPD's database and in reports. Those can be confidential themselves.

SecurityPassDetector or AgentShield?

They do different work and complement each other. AgentShield watches while Claude Code is working. It plugs into Claude Code's hooks and can stop an action before it runs, such as reading a .env file. SecurityPassDetector comes afterwards and looks for what is already on your disk, including the months before you had AgentShield, and including Codex.

For the code in your repository you need a third kind of tool. Scanners such as Gitleaks look for secrets in Git repositories and files. You can point them at the .claude folder as well, but to such a scanner a transcript is ordinary text. Who typed something and which tool read something is not in there for it. For SPD that distinction is the starting point.

Frequently asked questions

Does SecurityPassDetector send my passwords anywhere?

No. The program contains no network code: no account, no telemetry, no update check and no online validation of keys. Its own database holds only masked values, fingerprints, file paths and your own notes. spd purge --yes deletes that data. Your source files stay where they are.

Is an API key safe again once I delete the transcript?

No. The key stays valid until you revoke or rotate it at the provider, and the contents of the transcript were probably already sent to the AI provider. Rotate first, clean up afterwards.

How long does Claude Code keep my conversations?

Transcripts are deleted after 30 days by default. You control that with cleanupPeriodDays, with a minimum of 1 day. The history.jsonl file with your typed prompts stays until you delete it yourself. This is in the Claude Code documentation, accessed on 27 November 2026.

Does SecurityPassDetector find every secret?

No. It searches with 98 rules, from API keys to Dutch citizen service numbers, and misses secrets without a recognisable form or context. In my eight-line test it found one of the five made-up passwords. Use it to find what can be found, and do not assume the rest is clean.

Does it run on Linux or macOS?

Version 0.1.0 of 27 November 2026 is available for Windows (64-bit) and Linux (amd64): a .deb package and an AppImage with the desktop app, and the command-line version as a tar.gz. The Linux version was tested on Ubuntu 24.04, the base of Linux Mint 22, not yet on a real Mint desktop. macOS is planned for later.

Further reading on this site

Sources

SecurityPassDetector (own project, source code and documentation)

External sources (accessed 27 November 2026)

Own tests

  • 27 November 2026, Windows 11, spd 0.1.0 (SHA-256 86e01fe6…682b945b), rule set 2026.11.1. All tests in an isolated folder with SPD_HOME, CLAUDE_CONFIG_DIR and CODEX_HOME, on the demo data from spd demo (twelve files) and two files of my own with made-up passwords. Run: doctor, sources list, scan (full, quick, deep, --path, --fail-on), findings show, findings status, exceptions add, redact, report and selftest --quality. Hash of the source files identical before and after the scan. Eight complete fake values searched for in the database, the key file, two reports and the redacted copy: zero hits. That check did not cover every type of finding, nor the compressed file. Not tested: the desktop app, the installers, SmartScreen, the speed on large histories.

Share this article

Erik van de Blaak

Written by

Erik van de Blaak

AI Solutions Engineer & Full-Stack Developer

Erik van de Blaak is an AI Solutions Engineer and full-stack developer at CareerValue BV. Here he writes about AI coding tools and agents, such as Claude Code.

Comments (0)

Comment on this article

Never published

I read every comment before it goes online.

No comments on this article yet.