Skip to main content
rulesSource-backed

AI Assistant Secret Handling Rules

Source-backed rules for AI coding assistants that must avoid exposing, copying, logging, committing, or normalizing secrets while editing code, configs, tests, prompts, documentation, and CI workflows.

by MkDev11·added 2026-06-04·
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html, https://github.com/JSONbored/awesome-claude/blob/main/content/rules/ai-assistant-secret-handling-rules.mdx
Safety notes
Treat any discovered credential as compromised until an owner confirms it is fake, expired, or rotated., Do not ask the assistant to test live production credentials, print secrets for debugging, or copy token values into issue comments, PR bodies, generated docs, fixtures, or screenshots., Block merge when generated artifacts, logs, snapshots, notebooks, lockfiles, or config examples include real-looking secrets or private identifiers.
Privacy notes
Secrets often appear next to private account IDs, customer names, repository paths, internal hostnames, prompt text, and incident context; redact surrounding context, not only the token., A model transcript, debug log, trace, or review comment can become a secondary copy of a secret even when the code diff is later cleaned., Use synthetic examples such as `EXAMPLE_API_KEY` and document the secret name or storage location without revealing the value.
Author
MkDev11
Submitted by
MkDev11
Claim status
unclaimed
Last verified
2026-06-04

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

10 minutes

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

4 prerequisites to line up before setup. Have accounts and credentials ready first. Includes a review or approval gate.

0/4 ready
Account & credentials2Permissions & scopes1Review & approval110 minutes

Safety & privacy surface

Safety & privacy surface

3 safety and 3 privacy notes across 1 risk area. Review closely: credentials & tokens.

1 area
  • SafetyCredentials & tokensTreat any discovered credential as compromised until an owner confirms it is fake, expired, or rotated.
  • SafetyCredentials & tokensDo not ask the assistant to test live production credentials, print secrets for debugging, or copy token values into issue comments, PR bodies, generated docs, fixtures, or screenshots.
  • SafetyCredentials & tokensBlock merge when generated artifacts, logs, snapshots, notebooks, lockfiles, or config examples include real-looking secrets or private identifiers.
  • PrivacyCredentials & tokensSecrets often appear next to private account IDs, customer names, repository paths, internal hostnames, prompt text, and incident context; redact surrounding context, not only the token.
  • PrivacyCredentials & tokensA model transcript, debug log, trace, or review comment can become a secondary copy of a secret even when the code diff is later cleaned.
  • PrivacyCredentials & tokensUse synthetic examples such as `EXAMPLE_API_KEY` and document the secret name or storage location without revealing the value.

Safety notes

  • Treat any discovered credential as compromised until an owner confirms it is fake, expired, or rotated.
  • Do not ask the assistant to test live production credentials, print secrets for debugging, or copy token values into issue comments, PR bodies, generated docs, fixtures, or screenshots.
  • Block merge when generated artifacts, logs, snapshots, notebooks, lockfiles, or config examples include real-looking secrets or private identifiers.

Privacy notes

  • Secrets often appear next to private account IDs, customer names, repository paths, internal hostnames, prompt text, and incident context; redact surrounding context, not only the token.
  • A model transcript, debug log, trace, or review comment can become a secondary copy of a secret even when the code diff is later cleaned.
  • Use synthetic examples such as `EXAMPLE_API_KEY` and document the secret name or storage location without revealing the value.

Prerequisites

  • A repository, task, or assistant session that may touch credentials, environment variables, CI secrets, API tokens, private keys, webhook secrets, cookies, sessions, or private identifiers.
  • A known project policy for secret storage, such as environment variables, CI secret stores, local credential helpers, or an approved vault.
  • Permission to stop work, redact content, or request rotation if a real secret is found.
  • Access to a scanner, review checklist, or manual inspection process before committing assistant-generated files.

Schema details

Install type
copy
Reading time
6 min
Difficulty score
38
Troubleshooting
Yes
Breaking changes
No
Collection metadata
Estimated setup
10 minutes
Difficulty
beginner
Full copyable content
You are handling secrets while assisting with code.

Rules:
1. Never paste, invent, normalize, echo, summarize, or commit real secrets.
2. Replace secrets with placeholders and name the required secret store or
   environment variable.
3. Keep credentials out of prompts, transcripts, generated artifacts, logs,
   tests, screenshots, and public review comments.
4. Stop and request rotation when a real secret appears in a diff, log,
   message, branch, issue, PR, or generated file.
