Tabnine Security Review Prompt Template
You get the real vulnerabilities in the code ranked by severity, each with how it could be exploited and a specific fix. This version is set up for Tabnine: select the code you're asking about first, and name the files and functions involved. Below you'll find the prompt, how to run it in Tabnine, a worked example and answers to common questions.
Do a security review of the code below. ## Context Language and framework: [e.g. Python, Flask] What this code does: [e.g. public endpoint that looks up a user by name] Who can reach it: [e.g. anyone on the internet, logged-in users only, internal only] Data it handles: [e.g. emails, payment info, none sensitive] ## Code [paste the code] ## Instructions - Check for injection, broken access control, exposed secrets, unsafe deserialization, missing input validation and sensitive data leaks. - For each finding, explain how an attacker would exploit it in one or two sentences. - Show the fixed code for each finding. - Do not list generic advice that does not apply to this code. - Say clearly if you cannot judge something without seeing more code (e.g. auth middleware). ## Output format Findings grouped as High, Medium, Low. Each with: issue, line, exploit, fix. Context - Files involved: [list the files, or reference them in the chat] - How I build and test: [e.g. npm test]
How to use this prompt
- 1
Open Tabnine
Open Tabnine Chat in your IDE and paste the prompt.
- 2
Give it context
Select the code you're asking about first, and name the files and functions involved.
- 3
Review and iterate
Ask follow-ups in the chat; insert code only after you have read it.
Working in Tabnine
- •Tabnine's inline completion is for code as you type. Use the chat for prompts like this one.
- •Teams often run Tabnine with privacy controls, so paste only the code needed for the question.
- •Ask for one change at a time and say what the code must keep doing.
Worked example
What you give it
Framework: Python, Flask, sqlite3
What it does: returns a user's id and email by name.
Who can reach it: anyone on the internet.
@app.route("/user")
def get_user():
name = request.args.get("name")
row = db.execute("SELECT id, email FROM users WHERE name = '" + name + "'").fetchone()
return {"id": row[0], "email": row[1]}What a good answer looks like (shortened)
High: SQL injection (the db.execute line)
Exploit: a request with name set to ' OR '1'='1 returns the first user, and crafted UNION payloads can read other tables.
Fix: use a parameterized query.
row = db.execute("SELECT id, email FROM users WHERE name = ?", (name,)).fetchone()
Medium: email exposed with no authentication
Exploit: anyone can collect user emails by guessing names.
Fix: require login and return email only to the account owner or an admin.
Low: unhandled missing user
If no row matches, row[0] raises and returns a 500 that may leak a stack trace in debug mode.
Fix: if row is None: return {"error": "not found"}, 404Tips for better results
- •Fill in "Who can reach it" and "Data it handles" honestly. They decide whether a finding is High or Low.
- •Paste the auth middleware or permission checks if they live elsewhere. Otherwise the AI will rightly flag access control as unknown.
- •Tabnine's inline completion is for code as you type. Use the chat for prompts like this one.
- •Avoid this: Treating an AI review as a full audit and skipping dependency scanning, auth review and testing by a person.
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Threat model first
Add this line to Instructions: Before reviewing, list the three most likely attackers and what each would want from this code.
Dependency check
Add this section: ## Dependencies [paste package.json or requirements.txt] and flag packages that are commonly misconfigured or need pinning.
Checklist output
Change Output format to: A table with columns: check, pass or fail, line, fix.
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;secreview in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;secreview.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
Is an AI security review enough before launch?
No. It is a useful first pass that catches common mistakes like injection and missing auth checks. Sensitive systems still need a dependency scan, a review by someone with security experience, and testing.
How much code should I include?
The function or file in question plus any error message. More context isn't always better; irrelevant code can pull the answer off course.
Is it safe to paste code into an AI for a security review?
Remove secrets, keys and customer data first, and follow your company's policy on sharing source code. The review works just as well with placeholder values.
How do I reuse this prompt without copying it every time?
Click Add to Retext to save it as a snippet. Then type ;secreview in any Mac app, including your AI tool, and the full prompt is pasted in.
Related Templates
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.