Fix · Problems with AI tools
The AI put my key or password directly in the code
UrgentSecurity
What you may see
- I see a long key text inside a file the AI wrote
- The AI asked me to paste my API key into a file
Most likely cause
When it is told "use my key", a tool may write it into the code, from where it can leak to GitHub and to every visitor.
Check first (about two minutes)
- Search the project for the first characters of the key (if it was never pushed, you are safe to continue the fix).
- Was the file ever pushed or deployed?
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Find every secret-looking value in the code (keys, tokens, passwords, connection strings) and list them by file and line, without printing the values.
- Move each into an environment variable read by server code, add a sample file with names only, and make sure the real file is ignored by Git.
- If any of them was ever pushed or deployed, tell me to rotate that key now (see the entry for a key in GitHub).
- Add a check (a script or hook) that fails when a secret-looking text is staged for commit.
Do not do this
- Never type a real key into an AI chat so it "can use it".
- Do not print or repeat any secret in your answers.