Security alert: Claude Code config commits expose secrets in GitHub repos

Cybersecurity researchers identify over 1,100 public GitHub repositories that inadvertently exposed passwords and API tokens via Claude Code config files.

Security alert: Claude Code config commits expose secrets in GitHub repos
Image: Digital Akhbaar graphic

Cybersecurity researchers have issued an urgent warning to software engineers after discovering more than eleven hundred public GitHub repositories leaking private passwords, cloud credentials, and sensitive API tokens via misplaced Claude Code configuration files.

According to an investigative report published by The Hacker News, developers using terminal-based AI coding assistants frequently commit the tool’s internal state directories—specifically configuration files recording “Don’t Ask Again” permission grants—directly into public git repositories without proper exclusion rules.

How the secret leak happens

The vulnerability stems not from the AI model itself, but from improper git hygiene in software project root directories:

  • Accidental staging: When developers run broad git add . commands, local tool cache and preferences directories containing cached environment variables are tracked.
  • Authentication token harvesting: Automated bot scrapers continuously monitor public GitHub commits, snatching exposed Anthropic, OpenAI, AWS, and database connection strings within seconds of publication.
  • Lack of default gitignore entries: Security analysts pointed out that many starter templates fail to include the CLI tool’s internal configuration folders in global .gitignore files.

Security teams strongly advise all engineers using AI CLI tools to take immediate corrective measures:

  1. Add tool directories to global ignore rules: Ensure .claude/ and related terminal cache folders are placed in your global ~/.gitignore_global.
  2. Rotate all exposed secrets: Invalidate any API tokens, database passwords, or private keys that were ever committed, even if the commit was subsequently deleted.
  3. Use git secret scanners: Implement pre-commit hooks such as Gitleaks or Trufflehog to intercept sensitive strings before commits leave local workstations.

Read next