# Idempotency Keys: Why a Black Friday Retry Charges Twice

Development Radio · 2026-11-27 · 17 min

Canonical page: https://developmentradio.dev/episodes/2026-11-27-idempotency-keys-black-friday-daily/

Hosts Maya and Alex are AI-generated voices and characters. Dorel, a Staff Engineer, creates the show. Sources are linked in every episode.

A retry charges a card twice when the charge succeeded but the answer was lost, so the client sends again. The fix: the client sends an idempotency key with every retry, and the server records the key, a request fingerprint and the result in the same transaction as the charge. Keep webhook event ids as long as the sender can resend: a Stripe event can be resent up to 30 days later from the CLI, while Powertools for AWS Lambda forgets a record after one hour by default. Also: upgrade LiteLLM to 1.111 or later (CVE-2026-40217, on CISA's exploited list), patch Drupal CVE-2026-132165 and Puppet CVE-2026-115731 now, and give agent write tools an idempotency key.

## Summary

Maya and Alex on why a retry charges a card twice and how idempotency keys stop it: Twilio's 2013 repeated recharges, Stripe's three failure cases as a coat check, the key table, a debate on unique constraints, and thirty days versus one hour. First, three patch-now items (LiteLLM, Drupal, Puppet) and an approved OpenAI MCP write that ran twice on a test server.

## Takeaways

1. AI, patch now: upgrade LiteLLM to 1.111+, set a real master key, block the guardrail test endpoint. Our advice: if exposed on sk-1234 or no key, or allowing client credentials, rotate provider keys.
2. Security, patch now: Drupal to 11.4.13, 11.3.22 or 10.6.22 (end-of-life branches get no fix) and block install.php. Puppet Enterprise: upgrade, restart Puppet Server, check autosign.
3. Software, check this week: for every MCP or API write tool your agents can call, does it take an idempotency key, and does the server keep it? An approval ID is not a key.
4. Practice: claim the key before the work and commit its result with the work. Keep webhook event IDs at least 30 days; Powertools' default forgets after one hour.
5. Run it this week: find orders with more than one successful charge in 90 days. If the process dies after the provider charges, what does the retry send, and with which key?

## One thing to try

Upgrade every LiteLLM proxy to 1.111 or later, confirm the master key isn't sk-1234, block /guardrails/test_custom_code at the edge, and rotate provider keys if the admin UI was ever internet-reachable. Update Drupal to 11.4.13, 11.3.22 or 10.6.22 (older branches have no fix) and block install.php at the web server. Upgrade Puppet Enterprise to 2023.8.13, 2025.12.1 or 2026.0.1, restart Puppet Server and check autosign; open-source Puppet users move to OpenVox's patched releases. For every MCP or API write tool your agents can call, check it takes an idempotency key and that the server keeps it. Run the guide's duplicate-charges query over the last 90 days, compare your webhook dedupe retention with the sender's resend window (30 days for Stripe's CLI), and answer: if the process dies after the provider call succeeds and before the response is written, what does the retry send, and with which key?

## Chapters

- 00:00 Black Friday: a retry that charges twice
- 01:07 AI: LiteLLM RCE + 10 advisories (Patch now)
- 03:34 Security: Drupal and Puppet (Patch now)
- 05:58 Dev: an MCP write ran twice (Check this week)
- 07:51 Practice: idempotency keys
- 12:38 Practice: thirty days vs one hour
- 15:37 Your question: lock it twice
- 16:13 Takeaways

## Sources

- Drupal SA-CORE-2026-017 credit line: 'Discovered by Anthropic's OSS Scanner': https://www.drupal.org/sa-core-2026-017
- Development Radio, 23 Nov 2026: competitor disclosure wording: https://developmentradio.dev/episodes/2026-11-23-openai-agents-lawsuit-daily/
- Stripe docs: Webhooks (automatic retries, manual retries, duplicate events): https://docs.stripe.com/webhooks
- Powertools for AWS Lambda (Python): Idempotency: https://docs.powertools.aws.dev/lambda/python/latest/utilities/idempotency/
- CISA Known Exploited Vulnerabilities catalog (feed 2026.11.25, released 2026-11-25T19:48Z, 1,805 entries): https://www.cisa.gov/known-exploited-vulnerabilities-catalog
- LiteLLM advisory GHSA-wxxx-gvqv-xp7p (CVE-2026-40217): sandbox escape in custom-code guardrail: https://github.com/BerriAI/litellm/security/advisories/GHSA-wxxx-gvqv-xp7p
- X41 D-Sec advisory X41-2026-001 (LiteLLM): https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm/
- Wiz: Off Guard, breaking LiteLLM from authentication bypass to cloud compromise (9 Sep 2026): https://www.wiz.io/blog/off-guard-breaking-litellm-from-authentication-bypass-to-cloud-compromise
- LiteLLM security advisories published 23–24 Nov 2026 (ten): https://github.com/BerriAI/litellm/security/advisories
- LiteLLM advisory GHSA-m8fp-3f3g-j5p7: Persistent Deployment Poisoning via Client-Side api_base (high, 23 Nov 2026): https://github.com/BerriAI/litellm/security/advisories/GHSA-m8fp-3f3g-j5p7
- LiteLLM advisory GHSA-w5h5-479w-p5hx (CVE-2026-93355): JWT and SSO email fallback (high, 24 Nov 2026): https://github.com/BerriAI/litellm/security/advisories/GHSA-w5h5-479w-p5hx
- PyPI: litellm release history; GitHub releases: https://pypi.org/project/litellm/
- Development Radio weekly, 22 Oct 2026 (LiteLLM supply-chain story): https://developmentradio.dev/
- Drupal core: Highly critical, remote code execution, SA-CORE-2026-017 (CVE-2026-132165), 18 Nov 2026, updated 21 Nov: https://www.drupal.org/sa-core-2026-017
- CVE-2026-132165: cve.org record (CNA Drupal, published 26 Nov 2026): https://www.cve.org/CVERecord?id=CVE-2026-132165
- Drupal docs: Securing the installer (install.php) (last updated 26 Nov 2026): https://www.drupal.org/docs/administering-a-drupal-site/security-in-drupal/securing-the-installer-installphp
- BleepingComputer: Drupal patches critical RCE flaw, warns exploits may surface quickly (19 Nov 2026): https://bleepingcomputer.com/news/security/drupal-patches-critical-rce-flaw-warns-exploits-may-surface-quickly
- CVE-2026-115731: Puppet Report Deserialization Code Execution (CNA Perforce): https://www.cve.org/CVERecord?id=CVE-2026-115731
- OpenVox advisory GHSA-ffr6-rwpm-p5wq (3 Nov 2026): https://github.com/OpenVoxProject/openvox/security/advisories/GHSA-ffr6-rwpm-p5wq
- Vox Pupuli: Critical CVE updates (3 Nov 2026, updated 4 Nov): https://voxpupuli.org/blog/2026/11/03/critical-cve-updates/
- OpenAI Developer Community: Responses API approved native MCP write executes twice after a programmatic read (thread 1416736): https://community.openai.com/t/responses-api-approved-native-mcp-write-executes-twice-after-a-programmatic-read/1416736
- IETF draft-ietf-httpapi-idempotency-key-header-09 (21 Nov 2026): https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/
- Development Radio field guide: Idempotency keys and exactly-once effects: https://developmentradio.dev/guides/idempotency-keys-exactly-once/
- Stripe engineering blog: Designing robust and predictable APIs with idempotency (2017): https://stripe.com/blog/idempotency
- Stripe API reference: Idempotent requests: https://docs.stripe.com/api/idempotent_requests
- Twilio: Billing incident post-mortem (18 July 2013): https://www.twilio.com/en-us/blog/billing-incident-post-mortem-breakdown-analysis-and-root-cause-html
- Decker and Wattenhofer: Bitcoin Transaction Malleability and MtGox (ESORICS 2014): https://arxiv.org/abs/1403.6676
- Amazon Builders' Library: Making retries safe with idempotent APIs: https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/
- Development Radio: YouTube search terms, 'lock it twice' (captures 21 and 22 Nov): https://developmentradio.dev/

## Listen

- Audio (MP3): https://developmentradio.dev/episodes/2026-11-27-idempotency-keys-black-friday-daily/episode.mp3
- Video on YouTube: https://www.youtube.com/watch?v=H60acjcnOxU
- Podcast feed (RSS): https://developmentradio.dev/feed.xml

## Timed transcript

**00:00:02 — Maya:** A Stripe webhook event can be sent to you again up to thirty days after it happened. Welcome to Development Radio. I'm Maya, here with Alex.

**00:00:11 — Alex:** It's Black Friday, and it's Practice Friday: how to make a retry harmless. First, the news. LiteLLM, Drupal and Puppet, and an OpenAI agent's write that ran twice.

**00:00:24 — Maya:** Good day for this one, because everybody knows the moment. You press pay. The little wheel spins. Nothing comes back.

**00:00:32 — Alex:** And your thumb is hovering over the button.

**00:00:34 — Maya:** Did it go through? Did it not? Pressing again feels like the fix. It's also exactly how you pay twice.

**00:00:42 — Alex:** And our code lives in that moment all day, without the thumb. A request times out, and something presses again for you. A retry loop, a queue, a webhook sender.

**00:00:53 — Maya:** So that's today's question. When something presses again, how do you make the second press do nothing?

**00:00:59 — Alex:** We'll build the answer after the news. And this week's news keeps coming back to one kind of caller. The one your system already trusts.

**00:01:07 — Maya:** AI first, and the verdict is patch now. LiteLLM, a popular open source gateway between your apps and the model providers. One endpoint, one bill, one place for the keys.

**00:01:20 — Alex:** Which is the point, and also the problem. A gateway holds the provider keys for every model you route through it.

**00:01:26 — Maya:** And CISA lists a bug in LiteLLM's guardrail test feature as exploited. C V E twenty twenty-six, four oh two one seven. The federal deadline is next Wednesday, the second of December.

**00:01:39 — Alex:** That feature lets you hand the gateway some Python, and it runs it inside a sandbox the project built itself. Researchers at X41 D-Sec broke out of that sandbox. The project's own advisory says the code then runs in the proxy process, as root in the default Docker image.

**00:01:56 — Maya:** So the safety feature is the way in. Who can reach it?

**00:02:00 — Alex:** In a default setup, it needs an admin key, and the project rated it medium.

**00:02:05 — Maya:** Medium. Except Wiz ran a scan in February. Nearly one in ten exposed LiteLLM gateways accepted the example key from LiteLLM's own docs, S K dash one two three four, or no key at all.

**00:02:20 — Alex:** So on those gateways, the trusted caller was anyone who'd read the setup guide.

**00:02:24 — Maya:** And that's the older news. Since Monday, LiteLLM has published ten more security advisories. None says it's being exploited. But one stayed with me.

**00:02:35 — Alex:** The rerouting one?

**00:02:36 — Maya:** That one. A user puts their own provider key in a single request. The proxy adds it to the shared list for that model, and keeps it there until it restarts. On a default setup, other users' requests could then go out on that caller's key.

**00:02:51 — Alex:** And if you allow client side credentials, one signed-in user could point part of other users' traffic at a server they control. Carrying the other users' prompts, and the company's provider key.

**00:03:02 — Maya:** Until somebody restarts it. So, patch now: upgrade to one point one-eleven or later, the current release. It covers every advisory published this week. Set a real master key. And block the guardrail test endpoint at your edge.

**00:03:18 — Alex:** And this part is our advice, not the advisory's. If that gateway was ever reachable from the internet on the example key, or on no key at all, or it let users send their own credentials, rotate the provider keys it holds.

**00:03:31 — Maya:** One key in the docs. Every key in the gateway.

**00:03:34 — Alex:** Security, and the verdict is patch now, for two of them. First, Drupal, the open source content management system. On the eighteenth, Drupal's security team shipped a fix it rated highly critical.

**00:03:48 — Maya:** Where's the bug?

**00:03:49 — Alex:** In the installer. Drupal ships a file called install dot P H P, the page you use once to set a new site up. Under some conditions, an attacker could use it to start reinstalling a site that's already live. Drupal says that can mean a site takeover, or running their own code.

**00:04:06 — Maya:** Who even opens that page after day one?

**00:04:09 — Alex:** Attackers, now. Drupal's team says it has a report of it being exploited on live sites about a day after the fix came out. On Tuesday, CISA added it to its exploited list. Federal agencies have until today.

**00:04:23 — Maya:** One disclosure there. The bug was found by Anthropic's scanner for open source projects, and this show is made with Claude, from Anthropic.

**00:04:32 — Alex:** So today, update to the latest release on your branch; the versions are in the show notes. And if your branch is already end of life, there's no fix. You have to move to a supported one.

**00:04:42 — Maya:** And block the installer at the web server, as Drupal's own docs say to do once a site is installed.

**00:04:48 — Alex:** The setup page outlived the setup.

**00:04:51 — Maya:** And the second patch now is Puppet Enterprise, from Perforce. C V E twenty twenty-six, one one five, seven three one. CISA's deadline for it is next Tuesday.

**00:05:02 — Alex:** The bug is on Puppet Server, the machine that configures your whole fleet. Any machine holding an agent certificate signed by your Puppet C A can run code on it, as the Puppet Server user. And if that C A autosigns without strong verification, anyone who can reach it can get a certificate.

**00:05:20 — Maya:** So one agent certificate is all it takes. Is there working code out there?

**00:05:25 — Alex:** A working proof of concept has been public since the third of November, in the advisory from OpenVox, the community fork. OpenVox says code execution on the server gives access to the C A signing key.

**00:05:37 — Maya:** The key that signs every machine's certificate. So: upgrade, and then restart Puppet Server, because upgrading isn't patching until you restart. And check whether autosign is on.

**00:05:49 — Alex:** And if you run open source Puppet, no open source fix is coming from Perforce. OpenVox has patched releases.

**00:05:56 — Maya:** The machines it manages can manage it.

**00:05:58 — Alex:** So far today: a gateway that trusts its admin key, a setup page that trusts whoever finds it, and a Puppet server that trusts its agents. Next, trusting a caller to do something once.

**00:06:11 — Maya:** Before OpenAI's side, a disclosure. This show is made with Claude, from Anthropic, a direct competitor of OpenAI. Weigh our take with that in mind.

**00:06:21 — Alex:** Software development, and the verdict is check this week. A developer reported, on OpenAI's own forum, that one approved write ran twice. It went through the Responses API's support for MCP, the protocol agents use to call outside tools, and this tool could change data.

**00:06:39 — Maya:** Approved meaning the app said yes, go ahead?

**00:06:43 — Alex:** Right. The agent asks to call a write tool, the app approves, the write runs. Here the server saw the write, then a read, then the same write again. And the model's final answer said it had run once.

**00:06:56 — Maya:** So even the summary was wrong. Did OpenAI pick it up?

**00:07:00 — Alex:** On the nineteenth, OpenAI's support team said it had fixed the extra write that came after a read. Then it warned: if your request times out, the write may already have happened. Sending it again can run it a second time, even with the same approval ID.

**00:07:15 — Maya:** That was a test server, with no real business data. But that warning is the sentence I'd frame. The approval ID isn't a key.

**00:07:23 — Alex:** An approval says you may. It doesn't say you already did.

**00:07:27 — Maya:** So this week, take every MCP or API write tool your agents can call. Does it take an idempotency key, and does the server keep it?

**00:07:36 — Alex:** And the I E T F's draft for the Idempotency-Key header, revised last Saturday, now says it outright. Two requests with different keys are both processed, even if they're identical.

**00:07:47 — Maya:** So the key is what makes a retry the same request.

**00:07:51 — Alex:** Which is our practice. Idempotency keys. And I want to start with a story from July twenty thirteen, at Twilio. Twilio kept each customer's prepaid balance in Redis. A network blip made every replica ask the primary for a full copy at once. The overloaded primary got restarted with the wrong configuration, and came back with every balance gone. And read only.

**00:08:14 — Maya:** So every balance is gone, and nothing can write a new one.

**00:08:18 — Alex:** And Twilio has auto recharge. Your balance runs low, it charges your card and tops you up.

**00:08:24 — Maya:** Oh, no. It finds no balance, charges the card, tries to write the new one, can't. Finds no balance again.

**00:08:32 — Alex:** Twilio's postmortem says the recharge was attempted multiple times, because the balance was never updated to reflect the payment. The incident hit one point four percent of their customers.

**00:08:42 — Maya:** What did they change?

**00:08:44 — Alex:** They added a fail safe. If billing balances don't exist or can't be written, the system won't suspend accounts or charge credit cards.

**00:08:51 — Maya:** Nothing in that system lied. Every retry did exactly what it was written to do. The only record that the charge happened was the one thing that couldn't be written.

**00:09:02 — Alex:** So far: the charge happened, and the record of it was lost. Usually it's the other way round. The record is fine, and the answer gets lost.

**00:09:10 — Maya:** Think of every API call as a coat check. You hand your coat over the counter, and the line goes quiet. Three possibilities. They never heard you. They're hanging it right now. Or they hung it, and you just didn't hear thanks.

**00:09:24 — Alex:** And if I just ask again?

**00:09:25 — Maya:** In the first case, you get your ticket. In the third, as far as their book is concerned, you now own two coats.

**00:09:32 — Alex:** Which is a double charge. Those are Stripe's three cases, from a twenty seventeen engineering post. From the client's side, all three look the same. An error, or nothing at all.

**00:09:43 — Maya:** And the middle one is the nasty one. The work is in limbo, the coat half hung.

**00:09:49 — Alex:** And no protocol makes that go away. Never retry, and you sometimes lose work. Retry, and you have to make the second try harmless.

**00:09:57 — Maya:** Which is why the queues and webhook senders we use promise at least once. Stripe's docs say an endpoint might get the same event more than once.

**00:10:05 — Alex:** So what you can actually have is an exactly once effect. Deliver as often as you like, and the second, third and tenth delivery change nothing. That takes two parts. The client makes one key per operation, before the first try, and stores it, so every retry, even after a restart, sends the same key.

**00:10:26 — Maya:** And the server?

**00:10:27 — Alex:** The server claims the key before it does any work. A row that says: this key, in progress. Then it does the work, and writes the result and the key's status in the same commit.

**00:10:38 — Maya:** Why the same commit? Why not mark the key done right after?

**00:10:42 — Alex:** Because the crash lands in the gap. Our field guide puts it in two sentences. Record the key without the effect, and a crash loses the effect. Record the effect without the key, and the retry repeats it.

**00:10:54 — Maya:** So when the retry shows up, the server finds the key done, and hands back the stored answer instead of charging again.

**00:11:01 — Alex:** And if the first request is still running, the second one gets a conflict response and is told to wait. The card isn't touched.

**00:11:09 — Maya:** Then where does it go wrong in real systems?

**00:11:11 — Alex:** Three places. First, scope the key to the account. Two customers who both send order one shouldn't collide.

**00:11:19 — Maya:** Second, fingerprint the request. Same key with a different amount is an error, not a replay, or you'd hand the first answer to a different request.

**00:11:28 — Alex:** Third, when the charge happens at your card processor, it can't join your transaction. So you hand them a key too, built from yours. Say, your key with the word charge on the end. If you crash after they charge, your retry sends them that same key and the same details. While they still remember that key, they return the original result instead of making a new charge.

**00:11:51 — Maya:** That's three moving parts for one payment.

**00:11:54 — Alex:** Honestly, for most teams I'd skip the key table. Put a unique constraint on the order ID. One charge per order. The database does the rest.

**00:12:02 — Maya:** Only if the operation has a natural key. An order does. A top-up doesn't. What's the natural key of charge me when I'm low? That's Twilio's recharge.

**00:12:13 — Alex:** Fair. Then it's both. Where there's a real business ID, the constraint is cheaper, and it can't drift. Where there isn't, you need the key.

**00:12:22 — Maya:** And even with the key table, the final write wants its own guard. A unique constraint, or an update that only fires while the status is still pending. So far: claim the key first, and save it with the work. Now the receiving end. Webhooks.

**00:12:38 — Alex:** A Stripe webhook event can be sent to you again up to thirty days after it happened, if someone resends it by hand. Stripe's own retries stop at three days.

**00:12:47 — Maya:** And a popular AWS library built for exactly this, Powertools for AWS Lambda, forgets the event after one hour, by default.

**00:12:56 — Alex:** Say a handler on that default does the work, and the answer never gets back. Two hours later, Stripe retries. The record has expired. It runs again.

**00:13:06 — Maya:** Your dedupe memory has to outlive the sender's resend window. With a one hour memory, any resend after the first hour gets processed again.

**00:13:15 — Alex:** So keep processed event IDs for at least thirty days. It's one small table.

**00:13:20 — Maya:** And with no key at all, the cost adds up quietly. In our example, a million payment requests a day.

**00:13:27 — Alex:** And two in every ten thousand commit on the server, but lose the answer to a timeout.

**00:13:32 — Maya:** That's two hundred retries a day, of work that already happened. If each one is retried and nothing else stops it, every one is a second charge.

**00:13:42 — Alex:** About seventy three thousand a year. With the key, each one is a replay, and nobody notices.

**00:13:49 — Maya:** So far: claim the key first, save it with the work, and remember it longer than the sender can resend. One more trap. What you dedupe on.

**00:13:58 — Alex:** Mt. Gox, February twenty fourteen. The bitcoin exchange stopped withdrawals, and blamed something called transaction malleability. Someone else could change a transaction's ID without making it invalid.

**00:14:11 — Maya:** And let me guess. Mt. Gox tracked its withdrawals by that ID.

**00:14:16 — Alex:** By that ID alone, as researchers Decker and Wattenhofer read Mt. Gox's own statement. So a withdrawal that went through under a new ID looked like it had failed, and could be credited back.

**00:14:27 — Maya:** So the rule's simple. Dedupe on an ID you made and stored before you sent anything. Never on one the other side can rewrite.

**00:14:36 — Alex:** Last one, and it's today's dev lane. The agent's approved write. Even with the same approval ID, a resend after a timeout can run it again.

**00:14:45 — Maya:** And another developer on that forum thread suggested a fix. Add a required idempotency key to the write tool, and keep the keys you've seen, with the result, for a few minutes.

**00:14:55 — Alex:** Right shape. Then ask the thirty days question. How late can the resend arrive? The key has to be remembered at least that long.

**00:15:04 — Maya:** So this week, two checks. Do you have orders with more than one successful charge in the last ninety days? It's one grouped query, and it's in our field guide, out today.

**00:15:14 — Alex:** And check your webhook dedupe table. If it forgets Stripe events in under thirty days, a late resend from the command line can get processed again.

**00:15:22 — Maya:** Then one question for whoever owns the payment path. If the process dies after the provider call succeeds, and before the response is written, what does the retry send, and with which key?

**00:15:34 — Alex:** If the answer is a new key, that's your double charge.

**00:15:37 — Maya:** Your question. People keep finding our Redis lock Short, the one where a gift card got spent twice, by searching lock it twice.

**00:15:45 — Alex:** It's a fair instinct. Lock it, and nobody else can do it at the same time.

**00:15:49 — Maya:** And the honest answer is, a lock decides who goes first. It doesn't remember what already happened.

**00:15:55 — Alex:** What stops the second charge is the record of the first one. The key, or a unique constraint. Lock it once, and write it down.

**00:16:04 — Maya:** So, a question for you. How long does your webhook dedupe table remember? Hours, days or forever? Tell us in the comments.

**00:16:13 — Alex:** One per lane. AI, patch now: LiteLLM to one point one-eleven or later, with a master key that isn't the one in the docs.

**00:16:22 — Maya:** Security, patch now, twice. Drupal: update, and block the installer. Puppet: upgrade, restart Puppet Server, and check autosign.

**00:16:33 — Alex:** Software, check this week. Does every write tool your agents can call take an idempotency key that the server keeps?

**00:16:40 — Maya:** Friday's checks are about what you let a trusted caller do twice.

**00:16:44 — Alex:** See you Monday. And happy Black Friday.

**00:16:47 — Maya:** Thanks for listening to Development Radio. If a pay button spins at you today, here's hoping someone on the other side kept the key.
