How to prevent leaks from Claude Code's 'Don't ask again' file

GitLab published a guide on finding and removing secrets leaked through Claude Code's "Yes, and don't ask again" option, which saves approved shell commands, including any tokens, to .claude/settings.local.json. Claude Code excludes the file via a developer's personal global Git excludes rather than the project's .gitignore, so it is often committed and pushed. In early November 2026, Apiiro found 104,185 copies of the file in public repositories, 1,122 holding at least one secret. GitLab said its own infrastructure secrets are protected.

AI-written summary, checked against the cited sources. How summaries work

Image: GitLab Blog

Read at GitLab Blog