5. Use `.gitignore`, CI secret stores, credential helpers, and local-only
   examples instead of hardcoded values.

About this resource

Purpose

Use these rules when an AI coding assistant can see, edit, summarize, test, or publish code that might contain secrets. Secrets include API keys, passwords, private keys, SSH keys, tokens, cookies, session identifiers, webhook secrets, database URLs, cloud credentials, signing keys, and sensitive internal identifiers.

The safest assistant behavior is boring and explicit: do not reveal the value, do not preserve it in generated output, do not move it into another public place, and do not treat cleanup as enough when a real credential was exposed.

Secret Classification

Classify a value as secret or potentially secret when it is:

  • a credential value, private key, token, password, cookie, webhook secret, or connection string;
  • a live-looking value in .env, config, CI, deployment, container, cloud, or package-publish settings;
  • a generated fixture, screenshot, log, trace, notebook output, prompt, or documentation sample that resembles a credential;
  • an internal hostname, account ID, customer identifier, database name, or incident detail that should not be public;
  • a value the assistant cannot prove is synthetic.

When uncertain, handle the value as sensitive and ask for a safe placeholder.

Assistant Rules

  • Never paste real secret values into prompts, model output, PR descriptions, issue comments, commit messages, generated docs, test fixtures, or examples.
  • Replace discovered values with stable placeholders such as EXAMPLE_API_KEY, REDACTED_DATABASE_URL, or YOUR_SERVICE_TOKEN.
  • Name the required variable or secret store key, but not the value.
  • Preserve local-only files in .gitignore when the project expects secrets in untracked environment files.
  • Prefer CI secret stores, deployment secret stores, or credential helpers over hardcoded config.
  • Do not transform a secret into another leak, such as a base64 string, partial token, screenshot, log line, or generated summary.
  • Stop and escalate when a real secret appears in history, public review text, CI logs, chat transcripts, or generated artifacts.

Commit And PR Rules

Before committing assistant-generated work:

  1. Check staged files, untracked generated files, snapshots, notebooks, reports, logs, and docs for real-looking secrets.
  2. Verify .gitignore covers local credential files, but do not rely on .gitignore after a secret has already been committed.
  3. Review CI workflow changes for accidental secret printing, broad environment export, unsafe debugging, or untrusted pull request exposure.
  4. Keep the PR body privacy-safe: describe the secret name or storage mechanism without revealing values, account IDs, or private incident context.
  5. If a secret was exposed, request rotation and history cleanup from the owner before presenting the PR as safe.

Storage Rules

  • Store local development values in local-only environment files or credential helpers according to the project policy.
  • Store CI and deployment values in the platform's secret store, not in YAML, shell scripts, Dockerfiles, docs, or committed examples.
  • Keep sample files synthetic and obvious: example.env, .env.example, and docs should contain placeholders, not copied local values.
  • Scope secrets narrowly by environment, service, permission, and expiration where the platform supports it.
  • Do not create new long-lived credentials to make an assistant task easier.

Rotation And Cleanup Rules

Editing the file is not enough when a real secret was exposed.

  • Mark the credential as exposed.
  • Notify the owner or security channel.
  • Rotate, revoke, or expire the secret according to the project's policy.
  • Remove or rewrite public history only through the maintainer-approved path.
  • Check secondary copies: CI logs, issue comments, PR bodies, screenshots, traces, notebooks, generated docs, package artifacts, and assistant transcripts.
  • Add or update a scanner or review checklist so the same leak is less likely to recur.

Secret Lifecycle (OWASP)

The OWASP Secrets Management Cheat Sheet defines a secret lifecycle (section 2.7). Map assistant behavior to each stage instead of treating "edit the file" as done.

Lifecycle stage OWASP guidance (Secrets Management Cheat Sheet, 2.7)
Creation (2.7.1) "New secrets must be securely generated and cryptographically robust enough for their purpose."
Rotation (2.7.2) "You should regularly rotate secrets so that any stolen credentials will only work for a short time."
Revocation (2.7.3) "When secrets are no longer required or potentially compromised, you must securely revoke them to restrict access."
Expiration (2.7.4) "You should create secrets to expire after a defined time where possible."

