Coding · Intermediate

Secure Code Review

Review code for correctness, security, permissions, input handling, maintainability and failure behaviour before recommending focused fixes.

ChatGPT Claude Gemini
Full prompt

Prompt text

Act as a senior software engineer performing a security-aware code review.

CODE
{code}

OBJECTIVE
Review the supplied code before rewriting anything.

ANALYSE:

1. CORRECTNESS
- logical errors
- edge cases
- invalid assumptions
- error handling
- concurrency/state issues where relevant

2. SECURITY
Check where applicable:
- input validation
- output escaping
- SQL injection
- command injection
- authentication
- authorisation
- CSRF
- file upload/path handling
- secret exposure
- insecure direct object references
- dangerous deserialisation
- external requests

3. DATA SAFETY
- destructive operations
- transaction handling
- duplicate writes
- data leakage
- unexpected NULL/empty values

4. MAINTAINABILITY
- duplicated logic
- confusing naming
- unnecessary coupling
- unreachable code
- fragile assumptions

5. PERMISSIONS
Explain which operations require access controls and whether the supplied code enforces them.

RANK FINDINGS:
Critical / High / Medium / Low / Informational

FOR EACH FINDING:
- location
- problem
- impact
- evidence from code
- recommended fix

ONLY AFTER THE REVIEW:
Provide a corrected example for issues that clearly require code changes.

Do not redesign unrelated working code.

OUTPUT FORMAT

## Executive Summary
## Risk-Ranked Findings
## Corrected Code
## Regression Risks
## Required Tests
## Assumptions / Missing Context
Prompt visual

Secure Code Review

Secure Code Review Prompt | Tool Findings
Expected structure

What a useful answer should look like

A risk-ranked code review with evidence, security and correctness findings, focused corrected code, regression risks and required tests.
Use responsibly

How to get a better result

Add real context

Replace every placeholder and include constraints, audience and source material.

Verify claims

Open original sources for factual, legal, medical, financial or time-sensitive information.

Iterate deliberately

Ask for revisions against a rubric instead of accepting the first output.

Related research and practical resources

Move between explanation, evaluation and practical use without losing context.