SECURITY ENGINEERING · PART 8 · WRITING SECURE CODE · REVIEW · 119 OF 229

Security Code Review: A Practical Checklist

Security code review is reading code specifically to find security flaws, and it finds things scanners cannot. This episode gives a method: where to focus, a checklist grounded in the OWASP Top 10, how to follow untrusted input to dangerous sinks, reviewing pull requests versus whole codebases, combining human review with tools, and how to give findings developers can act on.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 11

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Focus on trust boundaries and auth
  • follow input to its sinks
  • OWASP checklist
  • tools for breadth, humans for logic

Notes

Where to focus

You cannot read every line with equal attention, so focus where risk concentrates. Trust boundaries, where untrusted input enters the system. Authentication and session handling. Authorization checks, the top source of real bugs. Anything touching money, personal data or secrets. How cryptography is used. The dangerous operations: file uploads, deserialization, and outbound calls that could be SSRF. And new dependencies, which bring in other people's code. If your time is limited, these areas repay it the most.

High-value areas
  • trust boundaries: where untrusted input enters
  • authentication and session handling
  • authorization checks
  • anything touching money, PII or secrets
  • cryptography usage
  • file uploads, deserialization, external calls (SSRF)
  • new dependencies

Follow the data

The core technique is to follow the data. Find the entry points: request parameters, bodies, headers, uploaded files, queue messages. Then trace each piece of untrusted input to where it is finally used, the sink. At the sink, ask the injection-episode questions: is it validated, encoded, parameterised, authorized? The dangerous sinks are SQL, HTML, shell, file paths, redirects, templates and deserializers. Most injection and access-control bugs are found this way, by connecting input to a sink.

The core technique
  • 1. find entry points: request params, bodies, headers, files, messages
  • 2. follow each to where it is used (the sink)
  • 3. ask at the sink: is it validated? encoded? parameterised? authorized?
  • sinks: SQL, HTML, shell, file paths, redirects, templates, deserializers

A review checklist

Carry a checklist, grounded in the OWASP Top 10, and turn each category into a question. Access control: ownership checked, not just role? Injection: queries parameterised and output encoded? Authentication: MFA, sessions and tokens handled right? Cryptography: strong algorithms, no hard-coded keys? Secrets: none in code or logs? Error handling: nothing sensitive leaked, input validated? A written checklist keeps you from reviewing only the bug you happened to think of.

Ask of the change
  • access control: ownership, not just role?
  • injection: parameterised? output encoded?
  • authn: MFA, session, tokens handled right?
  • crypto: strong algorithms, keys not hard-coded?
  • secrets: none in code/logs?
  • errors: nothing leaked? input validated?

PR vs whole codebase

There are two modes. Reviewing a pull request is small and frequent: focus on what changed and what it touches. The useful question is whether this change adds a new entry point, a new dangerous sink, or a new trust decision like an authorization check, and whether each is handled safely. Auditing a whole codebase is large and rare: map entry points and data flows first, then dig into the high-risk areas. Most review time is pull requests, so ask those three questions on every change.

Two modes
  • pull request review: small, frequent; focus on what changed and what it touches (new endpoint? new query?)
  • codebase audit: large, rare; map entry points and data flows first, then dig
  • for a PR, ask: does this change add an entry point, a sink, or a trust decision?

Pair with tools

Do not do by hand what a tool does well. Run static analysis and secret scanning first, and triage their output, covered next episode. Let tools cover mechanical patterns, like a formatted SQL string or a weak hash. Spend human attention on what tools cannot judge: business logic, authorization, cryptography, and chains where small issues combine. Use the diff and the pull request description for context. The division is simple: tools find more lines, humans find the serious bugs.

Human plus automated
  • run SAST and secret scanning first; triage the output
  • let tools cover the mechanical patterns
  • spend human attention on logic, authz, crypto, and chains
  • use diffs and PR description for context
  • tools find lines; humans find the serious bugs

Write good findings

The output of review is findings, and a finding a developer cannot act on changes nothing. A useful one has the exact location, what is wrong and the concrete impact here, how to trigger it, and a specific fix, ideally with a code suggestion. Rate severity honestly, so important things stand out. Mind the tone: comment on the code, not the person, and explain the why so the pattern is learned. Review is also teaching, and that is how a team's security improves.