Review Checklist

  • {"task": "No real values", "description": "Diffs, prompts, docs, tests, fixtures, logs, screenshots, and generated artifacts contain placeholders instead of real secrets"}
  • {"task": "Storage named", "description": "The entry or PR names the expected environment variable, CI secret, vault key, or credential helper without revealing the value"}
  • {"task": "Local files ignored", "description": "Local credential files are untracked or ignored according to project policy"}
  • {"task": "CI is safe", "description": "Workflow changes do not print secrets, export them broadly, or expose them to untrusted pull requests"}
  • {"task": "Exposure escalated", "description": "Real or suspected exposed secrets trigger owner notification, rotation, and cleanup review"}
  • {"task": "Public notes redacted", "description": "PR and issue text avoid raw tokens, private IDs, customer details, and incident context"}

Do Not Merge When

  • a real-looking secret remains in the source diff, generated files, docs, examples, tests, screenshots, logs, or notebook output;
  • a PR claims "secret removed" but does not mention rotation or owner review after exposure;
  • a workflow prints environment variables, dumps contexts, or exposes secrets to untrusted code paths;
  • a sample config uses a copied local value instead of a placeholder;
  • the assistant included token fragments, hashes, screenshots, or summaries that still help identify the secret;
  • cleanup requires private security handling but the public PR contains the sensitive evidence.

Troubleshooting

  • A value might be fake: treat it as sensitive until the owner confirms it is synthetic or expired.
  • The secret is already in history: stop normal review and follow the repository's history-cleanup and rotation process.
  • The tests need credentials: use test doubles, local-only environment variables, or CI secret stores; do not commit the value.
  • A scanner reports a false positive: document why it is synthetic, then keep the example clearly fake.
  • The assistant needs context: provide the secret name, permission scope, and storage location, not the value.

Duplicate Check

Checked existing rules, guides, collections, hooks, agents, skills, commands, open PRs, and closed PR history for secret-handling rules, credential safety, secret scanning, environment variable review, pre-write secret checks, and AI assistant privacy guidance.

Adjacent content includes secret-scanning hooks, environment-variable validation, privacy metadata rules, and secure workflow guides. This entry is distinct because it gives portable do/don't behavior for AI coding assistants deciding how to handle secrets in prompts, diffs, generated artifacts, CI workflows, and public review notes.

References

Source citations

Add this badge to your README

