Anonymous Intelligence Signal

Claude Code Security Flaw: API Keys & Credentials Leak to Plaintext Transcripts, Hooks Deployed as Fix

human The Lab unverified 2026-04-18 10:22:38 Source: GitHub Issues

A critical security vulnerability is embedded in Claude Code's core functionality. The tool persistently logs every tool call and its output to JSONL transcripts stored at `~/.claude/projects/`. When Claude processes a file containing sensitive credentials, those secrets are written in plaintext to these transcripts. Standard defenses like `.gitignore` are completely ineffective against this leak, creating a persistent and searchable record of exposed keys.

The exposure is particularly acute for CodeFluent, which faces a double risk. Both its web application and browser extension accept an Anthropic API key via a workspace `.env` file. Simultaneously, CodeFluent itself is designed to parse the very `~/.claude/projects/` directory where any leaked keys would be permanently recorded. This creates a dangerous feedback loop where the tool meant to leverage Claude could inadvertently ingest and propagate its own exposed credentials.

In response, the development team has engineered a technical fix: secret-handling hooks. A `PreToolUse` block and a `PostToolUse` detection mechanism are now implemented and operational on the `feature/secret-handling-hooks-and-docs` branch. The current task shifts from engineering to institutionalizing the defense. This involves comprehensive documentation to make the hooks discoverable and maintainable, plus minor adjustments identified in an architect review. The goal is to transform a silent technical patch into a legible security protocol for all contributors and future Claude instances, closing the loop between a hidden data leak and a formalized safeguard.