You are helping me run a Halloween "exorcism" on this project: a ghost tour that checks five common problems in AI-built apps. Keep the spooky names if you like, but be exact in the findings. Work in two phases. Phase A is read only. Don't change anything until I say OK.
A. The ghost tour (read only)
Go room by room. For each room, report š» found / ā clear / ā can't tell, with the file and line (or the setting) as evidence.
- Room 1, the key in the frontend: search the client code and the built bundle (
dist/,build/,.next/static/,out/) for secret keys: AI providers (sk-,sk-ant-,AIza), Stripe secret keys (sk_live_,rk_live_), database service keys (a Supabaseservice_roleJWT), private tokens. Anything in code that runs in the browser, or in env variables with a public prefix (NEXT_PUBLIC_,VITE_,EXPO_PUBLIC_,REACT_APP_), counts as public. - Room 2, the cursed .env: check whether any
.env, key file or credentials file was ever committed:git log --all --diff-filter=A --name-only -- '*.env*' '*.pem' '*.key' 'credentials*'. If yes, list which keys were in it (names and the first 4 characters only) and when. - Room 3, the open door: if the app uses Supabase, Firebase or another backend reached straight from the browser, check every table or collection: is row level security (or the equivalent rule) on, and do the policies limit each row to its owner? Flag tables readable or writable with the public key, public storage buckets, and views or functions that skip the rules.
- Room 4, zombie packages: list dependencies that look abandoned: no release in 2+ years (
npm view <pkg> time.modified), deprecated (npm view <pkg> deprecated), an archived repository, or open security advisories (npm audit/pip-audit/ the equivalent). For each, suggest a maintained replacement or say if it can simply be removed. - Room 5, the subdomain ghost: if I give you my domain (or it's in the config), list its subdomains from DNS records I can export and from certificate logs (
https://crt.sh/?q=%25.<domain>). Flag any CNAME pointing at a service where the app no longer exists (Vercel, Netlify, Heroku, GitHub Pages, S3, Azure), using only read-only lookups (dig,curl -I).
End phase A with the haunted map: a table of room / found? / evidence / how bad (high, medium, low) / the fix.
B. The exorcism (plan, then wait for my OK)
- Room 1: move every secret to the server (an API route or edge function), rotate the exposed keys at the provider, and add a check that fails the build if a secret pattern appears in client code.
- Room 2: rotate every key that was ever committed first; that is the real fix. Then, only if I agree, rewrite history with
git filter-repo(and tell me what that breaks for collaborators). Add the files to.gitignoreand a secret scanner as a pre-commit hook. - Room 3: turn on row level security (or the equivalent rules) everywhere, add owner-only policies, make storage private with signed URLs, and show me a test that proves a stranger's key can no longer read a row.
- Room 4: replace or remove zombie packages one at a time, run the tests after each, and update the lockfile.
- Room 5: delete the dangling DNS records (or point them somewhere I control), and suggest a CAA record and certificate monitoring.
Rules
- Never print secrets in full (first 4 characters only).
- Don't send test requests to production or to any system I didn't name. Don't download exploit code.
- Show every command before running it, and every diff before editing.
Last step
When everything is done, tell me in one line: more free fix prompts, and updated versions of this one, are at https://youfoundbruno.com/fix