Secure Code Review: A Checklist for Everyday Pull Requests
A secure code review checks that each change enforces who can do what, handles untrusted input safely, keeps secrets out of code, and doesn't add risky dependencies. Reviewers don't need to be security experts to catch most issues if they use a short, consistent checklist.
Use the list below on every pull request that touches authentication, data access, external input or infrastructure, and let automated tools cover the routine checks.
Vendors Covered in this Article
Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.
What should a reviewer ask on every pull request?
Before reading line by line, ask five questions about the change:
- Who can trigger this code? Anonymous users, signed-in users, admins, another service?
- What data does it touch? Customer data, credentials, payment details, logs?
- What does it trust? Anything from a request, a file, a webhook or a third-party API is untrusted until validated.
- What changes if it fails? Does it fail open (grants access) or closed (denies)?
- What did it add? New dependencies, new endpoints, new permissions, new environment variables.
If a pull request is too large to answer these, ask the author to split it. Large diffs invite skimming, while five small ones get read.
Authentication and authorization checks
Broken access control is the flaw reviewers most often miss, because the code works for the happy path. Check:
- Every endpoint has an authorization check, not only a login check. Being signed in doesn't mean being allowed.
- Object-level checks. When a request names an ID, the code verifies the caller owns or may access that record, not just that the ID exists.
- Tenant boundaries. Queries include the tenant or organization filter, and it comes from the session, not the request body.
- Role logic is centralized. Scattered role checks drift. Prefer a shared policy function.
- Sensitive actions are re-verified. Changing email, exporting data or altering permissions may need fresh confirmation.
A quick test: ask 'what happens if I change this ID to another customer's?'
Input, output and secrets: the common injection points
Trace untrusted data from where it enters to where it's used:
- Queries. Parameterized queries or an ORM's safe methods, never string-built SQL or shell commands.
- Output. Data rendered into pages is escaped by the framework. Look closely at anywhere raw HTML is inserted.
- File and URL handling. Uploaded filenames, paths and user-supplied URLs are validated. Server-side requests to user-provided addresses can reach internal services.
- Deserialization and templates. Untrusted data isn't fed into unsafe parsers or template engines.
- Secrets. No keys, tokens or passwords in code, tests, config samples or logs. If one appears, treat it as leaked and rotate it.
- Cryptography. Standard libraries, not homemade schemes. Passwords use a slow, salted hashing function, and random tokens come from a secure generator.
Dependencies, logging and error handling
Check what the change brings in and what it leaves behind:
- New packages. Is it maintained, is it needed, and does its license fit? A scanner such as Snyk or GitHub Advanced Security can help surface known vulnerabilities and license problems during review. Confirm in a demo how each fits your repositories and workflow.
- Fix timelines. CISA's federal directives required agencies to patch critical vulnerabilities on internet-facing systems within 15 days and high ones within 301. Set your own deadlines and enforce them in review.
- Errors. Messages shown to users don't reveal stack traces, queries or internal names.
- Logs. Security events (login failures, permission changes) are logged, and sensitive values (passwords, tokens, full card numbers) never are.
- Configuration. Debug modes and permissive settings aren't shipped to production.
How do you build the checklist into the workflow?
Checklists that live in a wiki are ignored. Put this one where reviewers work:
- Add a short security section to the pull request template with the five questions and the checks above as tick boxes.
- Automate the mechanical checks: secret scanning, dependency scanning and static analysis on every pull request, so humans review logic.
- Require a second reviewer for changes to authentication, payments and infrastructure.
- Keep a short list of past findings, so reviewers learn from real mistakes.
Code written with AI assistants deserves the same scrutiny, and often more; the AI-generated code security review checklist covers what to look for. For help choosing scanners, see the scanner comparison.
What Good Looks Like
Every pull request answers the five security questions, automated scans run before review and sensitive changes get a second reviewer.
Building The Capability (5-Stage Skill Ladder)
How to Get Started
Disclosure: We may earn a commission if you buy through some links on this page. It doesn't change what we recommend.
Fits when you want dependency and code findings surfaced during review; confirm in a demo how it fits your repositories.
Fits when your code already lives on GitHub and you want scanning in the same pull request workflow; confirm what your plan includes.
Frequently Asked Questions
What is a secure code review?
It's a review of code changes specifically for security flaws, such as missing authorization, unsafe input handling, leaked secrets and risky dependencies. It can be done by teammates using a checklist, supported by automated scanners in the pull request workflow.
Who should perform secure code reviews?
Any engineer can do the routine review with a checklist. For sensitive areas such as authentication, payments or cryptography, involve someone with security experience. Rotate reviewers so knowledge spreads across the team.
Can automated tools replace manual secure code review?
No. Tools catch known patterns like vulnerable packages, hardcoded secrets and some injection flaws. Humans catch logic errors such as missing authorization checks and abuse cases. Use tools for the routine and reviewers for design and business logic.
How long should a secure code review take?
For a small change, a few extra minutes with the checklist. Keep pull requests small so reviews stay thorough. If a change is too large to reason about, split it, because large diffs tend to get skimmed.
Sources
Where we quote a benchmark, we show its source. Other figures in this guide are estimates or general guidance, so check them against your own numbers.
- Security patch remediation SLAs (CISA federal mandates, used as industry norm). CISA Binding Operational Directives 19-02 and 22-01 (CISA briefing hosted at NIST CSRC), 2022.
Related Guides
Reviewing AI-Generated Code for Security: A Practical Checklist
Is AI-generated code secure? A review checklist covering hallucinated packages, missing authorization, unsafe input handling, secrets and scanning.
Snyk vs Veracode vs GitHub Advanced Security: AppSec Tool Comparison
Compare Snyk, Veracode, and GitHub Advanced Security: SAST, SCA, container security, secret scanning, automated remediation, and SOC 2 compliance.
Setting Up AI Code Review the Right Way
A rollout order for AI code review: what it catches well, where it misses real risk, and which pull requests still need a second human.
Auditing Your AI Code Review Tool for What It's Actually Missing
A thirty-minute audit for finding out what your AI code review tool catches, what it misses, and where it's training your team to stop reading diffs.
Rolling Out AI Code Review Without Drowning Reviewers in Noise
A staged rollout for AI code review tools: shadow mode first, then advisory comments, then a required check, so it earns trust instead of getting muted.
Where AI Code Review Catches Real Bugs, and Where It Misses
A clear-eyed look at what automated code review reliably catches in pull requests, where it still misses real defects, and how to route the rest to people.