Show that AI Assistant Secret Handling Rules is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/rules/ai-assistant-secret-handling-rules.svg)](https://heyclau.de/entry/rules/ai-assistant-secret-handling-rules)

How it compares

AI Assistant Secret Handling Rules side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

1 trust signal differ across this comparison (Submitter).

Field

Source-backed rules for AI coding assistants that must avoid exposing, copying, logging, committing, or normalizing secrets while editing code, configs, tests, prompts, documentation, and CI workflows.

Open dossier

Source-backed rules for reviewing AI-generated request handlers and forms before merge for cross-site request forgery risk, covering state-changing method discipline, anti-CSRF token correctness, SameSite cookie posture, origin and referer checks, and safe handling of cookie-based sessions.

Open dossier

Source-backed rules for reviewing AI-generated endpoints and data-access code before merge for insecure direct object reference risk, covering per-request object-level authorization checks, scoped database lookups, identifier exposure, and consistent enforcement across read, write, and admin operations.

Open dossier

Source-backed rules for reviewing AI-generated code that deserializes data before merge for insecure deserialization risk, covering native serialization formats (pickle, PyYAML, Java Serializable) that can execute arbitrary code on untrusted input, safe data-interchange alternatives, and class allowlisting/integrity checks when native formats can't be avoided.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
SubmitterDiffersMkDev11jaso0n0818lourincedaging0-commitslourincedaging0-commits
Install riskReview firstReview firstReview firstReview first
Notes Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓
Brand
Categoryrulesrulesrulesrules
SourceSource-backedSource-backedSource-backedSource-backed
AuthorMkDev11jaso0n0818lourincedaging0-commitslourincedaging0-commits
Added2026-06-042026-06-222026-07-152026-07-15
Platforms
Harness
Source repo
Safety notesTreat any discovered credential as compromised until an owner confirms it is fake, expired, or rotated. Do not ask the assistant to test live production credentials, print secrets for debugging, or copy token values into issue comments, PR bodies, generated docs, fixtures, or screenshots. Block merge when generated artifacts, logs, snapshots, notebooks, lockfiles, or config examples include real-looking secrets or private identifiers.A missing CSRF defense lets a malicious page perform state-changing actions as a logged-in user — transferring funds, changing email or password, or deleting data — using the victim's ambient cookies. AI assistants often generate handlers that work in tests yet omit token validation or perform state changes on GET, because the happy path succeeds without any forged cross-site request. Relying on SameSite cookies alone is not sufficient: defaults vary, Lax still allows top-level GET navigations, and some clients or legacy browsers do not enforce it.A missing object-level authorization check lets any authenticated (or sometimes unauthenticated) user read, modify, or delete another user's data by changing an identifier in the request — accounts, documents, orders, invoices, and support tickets are common targets. AI assistants often generate a correct-looking handler for the current user's own data and skip the cross-user check entirely, because the happy-path test only ever exercises the requester's own objects. Switching to random/UUID identifiers reduces guessability but is not an authorization control; do not accept it as a substitute for a server-side ownership or permission check.Deserializing untrusted data with a native format's full-featured API (pickle, unsafe YAML, Java Serializable, PHP unserialize) can cause denial-of-service or remote code execution — the vulnerability triggers during deserializing itself, before any application logic runs on the result. AI assistants often reach for the most convenient deserialization call (pickle for Python object graphs, yaml.load for config-like YAML, ObjectInputStream for Java) without checking whether the input is trusted, since developer-controlled test data works regardless of which API is used. An integrity check (signature/MAC) added after deserialization already ran does not help — the attack happens during deserialization, so the check must gate the deserialization call itself, not just the object it produces.
Privacy notesSecrets often appear next to private account IDs, customer names, repository paths, internal hostnames, prompt text, and incident context; redact surrounding context, not only the token. A model transcript, debug log, trace, or review comment can become a secondary copy of a secret even when the code diff is later cleaned. Use synthetic examples such as `EXAMPLE_API_KEY` and document the secret name or storage location without revealing the value.CSRF tokens are security credentials; do not paste real tokens, session cookies, or production request captures into public PR comments or issues. Use synthetic accounts and redacted requests when demonstrating a CSRF proof of concept, and avoid attaching real user identifiers. Be careful that anti-CSRF tokens are not written into URLs, analytics, or logs, where they can leak through referer headers or shared dashboards.IDOR proof-of-concept testing can expose another account's real data; use synthetic test accounts and synthetic objects rather than real user records when demonstrating the issue. Do not paste real user identifiers, documents, or other objects retrieved during testing into a public PR or issue; redact or replace them with placeholders. Server-side logs and error messages for a denied access attempt should avoid echoing back the unauthorized object's contents, only that access was denied.Deserialization proof-of-concept payloads (e.g. a crafted pickle or Java serialized stream) can trigger real code execution in a test environment; run them only in an isolated, disposable sandbox, never against a shared or production system. Do not commit real crafted exploit payloads, credentials, or internal class/package names discovered while testing into a public PR or issue; describe the vulnerable pattern instead of attaching a working exploit.
Prerequisites
  • A repository, task, or assistant session that may touch credentials, environment variables, CI secrets, API tokens, private keys, webhook secrets, cookies, sessions, or private identifiers.
  • A known project policy for secret storage, such as environment variables, CI secret stores, local credential helpers, or an approved vault.
  • Permission to stop work, redact content, or request rotation if a real secret is found.
  • Access to a scanner, review checklist, or manual inspection process before committing assistant-generated files.
  • A pull request, diff, or snippet containing an AI-generated or AI-edited request handler, form, or fetch call with enough context to know how the user is authenticated.
  • Knowledge of how the framework manages sessions and CSRF tokens, since built-in protection, cookie defaults, and token helpers differ between frameworks.
  • Awareness of which routes change state and which are read-only, so the review can focus on unsafe methods.
  • Permission to block merge when a cookie-authenticated state change ships without a CSRF defense.
  • A pull request, diff, or snippet containing an AI-generated or AI-edited endpoint, resolver, or data-access function that accepts an object identifier from the request.
  • Knowledge of the application's ownership/permission model, since what counts as "authorized" differs between single-owner resources, shared resources, and admin-only resources.
  • Access to at least two distinct user accounts (or awareness of how to create them) to verify cross-account access is actually denied, not just assumed.
  • Permission to block merge when an object-level authorization check is missing, inconsistent, or client-trusted.
  • A pull request, diff, or snippet containing AI-generated or AI-edited code that deserializes, unpickles, unmarshals, or loads structured data from an external source.
  • Knowledge of which deserialization APIs the language/framework in use considers "safe" versus "native/unsafe" (this differs significantly between Python, Java, PHP, Ruby, and JS/Node).
  • Awareness of which data sources in the application are genuinely untrusted (client-supplied, cross-service, or user-uploaded) versus fully internal and controlled.
  • Permission to block merge when untrusted data reaches a native deserialization API without an allowlist or integrity check.
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.