Nov 22, 2026 · 6 min · Dev Guides

Claude Code's "Don't Ask Again" exposes passwords in 1,122 public G...

Claude Code's "Don't Ask Again" exposes passwords in 1,122 public G...

Claude Code’s “Don’t Ask Again” Exposes Passwords in 1,122 Public GitHub Files

The number that should stop a developer cold is 1,122.

That is the number of public GitHub files reportedly found containing exposed passwords or other credentials after coding agents were used with permissive “Don’t Ask Again” approval settings. The setting appears harmless: it removes repeated approval prompts so an agent can keep working. But in practice, approval persistence can create a dangerous chain:

  1. The agent runs a command that reads a secret.
  2. The secret enters the command output and model context.
  3. The agent copies that value into source code, configuration, logs, or a generated test fixture.
  4. Git stages and publishes it.

The direct mistake is not “using Claude Code.” It is allowing an autonomous workflow to combine secret access, unconstrained transformations, and outbound publication without independent safeguards.

Let’s break down what “Don’t Ask Again” really changes, why 1,122 files are only the visible tip, and how to build coding-agent workflows that remain useful without treating every prompt as a security control.

What “Don’t Ask Again” Actually Removes

In an interactive coding session, tools such as Claude Code need permission before executing shell commands, editing files, or accessing sensitive resources. When a developer selects “Don’t Ask Again”, the agent gains more freedom for the remainder of the session or through a persisted rule, depending on the client and configuration.

That sounds efficient because agents frequently repeat similar operations:

npm test
npm run lint
git status
git diff
pytest -q

But the approval decision applies to a category of behavior, not necessarily to the sensitivity of the result.

Consider this command:

cat .env

If the agent was allowed to read project files without asking, it may run that command to inspect configuration. The output might contain:

DATABASE_URL=postgres://app:SuperSecret123@db.internal:5432/prod
STRIPE_SECRET_KEY=sk_live_51H8xExampleOnly

Those values now exist in at least three places:

A subsequent task could be innocent: “add retry logic to the database client.” A poorly constrained agent might “helpfully” replace the connection string with the real value it just saw:

DATABASE_URL = "postgres://app:SuperSecret123@db.internal:5432/prod"

If that file is later committed, the credential becomes public.

The key lesson is straightforward: command approval is not data-loss prevention. “Don’t Ask Again” answers “May this action run?” It does not answer “Is the output safe to retain, transform, log, and publish?”

Why Passwords Are Especially Dangerous

API keys are easy to recognize because providers can revoke and rotate them. Passwords are messier. A database password may be shared across environments, embedded in internal tooling, or reused by an engineer who has no idea it was published.

Other exposed values can be even more damaging:

A public repository’s security team may not monitor every new file immediately. Automated secret scanners can detect known token formats, but generic passwords often look like ordinary configuration.

That explains why a count of 1,122 public files is better understood as a lower bound than a complete inventory. One exposed credential can appear in dozens of commits, forks, CI logs, container images, and copied snippets. Searching only the latest branch of the default repository will also miss deleted files and historical commits.

The Failure Pattern I See Most Often

The common incident is not an agent deliberately exfiltrating a password. It is a sequence of individually reasonable actions:

Read local environment
    ↓
Include real configuration in generated code
    ↓
Run formatter or test fixture generator
    ↓
Stage broad file patterns
    ↓
Push to a public remote

The dangerous step is usually broad staging:

git add .
git commit -m "add configuration"
git push origin main

git add . does not mean “stage intentional source changes.” It stages whatever the agent created, including:

.env
config/local.py
tests/fixtures/production.json
scripts/debug_output.sh

A safer workflow stages an explicit allowlist:

git add src/payments/client.py tests/payments/test_client.py
git diff --cached --check
git diff --cached

Even then, a staged diff can contain a secret that looks syntactically valid. Review is still required.

Don’t Disable All Guardrails

The opposite response is also bad: approving every command one by one makes agents slow and tempts developers to blindly select the broad permission option.

A practical setup separates permissions by risk.

OperationRecommended handlingReason
Read source and run testsAllow with scoped pathsRoutine and low risk
Read .env, credentials, or SSH keysDeny or require explicit reviewSecret enters context
Install arbitrary packagesReview lockfile and registrySupply-chain risk
Run network-upload commandsReview destination and payloadCan publish sensitive data
git add .Replace with explicit pathsPrevents accidental staging
git push to public remotesAlways inspect staged diffLast boundary before publication
Modify CI/CD workflowsTreat as privilegedWorkflows can access secrets
Rotate or revoke a credentialHuman-only operationAvoids irreversible mistakes

For Claude Code specifically, project-level permission rules should be as narrow as practical. Rather than allowing an unrestricted shell, allow the exact commands needed for the task:

{
  "permissions": {
    "allow": [
      "Bash(npm test)",
      "Bash(npm run lint)",
      "Bash(git status)",
      "Bash(git diff --cached)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./.aws/credentials)",
      "Read(./.ssh/**)",
      "Read(./**/*.pem)",
      "Read(./**/id_rsa*)"
    ]
  }
}

Exact configuration syntax can vary by Claude Code version, so the important principle is to verify the active project and user settings before a session begins. A deny rule that conflicts with a broader allow rule may not behave as expected.

