Secrets and pasting: what never goes in the chat
Goal: When debugging, paste redacted secret *shapes* and raw errors—treat real secrets as already compromised.
Best for: Anyone debugging with AI, connecting tools, or pasting “Build a reflex—API keys, passwords, session tokens,”
If it can unlock an account or a system, it is a secret. Redact to placeholders. If you already pasted one, rotate it. Chat history is not a password manager.
If it unlocks something, it does not belong in the chat box. Paste shapes and redacted samples; keep secrets in a password manager.
Assume chat logs are longer-lived than you think. Rotate anything that touched the box—even “temporary” keys.
Why beginners skip this
“Paste then delete the secret” feels tidy—the secret already hit the log. Pin the never-paste list first.
Step 1 — Never-paste list
- Passwords and OTP codes
- API keys, bearer tokens, refresh tokens
- Private keys /
.pemmaterial - Connection strings with credentials
- Customer raw PII dumps
- Internal unreleased security details that enable abuse
I will paste redacted config. Replace secrets with YOUR_API_KEY / YOUR_PASSWORD placeholders.
Help me understand the structure only. Do not ask me to paste the real secret.
Step 2 — Config help without leakage
Example
Filled prompt
Stack trace includes connection string.
Paste shape-only redaction. Model debugs without secrets. Show before/after line.
Paste shape-only + error text; rotate if it slipped.
What good output looks like
- Key replaced with YOUR_API_KEY (or similar) before analysis
- Useful error text and stack lines kept intact
- Never-paste checklist listed (keys, passwords, conn strings, tokens)
- No request for you to re-paste the live secret
- Debug help still works on the redacted dump
Step 3 — If you slipped
Rotate the credential in the provider console and invalidate sessions; check git history if it may have landed there, and treat the secret as compromised in that chat.
Example
Filled prompt
I almost pasted .env into chat to "debug."
Rewrite paste checklist: never-paste list, redaction pattern, what to paste instead (shape only).
Practice on a fake KEY= line—show redacted version.
What good output looks like
- Finds email, password, and connection-string leaks in the draft
- Returns a cleaned version that is safe to paste into chat
- No leftover secrets in the cleaned block
- Explains each redaction in one short line
- Reminds you to rotate if the live values were already sent
Save this card
Card: Paste errors, never secrets—placeholder first; rotate if it slipped. Keep this beside the tool; read before you start.
Before you start
Put the scrub checklist on your desk. For “Build a reflex—API keys, passwords, session tokens, private ,” decide placeholders before the paste window opens Guide: safety-secrets-and-pasting Keep the live artifact visible the whole time. If you only have a blank box, stop and fetch the real job first
How to use this week
This week pin a never-paste list on the desk: API keys, passwords, tokens; run one fake-paste drill before work.
Rotate on contact
If a key touched chat, revoke it. “Test key” is still live when leaked.
One more pass
Re-read your Save-this-card line. If it is vague, rewrite it until a stranger could apply it.
Rotate beats delete-chat theater
Deleting a chat does not guarantee the secret is gone from every log. If a live key was pasted, rotate it in the provider console, update your app, then continue debugging with placeholders.
Error text in, secrets out
Stack traces, status codes, and redacted request paths help the model debug. Live API keys, passwords, and connection strings never do. If your paste still works after YOUR_API_KEY replacement, you redacted enough.
Example
Filled prompt
Live artifact this week for: Build a reflex—API keys, passwords, session tokens, private keys, and customer secrets nev
Name real files/people. No invented facts; label Unknowns; stop before send/delete.
Return working prompt + one pass/fail check I can mark in a minute.
What good output looks like
- No raw PII/secrets in the paste for “Build a reflex—API keys, passwords, session tokens”
- Placeholders used; scrub checklist visible
- Disclosure matches how much AI actually did
- Pass/fail: desk card updated today
Red flag
Live secrets in prompts; no rotate after a slip—placeholder first, rotate if needed.
Pitfalls
| Pitfall | Fix |
|---|---|
| “I’ll delete the message later” | Rotate now; deletion ≠ un-send everywhere |
| Screenshots of admin consoles | Crop keys; prefer redacted text |
| Sharing Project files with keys inside | Scan uploads |
Example
Filled prompt
Temptation: skip the habit for safety-secrets-and-pasting to save five minutes.
Job still: Build a reflex—API keys, passwords, session
Smallest correct pass: Done visible · checkable artifact · Unknowns [?].
Boundaries: draft only; no silent send; no invented metrics.
Return: artifact + refuse-line said aloud.
What good output looks like
- Names the shortcut refused (specific to safety-secrets-and-pasting)
- Still delivers checkable output for “Build a reflex—API keys, passwords, session”
- Unknowns labeled; draft-only
- Pass/fail: refuse-line dated (safety-secrets-and-pasting #4)
Practice now
Env not chat: move one secret from chat habit to env var note (Asia/Shanghai).
Redact rehearsal: redact a fake secret in a paste before the real one (Asia/Shanghai).
Canary string: paste a fake canary; ensure it never appears in outputs you share (Asia/Shanghai).
Secrets drill: search clipboard history habit—clear after any key paste (Asia/Shanghai).
Thin-spot drill: rewrite the Save card with real nouns from your work (repo, doc, inbox). Generic placeholders fail the drill.
Tonight run the never-paste list before every paste; on a secret hit, rotate and log what almost went in.
Close the loop
Write one line: next time I paste then delete a secret, I refuse paste.
One sentence takeaway
Pin the never-paste list first; fake-paste drill passes before work.
Word-floor practice
Run the Today card once on a real artifact. Write pass/fail + never-do with date Asia/Shanghai. If you only skimmed, do not mark this guide done.
Next
密钥与粘贴:什么永远不要进对话框
目标: 排障时只贴打码后的密钥形状和报错原文:把真实密钥当已经泄露来处理。
适合: 差点把 API 密钥、连接串或密码粘进聊天框的人。
模型帮排障不需要完整密钥。形状加错误原文通常够用;「绝不粘贴」清单要短到能背下来。
为什么新手跳过
「先贴再删密钥」像省事;密钥其实已进日志。永不粘贴清单先贴住。
步骤 1——永不粘贴清单
- 密码与 OTP
- API 密钥、bearer / refresh token
- 私钥 /
.pem材料 - 带凭证的连接串
- 客户原始 PII 倾倒
- 便于滥用的未公开安全细节
我将粘贴打码后的配置。秘密用 YOUR_API_KEY / YOUR_PASSWORD 占位。
只帮我理解结构。不要让我粘贴真实秘密。
步骤 2——不泄露地问配置
实例
填好的提示词
我差点为了调试把 API 密钥粘进去。请重写我的求助:只用打码后的密钥形状(如 sk-***)和错误原文,并附上「绝不粘贴」清单 + 控制台轮换入口提示。
边界:不编造;未知标 [?];发送前停下。
完成检查:一分钟内能判过/不过。
像样的输出大概长这样
- 求助信里密钥已打码,只保留形状提示和报错原文
- 文末附「绝不粘贴」清单:密钥、数据库连接串、会话 cookie
- 别人仍能根据形状和错误帮你排障
- 语气像踩过坑的人提醒未来的自己
- 对话记录里不留真实密钥残段
步骤 3——如果已经滑倒
在服务商控制台轮换凭证并作废会话;如果可能进过 git,查历史,并把该秘密视为已在该聊天里妥协。
实例
填好的提示词
请扫描这篇提示词草稿,找出机密:「User john@acme.com password Winter2026! conn string postgres://...」请列出发现,并给出清洗版。
像样的输出大概长这样
- 扫描结果列出疑似邮箱、密码、postgres 连接串等位置
- 同时给出一份可复制的清洗版,确认无残留机密
- 「发现列表」和「清洗稿」分开,方便对照检查
- 整套输出可当粘贴前的自动检查提示来复用
- 不顺便编造「你可能还有别的秘密」这类猜测
保存这张卡
记下:今天收回的权限 / 打码习惯 / 披露句其中一项。标上日期。
开始前
先定义「安全完成」:撤销范围、粘贴打码,或加披露。选一件可衡量的动作。
本周怎么用
本周把永不粘贴清单贴在桌面:API 密钥、密码、token;假粘贴演练一次再开工。
一接触就轮换
密钥进过聊天就撤销。「测试密钥」泄露了也是活的。
再过一遍
重读「保存这张卡」那一行。如果含糊,改到陌生人也能执行。
轮换胜过「删对话」表演
删对话不能保证每个日志里都没了。如果贴过活密钥:在服务商控制台轮换、更新应用,再用占位符继续调试。
错误文本进,密钥出
堆栈、状态码、已脱敏的请求路径能帮模型调试。活的 API 密钥、密码、连接串永远帮不上。换成 YOUR_API_KEY 之后如果粘贴仍够用,说明脱敏够了。
红旗
先贴再删密钥,密钥其实已进日志;永不粘贴清单先贴住。
常见坑
| 坑 | 改法 |
|---|---|
| 调试时贴完整密钥 | 只贴打码形状 + 报错原文 |
| 「反正是测试密钥」 | 测试密钥也按泄露处理 |
| 清洗后仍留连接串片段 | 用扫描提示再过一遍 |
现在就练一次
今晚就练:把永不粘贴清单贴在桌面:API 密钥、密码、token;假粘贴演练一次。
闭环
写下一行:下次先贴再删密钥,我拒绝粘贴。
一句话带走
永不粘贴清单先贴住;假粘贴演练过关再开工。
下一步
← Back to home · Learn · Tools · Compare · Start