Skip to content

How do you keep API keys out of your code, your app, your logs and your git history, and what do you do the day one leaks?Also calledLeaked Keys and Secrets

Module
01/05Module
To read
~12 minTo read

It starts with a failure

An AI-built app calls its AI provider straight from the browser. The coding agent that built it put the API key in a NEXT_PUBLIC_ setting. What do you think happens?

In the module you make your guess first, then read what happened and why.

  1. 01

    Only your server reads secrets

  2. 02

    Read each environment’s keys when the app runs

  3. 03

    Scan before and after you push

  4. 04

    Treat a leak as permanent

SpecA list of your secrets and a plan for replacing them

A spec for your own app, as a text file you download. The module also gives you the prompt to paste into the AI you build with (Lovable, Bolt, Replit, Cursor, Claude Code or Codex), a checklist to check what it built, and recommended skills.

  • A locked store for secrets (secret managers)
  • A server route in front of paid APIs
  • Logs that don’t leak keys

Field notes on this topic