A useful finding has
  • exact location: file, line, function
  • what is wrong, and the concrete impact here
  • how to trigger it
  • a specific fix, with a code suggestion where possible
  • severity, honestly rated
  • tone: about the code, not the person; teach

Build the habit

Review works best as a routine, not an event. Flag high-risk pull requests for security review, the ones touching auth, data or crypto, rather than every typo fix. Put a short checklist in the pull request template so authors self-review. Have security champions review within their own teams, which scales better than one central reviewer. Let threat model findings tell you what to look for. And feed recurring bugs back into static analysis rules and guidelines, so they are caught automatically next time.

Make it routine
  • security review on high-risk PRs, not every typo fix
  • a lightweight checklist in the PR template
  • security champions review within their teams
  • threat model findings tell you what to look for feed recurring bugs back into SAST rules and guidelines

Common mistakes

Mistakes. Reviewing style and naming instead of security. Reading only the diff without the surrounding context that gives it meaning. Skipping authorization and business logic, the very things tools are blind to. Vague findings with no concrete fix. Rating everything critical, so nothing stands out. Doing by hand what a scanner does well, or conversely ignoring the scanner entirely. And no follow-up to confirm the fix actually landed, so the finding quietly expires unresolved.

Avoid these
  • reviewing style, not security
  • reading the diff without its context
  • skipping authz and logic (where tools are blind)
  • vague findings with no fix
  • rating everything critical
  • doing by hand what a scanner does, or ignoring it
  • no follow-up on the fix

Say it like this

In the interview: I focus where risk concentrates, trust boundaries, auth, data handling and cryptography. My core technique is to follow untrusted input from entry points to its sinks and check validation, encoding, parameterisation and authorization, against an OWASP-based checklist. I run static analysis and secret scanning first for breadth, and spend human attention on logic, authz and crypto, which tools miss. And findings have exact locations, impact and a concrete fix.

In the interview
  • "I focus on trust boundaries, auth, data handling and crypto. I follow untrusted
  • input to its sinks and check
  • validation, encoding, parameterisation and authorization, against an OWASP-based checklist. Tools
  • first for breadth, humans for logic. Findings are specific, fixable."

Interview questions

Q1What is security code review?

Reading source code specifically to find security vulnerabilities, such as injection, broken access control, authentication flaws and misused cryptography. It complements automated scanning by catching logic and authorization issues that tools cannot detect.

Q2Where should a security reviewer focus?

On high-risk areas: trust boundaries where untrusted input enters, authentication and session handling, authorization checks, code touching money, personal data or secrets, cryptography usage, dangerous operations like uploads and deserialization, and new dependencies.

Q3What is the "follow the data" technique?

Tracing each piece of untrusted input from its entry point to where it is used (the sink), and checking at the sink whether it is validated, encoded, parameterised and authorized. It is the most effective way to find injection and access-control bugs.

Q4How does security code review differ from automated scanning?

Automated tools quickly detect known insecure patterns but miss logic, authorization and context. Human review understands intent and business logic, catching broken access control, flawed workflows and subtle vulnerability chains that tools cannot. The two are complementary.

Q5What makes a good security review finding?

An exact location, a clear description of what is wrong and its concrete impact, how to reproduce it, a specific remediation with a code suggestion where possible, an honest severity, and a constructive tone focused on the code rather than the author.

Q6How do you review a pull request for security?

Ask whether the change introduces a new entry point, a new dangerous sink, or a new trust decision such as an authorization check, and verify each is handled safely. Read the surrounding context, not just the diff, and run automated tools alongside.

Q7Which checklist should guide security code review?

One based on the OWASP Top 10 and ASVS, turning categories such as access control, injection, authentication, cryptographic failures, secrets and error handling into concrete questions to ask of the code.

Q8How do you scale security code review across a team?

Reserve dedicated review for high-risk changes, embed a checklist in the pull request template for author self-review, train security champions to review within their teams, and feed recurring findings back into static analysis rules and coding guidelines.