Keep Real Credentials Out of the Agent’s Reach

The strongest control is preventing secrets from entering the context at all.

Use .env.example with placeholders:

DATABASE_URL=postgresql://USER:PASSWORD@localhost:5432/app
STRIPE_SECRET_KEY=sk_test_replace_me

Never copy the real .env into an agent-accessible directory. If a local integration test needs credentials, inject them through an ephemeral process environment or a dedicated secret manager. Ensure the agent only sees variable names when possible:

env | cut -d= -f1 | sort

That output is safe enough for discovering configuration shape:

DATABASE_URL
REDIS_URL
STRIPE_SECRET_KEY

It does not reveal the values.

For cloud or container workloads, use short-lived, least-privilege credentials. A workload identity that expires in an hour is preferable to a static production password committed to a repository for convenience.

Add a Repository-Level Secret Gate

Local discipline should be backed by an automated gate that runs before publication. A simple Python scanner can reject obvious credential assignments:

from pathlib import Path
import re
import sys

PATTERNS = {
    "AWS access key": re.compile(r"\bAKIA[0-9A-Z]{16}\b"),
    "Private key": re.compile(r"-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----"),
    "URL password": re.compile(r"\b[a-z][a-z0-9+.-]*://[^\s:/]+:([^\s@/]+)@", re.I),
    "Generic secret": re.compile(
        r"(?i)\b(?:password|passwd|secret|api[_-]?key|token)\b"
        r"\s*[:=]\s*['\"][^'\"\n]{8,}['\"]"
    ),
}

findings = []

for path in Path(".").rglob("*"):
    if not path.is_file() or ".git" in path.parts:
        continue

    try:
        content = path.read_text(errors="ignore")
    except OSError:
        continue

    for name, pattern in PATTERNS.items():
        if pattern.search(content):
            findings.append((str(path), name))

if findings:
    for path, name in findings:
        print(f"Possible {name}: {path}", file=sys.stderr)
    sys.exit(1)

This is intentionally basic. It catches examples, not every credential, and it may produce false positives. Replace generic checks with provider-specific patterns and make the scanner part of pre-commit and CI controls.

A stronger workflow also scans Git history:

git log --all --full-history -- .env
git grep -I -n -E 'AKIA[0-9A-Z]{16}|BEGIN .*PRIVATE KEY' $(git rev-list --all)

For a real incident, rotate first. Removing a secret from the current branch does not remove it from commits, forks, caches, or cloneable history.

What About Building With Claude, GPT, and Gemini APIs?

The same design rules apply when you build your own coding agent with a Claude, GPT, or Gemini API. Tool permissions are not enough because your application may possess broad credentials of its own.

Do not give the model a general shell if you can provide a typed tool:

from dataclasses import dataclass
from typing import Literal

@dataclass
class ReadSourceRequest:
    path: str

@dataclass
class RunTestRequest:
    command: Literal["pytest", "npm test"]

A safer tool layer validates paths before execution:

from pathlib import Path

PROJECT_ROOT = Path("/srv/project").resolve()

def read_source(request: ReadSourceRequest) -> str:
    target = (PROJECT_ROOT / request.path).resolve()

    if not target.is_relative_to(PROJECT_ROOT):
        raise ValueError("Path escapes project root")

    blocked_parts = {".git", ".ssh", ".aws", "node_modules"}
    if blocked_parts.intersection(target.relative_to(PROJECT_ROOT).parts):
        raise ValueError("Sensitive path blocked")

    if target.name == ".env" or target.name.startswith(".env."):
        raise ValueError("Environment files blocked")

    return target.read_text()

The API key for the model provider should remain in the host process, never in the prompt, generated code, or tool arguments. Give the agent a narrowly scoped token for the resource it actually needs.

Tool output also needs classification. A command that prints environment variables should be treated as secret-bearing even if the model did not request a credential explicitly. Redaction belongs before data enters a transcript, trace, observability system, or evaluation dataset.

A Defensible “Don’t Ask Again” Policy

Use persistent approval only for repeatable, low-risk operations. Keep high-impact boundaries human-controlled.

A workable policy looks like this:

If you build an internal agent, enforce these boundaries in the tool server, not through prompt text alone. A system prompt saying “never read secrets” is guidance. A filesystem rule that rejects .env is a control.

AI Prime Tech can be useful here for teams running evaluations or agent workflows across Claude, GPT, and Gemini: cheaper multi-model API access helps reduce the cost of testing tool behavior against more than one model family. Cheaper inference does not remove the need for secret isolation, but it makes broader testing more practical.

Practical Takeaways

The goal is not to make the agent stop working autonomously. It is to ensure that autonomy ends at the right boundary—especially when the next command can turn a local password into a public file.

Claude Code Desk covers Claude Code, agents and developer workflows for Claude API Key. Check version-specific details such as model IDs, prices and limits against the official documentation before relying on them.

Get cheaper Claude API access

One API key for Claude Opus 4.8, Sonnet 4.6, Haiku 4.5, Fable 5, plus GPT & Gemini — up to 80% off official pricing, pay-as-you-go.

Get Your API Key →
AI Prime Tech is an independent third-party API gateway. Claude™ and Anthropic® are trademarks of Anthropic, PBC. No affiliation or endorsement is implied.