env.inspector
10 / 10Safe patternView SourceNetwork tabcurlbundle grep

Inspect it yourself

Every problem in this project pointed you at a specific inspection technique. This page collects all of them in one place, plus a script that automates the most reliable one.

View Source

Use for: Anything a Server Component rendered directly into HTML.

Ctrl/Cmd+U, then search (Ctrl/Cmd+F) for a fragment of the value you’re worried about. This is the raw response — no JavaScript has run yet.

DevTools → Sources / Debugger

Use for: Anything Next.js inlined into a compiled JS chunk (any NEXT_PUBLIC_ value).

"Search across all files" (Ctrl/Cmd+Shift+F in Chrome) for the literal value. If it’s inlined, it’ll show up hard-coded somewhere under _next/static.

Network tab

Use for: Route Handler and Server Action responses, plus request/response headers.

Reload with Network open, click a request, check both the Response body and the Headers panel — a header leak is easy to miss if you only ever look at the body.

curl (or any HTTP client)

Use for: Confirming a leak has nothing to do with your browser or its extensions.

curl -I https://your-app/some/path for headers only, or plain curl for the full body. If it shows up here, it’s a server-side issue, full stop.

Bundle grep (automated)

Use for: Catching a leak before you ever deploy, as part of your own workflow.

npm run verify builds the app, then scans everything under .next/static for values that should never be there. See below.

Automate it: npm run verify

This repo ships scripts/check-leaks.mjs. It builds the app, then walks every file under .next/static — the exact set of files your browser downloads — checking that none of the server-only demo values leaked in, and that the public one did.

terminal
npm run verify
# runs: next build && node scripts/check-leaks.mjs

Try it after visiting Problem 06 or 02 with a modified page that accidentally prints a secret — the script will fail the build with the exact file the value showed up in. Wiring something like this into CI (a pre-deploy step, a GitHub Action) turns "I hope nobody leaked a key" into an actual gate.

⚠If you ever find a real leak
Treat any exposed value as compromised the moment it’s visible in a public response — even if you fix the code five minutes later. Browsers, proxies, CDNs, and crawlers cache aggressively, and a key that was public even briefly should be rotated at the provider, not just removed from your code. For real projects, secret-scanning tools like gitleaks or GitGuardian can also catch a credential committed to git history, which this project’s script doesn’t cover.
Self-check0/3 answered
  • If you fix the code that leaked a secret, the previously-exposed value is safe again.

  • A bundle-scanning script like check-leaks.mjs can catch a secret accidentally committed to git history in an old commit.

  • Checking response headers is just as important as checking the response body when looking for leaks.