Are your logs leaking passwords and keys? A 10-minute check for AI-built apps
When something breaks, AI-written code often prints everything to help you debug: the request body, the headers, the user object, the API response. That output lands in your logs. If your logs hold passwords, tokens or k
When something breaks, AI-written code often prints everything to help you debug: the request body, the headers, the user object, the API response. That output lands in your logs. If your logs hold passwords, tokens or keys, anyone who can read them can use those secrets. And logs are read by more people and tools than you think.
Who is at risk
Anyone whose app uses console.log, a logging service, an error tracker or a host's log viewer. That is nearly every app. The risk grows when you log whole objects instead of chosen fields.
What tends to leak
- Login and signup request bodies, with plain passwords.
-
Authorizationheaders and cookies, which hold session tokens. - API keys printed at startup "to check they loaded".
- Full error objects from payment, email or AI providers, which can echo keys back.
- Personal data like emails, addresses and phone numbers.
The 10-minute check (your own app only)
- Search your code for
console.log,print(andlogger.calls near login, signup, payments and webhooks. - For each one, ask: could this line print a password, token, key or personal data?
- Use your app as a test user, then open your host's log viewer or log service. Scan the last hour for strings that look like tokens,
Bearer,password,sk_oreyJ. - Check your error tracker (if you use one) for request bodies and headers it captured.
- Check who can read the logs. Team members, contractors and third-party tools all count.
What to fix
- Log chosen fields, not whole objects. Log a user id and an event name, not the user record.
- Never log request bodies or headers on auth and payment routes.
-
Redact by default. Most logging and error tools can mask fields like
password,tokenandauthorization. - Remove "print the key" debug lines, then rotate any key that was ever printed in a shared log.
- Set a short log retention and limit who can read logs.
A prompt you can paste into your AI builder
"Review every logging statement in the app. Remove any that print request bodies, headers, cookies, tokens, API keys, passwords or full user objects. Log only an event name and a user id. Add redaction for password, token and authorization fields in the logger and error tracker."
What a scanner can and cannot tell you
An outside scan cannot see your server logs. It can only tell you what a visitor can see, like a key in your public JavaScript. Logs need the check above, run from inside your own setup.
I work on ProofForge. The free scan covers the outside view and says plainly what it could not check.
Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.