Skip to main content

Every AI coding agent writes the secrets you paste straight to a plaintext history file — and nobody scans it

0
Medium
Published: 07/13/2026 (07/13/2026, 17:34:42 UTC)
Source: Reddit Cybersecurity

Description

Many AI coding agents store user inputs, including sensitive secrets like API keys and credentials, in local plaintext history files. These histories are reused as context by the agents, causing secrets to persist indefinitely on disk. There is currently no widespread scanning or auditing of these files for leaked secrets. An open-source tool named agentsweep has been developed to detect and redact secrets from these local history files for multiple AI coding agents, helping to mitigate this exposure risk.

Reddit Discussion

r/cybersecurity·posted by u/Ishannaik
00

Pen-testers and blue-teamers: your devs are pasting API keys, DB URLs, .env contents, and cloud creds into Claude Code / Cursor / Copilot chat all day. Those tools log the conversation to a local plaintext file — and re-read it as context, so the secret keeps resurfacing long after.

I wrote an open-source CLI (agentsweep) that:

- Scans agent history with ~191 detection rules (ported from gitleaks) plus a BIP-39 seed-phrase detector

- Covers ~30 agents (Claude Code, Cursor, Codex, Cline, Aider, Windsurf, and more)

- Redacts in place with atomic writes, .bak backups, post-write validation, and full undo

- Read-only by default; nothing destructive without a typed confirm

Curious how your orgs currently handle secrets leaking into AI-tool history, and whether anyone is auditing it yet.

https://github.com/Ishannaik/agent-sweep/

Links cited in this discussion

Also discussed in: r/cybersecurity

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 09/17/2026, 20:05:44 UTC

Technical Analysis

AI coding assistants such as Claude Code, Cursor, and OpenAI Codex log full conversation histories, including pasted secrets, to local plaintext JSONL files on disk. These secrets accumulate over time and remain accessible indefinitely, creating a new category of credential exposure. This local storage is not currently scanned or audited widely, increasing the risk of secret leakage, especially from supply chain malware that scans developer machines for credentials. The open-source tool agentsweep addresses this by scanning local history files for secrets using ~207 detection rules and BIP-39 seed phrase detection, supporting about 30 AI coding agents. It can redact secrets in place with atomic writes and backups, providing a local, offline remediation method to reduce the attack surface from leaked secrets in AI agent histories.

Potential Impact

Secrets such as API keys, database URLs, environment variables, and cloud credentials pasted into AI coding agents are stored in plaintext on local disk indefinitely. This persistent storage increases the risk of credential leakage through local compromise or supply chain attacks that scan developer machines for secrets. Attackers can exfiltrate multiple secrets from these history files if they gain access. The exposure is compounded by the fact that these secrets are reused as context by the AI agents, causing them to resurface repeatedly. This creates a significant risk of unauthorized access to cloud services, databases, and other sensitive resources if secrets are not rotated or removed.

Defensive Guidance

Currently, there is no official vendor patch or fix for this issue as it stems from design choices in AI coding agents. The recommended mitigation is to avoid pasting secrets into cloud-backed AI agents to prevent them from being sent to provider servers. For secrets already stored locally, use the open-source tool agentsweep to scan and redact secrets from local AI agent history files. agentsweep performs safe, atomic redactions with backups and validation, reducing the risk of secret exposure on disk. Organizations should consider auditing local AI agent histories for secrets and rotating any exposed keys. Using locally hosted AI models that do not send data to cloud providers can also reduce exposure.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Source Type
reddit
Subreddit
cybersecurity
Reddit Score
0
Discussion Level
minimal
Content Source
reddit_link_post
Post Type
link
Newsworthiness Assessment
{"score":27,"reasons":["external_link","established_author","very_recent"],"isNewsworthy":true}
Has External Source
true
Trusted Domain
false

Threat ID: 6a55282f68715ace43999c24

Added to database: 07/13/2026, 18:02:23 UTC

Last enriched: 09/17/2026, 20:05:44 UTC

Last updated: 10/04/2026, 05:55:32 UTC

Views: 156

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses