Skip to content

Scan for leaked secrets and lock them down

Find API keys and passwords in the code, the history and the browser bundle, and stop new ones getting in.

  • Free, no sign-up
  • 30 to 60 minutes with an agent
  • By Devvrat Hans
  • Version 1.0, updated Oct 26, 2026

1Your site and stack

Optional. The prompt adapts as you type; leave a field blank and the agent works it out.

2Copy it into your agent

secrets-scan.md63 lines, about 903 tokens

Paste into any coding agent: Claude Code, Cursor, Codex, Copilot, Windsurf or Cline.

# Scan for leaked secrets and lock them down

Launching means more eyes on the production site, including people who read JavaScript bundles and public repositories for keys. Find any secret that is committed, logged or shipped to the browser, tell me which ones to rotate, and make it hard for a new one to slip in.

Site: not given. Find the production URL in the project config, or ask me.

## Ground rules

1. Read before you write. Explore the parts of the codebase this job touches and tell me what is already in place.
2. Plan, then stop. Give me a numbered plan: what you will change, in which files, and why. Wait for my approval before editing anything.
3. Fix things at their source (the shared layout, the config, the generator), not with one-off patches page by page.
4. Keep the project's conventions: its framework APIs, file layout, naming and code style. Add no new dependency without asking.
5. Where something is already done well, say so and leave it alone.

## You will not

- Edit `.env` files, secrets or API keys, or print their values.
- Deploy, push, merge or publish anything.
- Delete data, or run migrations or scripts against a production database.
- Add tracking, third-party scripts or links to any site I did not ask for.
- Change copy, design or behaviour that this job does not need.
- Print any secret in full.
- Rewrite git history or force-push.
- Rotate keys with providers: I do that.

## Your stack

- Framework: Work out the framework, router and build output from the project files (package.json, lockfiles, framework config) before planning, and say which you found.
- Host: Work out where the site is hosted from the config files (vercel.json, netlify.toml, wrangler config, Dockerfile, fly.toml) and say which you found.

## Steps

### 1. Search the working tree

Search the code and config files for things that look like secrets: API keys (`sk_`, `pk_live`, `AKIA`, `ghp_`, `xox`), private keys (`BEGIN PRIVATE KEY`), connection strings with passwords, webhook signing secrets and tokens in URLs. Report each by file and line, with the value masked. Never print a full secret.

### 2. Search the history

Search the git history for the same patterns (for example with `git log -p` on suspicious files). A secret that was removed in a later commit is still public if the repository is. Recommend a dedicated scanner I can run (gitleaks or trufflehog) rather than installing one yourself.

### 3. Check what reaches the browser

List every environment variable exposed to client code (for example `NEXT_PUBLIC_`, `VITE_`, `PUBLIC_` prefixes) and confirm each is safe to be public. Payment secret keys, database URLs and admin tokens must never be among them.

### 4. Lock it down

Move any hard-coded secret into environment variables, add or update an `.env.example` with placeholder values, check `.gitignore` covers `.env*` files, and make sure secrets are not written to logs or error messages. Give me a list of the secrets I must rotate with the provider, most dangerous first.

## Done means

- [ ] No secret remains in the working tree; config reads them from the environment.
- [ ] I have a ranked list of secrets found in the code or history, to rotate.
- [ ] Every variable exposed to the browser is confirmed safe to be public.
- [ ] `.env` files are ignored, and `.env.example` documents the variables with placeholders.

## Report back

When you finish, give me:

- what you changed, file by file;
- anything you skipped, and why;
- anything I must do by hand (DNS records, dashboards, accounts, deploys);
- how to check each change on the live site.

One-line version

For agents that can read a URL. It fetches this prompt with your settings applied.

Read https://abacklaunch.com/prompts/secrets-scan.md and follow it for this project.

3Check the result

When the changes are live, run these free checks. Add your site URL above and each one opens already running on it.

