A developer pasted a credential into an AI coding agent: the first hour runbook

Published · Updated · Checked against Anthropic, OpenAI, GitHub and Cursor enterprise documentation, 10 Nov 2026

Rotate the credential first, before anyone deletes anything. Deleting the transcript does not invalidate the key, and the secret may already sit in a vendor's retention window, a telemetry collector and a local file. The rest of the hour is finding every copy, deciding what to purge and what to preserve as evidence, and working out whether anyone outside the company must be told.

Copy the table into your incident ticket and fill it as you go.

Step | Owner | Done by | Evidence location
0 Confirm what was pasted | [name] | [time] | [link]
1 Rotate or revoke | [name] | [time] | [link]
2 Scope the blast radius | [name] | [time] | [link]
3 Find every copy | [name] | [time] | [link]
4 Purge or preserve (decision-maker: [name]) | [name] | [time] | [link]
5 Notify | [name] | [time] | [link]
6 Prevent | [name] | [time] | [link]
7 After-action | [name] | [time] | [link]

Delete the rows that do not apply, and write the time each step finished.

Step 0: confirm what was pasted

Ask the developer for the session, not for a description. Find out what kind of secret it was (an API key, a cloud credential, a database URL, a private key, a personal token), what it grants, and whether it was typed, pasted or printed by a command the agent ran. Shell output counts: an agent that runs env or cat .env puts the values into the transcript without the developer pasting anything. Record the session ID, the tool (Claude Code or Codex), the account that was signed in, and the time. If the credential belonged to a person or customer rather than the company, note that now, because step 5 depends on it.

Step 1: rotate or revoke first

Revoke at the issuer, then issue a replacement. Do this before purging, because purging does not reduce the exposure to zero: the vendor may hold a copy and a log may hold another, and an unrotated key stays valid for anyone who has seen it. Write down the time of revocation, since it ends the window in which the key could have been misused. Then look at the issuer's own logs for use of the key between the paste and the revocation. The session data policy template has a clause that sets rotation as the first response, and secrets in transcripts covers how to find other secrets already present.

Step 2: scope the blast radius

List what the credential could reach: which systems, which environments, which data, with what permissions. A narrowly scoped read-only token is a different incident from an administrator key. Check whether the same value is reused elsewhere, and whether the agent used it during the session to call anything. For a cloud credential, the provider's audit log tells you what it did. Set the severity from this step and write it down, since it decides who needs to be in the room.

Step 3: find every copy

A pasted secret lives in several places, and each has its own clock. Check each one and record where it is and when it expires.

Local transcript, Claude Code: [~/.claude/projects/<project>/ on the machine, path and size]
Local transcript, Codex: [$CODEX_HOME/sessions/, path and size]
Other local copies: [backups, synced folders, exports, shell history]
Vendor side: [Anthropic 30 days standard on commercial plans; zero retention if enabled; Codex: not found on the pages read]
Telemetry collector: [our OpenTelemetry endpoint, tool-call and prompt logging on or off]
Central archive: [location, who can read it, whether it is sealed]
Ticket or chat: [where the secret was pasted while reporting it]

On the vendor side, Anthropic documents that commercial retention is 30 days (checked 2026-11-10), that /feedback, /bug and /share transcripts are kept 5 years, and that flagged sessions can be retained up to 2 years even under zero retention. Local Claude Code transcripts are plaintext and kept 30 days by default, adjustable with cleanupPeriodDays. The where Claude Code stores sessions and where Codex stores sessions guides give the file layouts. A telemetry collector is the copy people forget: if you export prompts or tool results, the secret is there too.

Step 4: purge or preserve

This is a decision, and it needs a named decision-maker, because the two goals pull against each other. Purging reduces how many places the secret exists. Preserving keeps evidence you may need for an investigation, a customer, an auditor or a legal claim. Decide in this order: is there any reason to believe this is a breach or a legal matter, and if so, preserve a sealed copy with restricted access first, then purge the working copies. If there is no such reason, purge. Record who decided, when, and what exactly was removed or kept. The retention guide explains how to set the period that governs the preserved copy. Vendor deletion is limited: on Anthropic's Compliance API, deletes are permanent, and it advises pulling anything you must retain before deleting.

Step 5: notify

Two clocks might start, and neither is automatic. Under GDPR Art. 33(1), a controller notifies the supervisory authority within 72 hours of becoming aware of a personal data breach, where feasible, and a leaked API key is not by itself a personal data breach. It becomes one if it exposed personal data, so use the scope from step 2. Under NIS2 Art. 23, early warning within 24 hours and notification within 72 hours apply only to entities in scope and only for a significant incident. Contracts with customers can also carry their own notice periods. Decide with counsel; this is not legal advice. Record the reasoning even when the answer is that no notice was due.

Step 6: prevent

Deny rules stop an agent reading known files. In Claude Code, add deny rules such as Read(./.env) and Read(./.env.*) under permissions.deny (the security page does not show this example, so test it), and set them in managed settings so developers can add rules but not remove yours. The limit matters: a deny rule does not stop a developer pasting text into the prompt, and it does not cover the output of a shell command the agent runs. Pair it with secret scanning on commits and with a periodic scan of transcripts. Make the credentials themselves short-lived, and scoped narrowly enough that a leak in this hour is a small incident.

Step 7: after-action

Within a week, record what the secret was and how it reached the agent, the time from paste to revocation, which copies existed and how long each would have lasted, and which control would have changed the outcome. Update the policy and the deny rules, and tell developers what happened without naming the person.

Where Sealkeep fits

Sealkeep covers Claude Code and Codex only. It gives a company a sealed central copy of session transcripts, which helps with step 3 (finding every copy) and with preserving evidence in step 4. It is not a DLP and not a real-time monitor, so it does not stop a paste, it only holds the record. It covers only machines that run it, its encryption format has not been independently audited, and it has no documented legal hold, scheduled deletion, redaction inside sealed archives or SIEM export, so removing a secret from a sealed archive is not something to plan on.

FAQ

Does deleting the transcript make the leak go away?

No. The key stays valid until it is revoked, and the vendor, a collector or a backup may hold another copy. Rotate first.

What if the paste was in a Cursor or Copilot session?

The steps are the same, but the local and vendor-side locations differ, and Sealkeep does not capture those tools. Ask the vendor how long it retains the session, using the questionnaire.

Do we have to report every pasted key to a regulator?

No. GDPR Art. 33 applies to a personal data breach, and NIS2 Art. 23 to in-scope entities with a significant incident. Check both against the scope you wrote down in step 2, and ask counsel.

Who should own the runbook?

Security owns it, with a named decision-maker for step 4 and a deputy. Engineering management supplies the developer and the context, and counsel is called at step 5 only when personal data or a regulated entity is involved.

Should the developer be disciplined?

That is an HR question the runbook does not answer. Treat the first hour as containment, and look at why the control that should have stopped the paste, such as a deny rule or a scanner, did not exist.