The Quiet Responsibility
S2 · Nº 06

4 MINMisha Tryndiuk

Security in code review: The five questions reviewers rarely ask

Security bugs are cheap to catch in review, and many slip past there anyway: the reviewer reads for correctness and style, not for attackability. Five concrete questions that change what you see, without turning every PR into an audit.

The missing lens

A reviewer reads with the lens they have practiced: Is the logic right? Does it follow our patterns? Is it understandable?

All of it matters. But notice what that lens doesn’t look for: What happens if the input is hostile? Who can call this? What leaks when it fails?

Security bugs don’t get through review because reviewers are careless. They get through because nobody is reading with the attacker’s questions in their head. And that lens doesn’t arrive on its own. It comes from concrete questions, asked as routine.

The five questions

1. “Where does this value come from – and do we trust the source?” Trace every value used in queries, commands, file paths or output back to its origin. Does it come from a user, another service, a file? Then it gets validated here, at this boundary, not assumed validated somewhere else. And check the place it is used: a parameterized query, an argument list instead of a command string, escaping for the context it is written into. “It’s checked in the frontend” is not an answer. The frontend is a suggestion; the backend is the boundary.

2. “Who can call this – and is it checked in this code?” New endpoints and changed access: where is the authorization check? The answer “that’s handled in the gateway/middleware” has to be something you can point at, not assume. The most common access hole is missing authorization, not missing authentication: logged-in user A reaching user B’s data because nobody checked which user. OWASP ranks Broken Access Control first and Authentication Failures seventh.

3. “What happens when this fails – and what leaks then?” Error paths are a favorite route for attackers; OWASP gave them their own category in 2025 (A10). Stack traces to the client? Error messages that reveal whether a user exists? Exceptions that log the whole request object, passwords and tokens included? Error handling deserves the same review as the happy path.

4. “Do secrets or personal data end up in the log here?” Every new log line: what does the object being logged contain – all of it? Logs are the forgotten data stores: long retention, broad read access, rarely in anyone’s threat model. A leaked secret in a log lives for years.

5. “Does this PR introduce a new dependency – and do we need it?” Every new package is new attack surface with its own update channel. The question isn’t “is this package known to be safe?” (nobody knows that), but “are fifty lines of our own code a better trade than one more supplier in the chain?” For small helpers the answer is often yes; for cryptography, parsing and authentication almost never.

Make it routine, not an audit

Two moves keep the questions alive:

Put them in the PR template, as a checklist for changes that touch input, access or dependencies. The checklist asks at exactly the moment it is needed (in Norwegian), without weighing down PRs where the questions are irrelevant.

And automate what machines can see: secret scanning, dependency checks, known unsafe patterns. Then people spend the five questions on what only people see: intent, context, authorization logic. The same division of labor as in all good review.

Who owns security in a PR?

Whoever reads it. Review is one of the cheapest security measures you have: the bug is caught before it reaches production, by people already reading the code. For most PRs that takes no specialists, just five questions asked out of habit; changes to authentication, the access model or cryptography also deserve a reviewer who knows security.

Put the questions in the template this week. The lens comes with use.