thehackernews.com via Hacker News

Apiiro: Claude Code 'Don't Ask Again' Leaks Keys in 1,122 Repos

7 sources tracking this story

TL;DR

  • Among 16 reviewed AI coding agents, Claude Code alone saves full approved commands, embedded credentials included, to a project-level file by default.
  • 215 secrets evaded both Trufflehog and GitHub Secret Scanning because inline command passwords in PGPASSWORD and sshpass variables fall outside standard scanner patterns.
  • The protection Claude Code adds is a machine-local git exclude, not a committed .gitignore, so it disappears on forks, clones, and copies outside the original repo.

Passwords and API keys developers typed into commands they approved inside Claude Code are sitting in public GitHub repositories, according to a report from software security company Apiiro covered by The Hacker News. When a user picks "Yes, and don't ask again," Anthropic's AI coding assistant can save the command, word-for-word including the secret, into a project settings file at `.claude/settings.local.json` — a path that is not gitignored by default.

Apiiro says it scanned 104,185 public copies of that file across 103,617 repositories. About 1.1% of them, or 1,122 copies, hold at least one secret. Together they hold 1,379 different secrets. The company did not test whether any still work.

The breakdown is specific: 379 database passwords, 43 SSH logins for public servers, 42 tokens for GitHub, GitLab and npm, and 23 AWS keys. Half of the affected repositories kept the file on their default branch for at least 217 days. Another 734 secrets turned up in older file versions across 509 repositories, deleted from the current tree but still readable in history, and 211 forks carried identical secrets copied from the original. Sixty-three organizations, mostly software companies, are affected. Apiiro notes that gitleaks flagged 564 of the files and TruffleHog detected 643; neither caught 215 of them.

The researchers compared documentation for 16 coding agents. "Claude Code is the only one confirmed to save the full approved command in a project file by default," the report says. That matters because the convenience toggle is the kind of thing a developer clicks once and forgets; the secret then ships to origin with the next commit.

Apiiro also says Anthropic's security intake has been quiet. "As of today, the four related reports the researchers cite have all been closed by the same bot, the most recent yesterday. None got a reply from Anthropic, they say." An earlier report from August was closed as "not planned" on January 3, after 60 days without activity. This is the second Claude Code disclosure we've tracked in a week, following a bug report alleging email leakage in the client's User-Agent header.

What others are reporting

Coverage cluster as of 24h after publish

  1. iTnews Read →

    Skeptical take on Anthropic's proposed fixes; adds that Check Point's Lakera found credentials in npm packages in April, and flags Shai-Hulud worm targeting these files on local machines.

    "Yeah good catch," Cherny replied when a reader pointed out the same exposure could occur in auto mode.
  2. ITWire Read →

    Explains why the machine-local git exclude fails: protection doesn't travel with forks or clones; frames the flaw as authorization records retaining secrets by design.

    "A credential used to do the work becomes part of the record that authorises the work next time."
  3. Daily CyberSecurity Read →

    Breaks down exposure by type (398 service tokens, 379 database passwords, 149 AI keys) and documents Anthropic's Claude Code head acknowledging the gap on Hacker News.

    "Pick 'Yes, and don't ask again' and it saves that exact command, secret included, to .claude/settings.local.json"
  4. Security Arsenal Read →

    Practitioner guide with SIGMA rules, KQL for Sentinel/Defender, Velociraptor VQL artifact, and a Bash remediation script — goes well beyond incident announcement.

    "Claude Code saves that command string to a project-level settings file so it can auto-approve the same command in future sessions."
  5. ByteIota Read →

    Only source to benchmark Claude Code against 16 peers, finding it the sole agent to store full command strings in project files; extends the warning to Cursor and Continue users.

    "Of the 16 AI coding agents reviewed, Claude Code was the only one that saves the full approved command in a project-level file by default."
  6. RuntimeWire Read →

    Frames this as a workflow-design problem: routine agent approvals become credential-storage decisions, with concrete steps to rotate secrets and move to secret-manager variables.

    "Coding agents now write durable permission files inside project folders, so a routine approval becomes a credential-storage decision."