This prompt will not

  • Edit .env files, secrets or API keys, or print their values.
  • Deploy, push, merge or publish anything.
  • Delete data, or run migrations or scripts against a production database.
  • Add tracking, third-party scripts or links to any site I did not ask for.
  • Change copy, design or behaviour that this job does not need.
  • Print any secret in full.
  • Rewrite git history or force-push.
  • Rotate keys with providers: I do that.

It reads your code first, shows you a plan, and waits for your approval before it changes anything.

What you get

  • A masked list of every secret found, and where
  • Hard-coded secrets moved to environment variables
  • A ranked list of keys to rotate
  • Checks that keep new secrets out

How to use this prompt

  1. 1

    Describe your stack

    Add your site, framework and host. The prompt adapts; blank fields are left for the agent to work out.

  2. 2

    Paste it into your agent

    Open your project in Claude Code, Cursor, Codex, Copilot, Windsurf or Cline, and paste the prompt or the one-line version.

  3. 3

    Approve the plan

    The agent reads your code, shows you a plan with the files it will touch, and waits. Change anything you disagree with.

  4. 4

    Check the result

    When the changes are live, run the free checks below on your site to confirm each fix.

What the agent does

Launching means more eyes on the production site, including people who read JavaScript bundles and public repositories for keys. Find any secret that is committed, logged or shipped to the browser, tell me which ones to rotate, and make it hard for a new one to slip in.

  1. 1. Search the working tree

    Search the code and config files for things that look like secrets: API keys (sk_, pk_live, AKIA, ghp_, xox), private keys (BEGIN PRIVATE KEY), connection strings with passwords, webhook signing secrets and tokens in URLs. Report each by file and line, with the value masked. Never print a full secret.

  2. 2. Search the history

    Search the git history for the same patterns (for example with git log -p on suspicious files). A secret that was removed in a later commit is still public if the repository is. Recommend a dedicated scanner I can run (gitleaks or trufflehog) rather than installing one yourself.

  3. 3. Check what reaches the browser

    List every environment variable exposed to client code (for example NEXT_PUBLIC_, VITE_, PUBLIC_ prefixes) and confirm each is safe to be public. Payment secret keys, database URLs and admin tokens must never be among them.

  4. 4. Lock it down

    Move any hard-coded secret into environment variables, add or update an .env.example with placeholder values, check .gitignore covers .env* files, and make sure secrets are not written to logs or error messages. Give me a list of the secrets I must rotate with the provider, most dangerous first.

Done means

  • No secret remains in the working tree; config reads them from the environment.
  • I have a ranked list of secrets found in the code or history, to rotate.
  • Every variable exposed to the browser is confirmed safe to be public.
  • .env files are ignored, and .env.example documents the variables with placeholders.

Questions

I deleted the key from the code. Am I safe?

Not if it was ever committed to a public repository or deployed. Old commits and cached bundles keep it. Rotate the key with the provider.

Why does the agent not rewrite my git history?

Rewriting history is destructive and affects everyone with a copy. Rotating the key makes the leaked one useless, which is what matters.

Which variables can be public?

Publishable keys designed for browsers (a payment provider's publishable key, an analytics site id) are fine. Anything called secret, private, admin or a database URL is not.

Does this prompt add links to Aback Launch to my site?

No. Nothing in the prompt mentions Aback Launch or asks your agent to link to us. The only exception is an optional badge step, which stays off unless you tick it. Some prompt libraries slip their own link into your codebase by default; we think that should always be your choice.

Which coding agents does it work with?

Claude Code, Cursor, Codex, GitHub Copilot, Windsurf, Cline, and any agent that can read your project and edit files. You can copy it as a plain prompt, save it as a Claude Code skill or a Cursor rule, or add it to AGENTS.md.

Is it safe to run on my real codebase?

The prompt makes the agent read first, show a plan and wait for your approval, and it forbids touching secrets, deploying and deleting data. Still review the changes and run your tests before you deploy, as with any change.

Changelog

  • v1.0First version.

Launch your startup on Aback Launch

Get a launch page that search engines and AI assistants can read, a place in the weekly launch list, and a review by a real person. Free to join.