Secure source code review

When you need to know where an access check is missing or why sensitive data ends up in a log, inspect the implementation. A review can start with one part of the codebase. Pin down the modules and revision so the findings point to the code your team can change.

Discuss a code review

For the first conversation

  • The languages and frameworks, with an approximate module count.
  • Which components take priority and which revision to review.
  • Repository access constraints and any special build requirements.

Leave passwords, tokens, source files, and customer data out of the contact form.

Where a review can look

Area What is examined
Authorization in code Where the implementation decides who can read data and who can run a restricted operation.
Data handling How the application accepts, validates, stores, and logs sensitive information.
Configuration and secrets Unsafe defaults and credentials or keys kept in source files.
Dependencies Libraries used by the code in scope, if the engagement includes a dependency review.

The system owner must authorize the work. The written scope sets out what can be assessed.

Testing reference: OWASP Code Review Guide, OWASP Application Security Verification Standard (ASVS).

What a finding looks like

Sample report · all data is fictional

WS-CONTOH-03

Report export endpoint does not check who owns the data

Missing Object-Level Authorization

Risk rating
Medium CVSS 3.1: 6.5 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Affected
src/reports/export.controller.ts:41

Note: For management: the same data, one identifier away.

Summary

The export handler reads a report by the identifier supplied in the request. The session is validated earlier in the chain, but the report is never checked against the caller.

Evidence

export async function exportReport(req, res) {
  const id = req.params.reportId;
  const report = await this.reports.findById(id);
  return res.json(report);
}

The identifier comes straight from the request.

Note: For developers: the file and the line that needs the check.

Impact

Any signed-in user can export reports belonging to other users.

Recommendation

Scope the query to the caller, or assert ownership before the response. Add the same assertion wherever a report is read by identifier.

Note: For your team: the ownership check, and its other call sites.

Status

Open

Note: Re-tested through the endpoint, not by reading the patch.

This sample is fictional. The system, organisation and data were invented for illustration and do not come from client work. Download the full sample report (PDF) ↗

The source code review report

Report section Contents
Risk summary Which components are affected and how their weaknesses could affect the application.
Findings tied to a revision The version under review and the file or module that helps explain each issue.
Recommended changes What the team can change in the code, configuration, or dependency, depending on the finding.

Download the sample report (PDF) ↗ A fictional scenario, not a client report.

Questions before booking

What determines the price of a code review?

The quote depends on the number of components, how they interact, the languages and frameworks they use, and the depth of review. Line count alone does not tell you how much code has to be traced.

Should we choose a code review or a pentest?

A pentest assesses a running system. A code review works from the implementation and points developers to the source of a weakness. If your project needs both, define each scope separately.

Do you need access to the full repository?

Not to start the discussion. Describe the repository structure and the modules you want reviewed. Agree on a revision, access boundaries, and a secure way to share code before work starts.

Which languages and frameworks can you review?

Tell us the languages, framework versions, and any build requirements. Confirm support and coverage limits for each component in the written scope.

Discuss the code your team wants reviewed

Send the system you want tested, roughly how big it is, and your target date.