Security code review for common vulnerabilities
A ChatGPT prompt for a security code review: find injection, auth, secrets and input-handling issues in your code, ranked by risk with fixes.
- Published
- Works with
- ChatGPT, Claude and Gemini
- Level
- Advanced
Security problems often hide in ordinary code: a query built from user input, a missing permission check, a secret in a config file. This prompt reviews your own code for common vulnerability types (based on categories like the OWASP Top 10), ranks findings by risk, and suggests fixes with code, so you can catch issues before they ship.
The prompt
Act as an application security engineer. Review my code for security issues.
Language and framework:
What this code does and who can reach it: [CONTEXT, e.g. public API endpoint, admin-only page, internal script]
How users are authenticated and authorized:
Code (remove real secrets first):
Do this:
1. Check for: injection (SQL, command, template), broken access control, authentication and session issues, hard-coded secrets, unsafe input handling and output encoding (XSS), insecure deserialization, file upload and path issues, SSRF, weak cryptography, sensitive data in logs, and risky dependencies if visible.
2. For each finding: location, issue, how it could be exploited (in general terms), severity (critical/high/medium/low) with reasoning, and a fixed code example.
3. List things you can't judge from this code alone (configuration, infrastructure) that I should check.
4. Suggest 3 automated checks or tests to prevent these issues in future.
Don't report style problems as security issues. Say if you find nothing serious.
How to use it
- Review your own code only, and strip real keys and passwords before pasting.
- Fix critical and high findings first and add a test for each.
- Use automated scanners too; an AI review does not replace a professional security audit.
Tips
- Run a general review with the senior code review prompt.
- Add tests for each fix with the write unit tests prompt.
Frequently asked questions
What does this prompt do?
A ChatGPT prompt for a security code review: find injection, auth, secrets and input-handling issues in your code, ranked by risk with fixes.
Which AI tools does it work with?
It is written for ChatGPT, Claude and Gemini. It also works in other AI tools that accept text prompts, with small changes.
What do I need to fill in?
3 blanks: language and framework; auth setup; code. Click each blue blank on the page, type your details and press Copy prompt.
Is this prompt free to use?
Yes. You can copy and use it for personal and commercial work.