How to prepare a codebase for a secure code review
Before a secure code review, the team does four things. It fixes the scope to named repositories and commits. It grants read access to those repositories and nothing more. It writes down the system's roles and trust boundaries. It names the engineer who will own the fixes. With those in place, the reviewer starts on the code that matters on the first day of the engagement and spends little time working out what the system does.

On this page
- How to prepare a codebase for a secure code review
- Which repositories, branches and commits go in the scope
- What access the reviewer needs
- What to write down about roles and trust boundaries
- Which parts of the code to point the reviewer at
- How to make the dependency tree match what ships
- Which code a test environment never reaches
- Who owns the findings and when the re-review runs
- A checklist to run before the review starts
How to prepare a codebase for a secure code review
Before a secure code review, the team does four things. It fixes the scope to named repositories and commits. It grants read access to those repositories and nothing more. It writes down the system's roles and trust boundaries. It names the engineer who will own the fixes. With those in place, the reviewer starts on the code that matters on the first day of the engagement and spends little time working out what the system does.
Which repositories, branches and commits go in the scope
The written scope names each repository and service, so a review can cover one service, one feature or the whole platform. Give the reviewer a list of the repositories with the branch or commit to be read. Pin a commit. Each finding records the repository, file and line along with the commit reviewed, and a fixed commit keeps those references accurate while the team goes on merging.
Include the infrastructure as code that provisions the environment, whether Terraform, Bicep or equivalent, along with the deployment pipeline definitions. They are read for the same class of issue as the application: network rules opened wider than needed, publicly readable storage and role assignments broader than their job.
For mobile and front-end repositories, include the build configuration. These codebases are read for API keys shipped inside the app, and each API the app calls is read for its authorisation model.
What access the reviewer needs
The reviewer needs read access to the repositories in scope and nothing further. The review takes no production credentials, no write access and no access to the deployment pipeline. Create a read-only account or group limited to the listed repositories, and record the date it is to be removed.
Grant access to the full commit history. A secret scanner reads history as well as the current tree, because a key removed in a later commit stays in the history of every clone, and it stays usable until it is rotated. A squashed export or a copy of the current files hides that history from the review.
What to write down about roles and trust boundaries
The review starts with a threat model of what the system does: its roles, its trust boundaries, and where privileged data or a privileged action sits. That model decides where the reading goes deepest. The team already holds most of it, and a page of notes in the repository or the scoping document gives the reviewer a first version to check against the code.
Where a feature is still at design stage, review can start before code exists. A design-stage engagement delivers a threat model and specific design changes, such as a tenancy model enforced in the database.
What to write down: Each role in the system and what it may do
- What the reviewer uses it for
- Checking every route that reads or writes data against the roles allowed to call it
What to write down: How one customer's data is separated from another's
- What the reviewer uses it for
- Finding whether the tenant boundary sits in the query layer or only in application logic a request can route around
What to write down: Where sign-in, sessions and password reset are handled
- What the reviewer uses it for
- Following a session from issue to expiry, including what happens to it when a role changes or a password is reset
What to write down: Where payments, personal information and admin functions live
- What the reviewer uses it for
- Setting where the reading goes deepest
What to write down: The queues, webhooks and integrations the code accepts input from
- What the reviewer uses it for
- Marking the trust boundaries where untrusted input enters
| What to write down | What the reviewer uses it for |
|---|---|
| Each role in the system and what it may do | Checking every route that reads or writes data against the roles allowed to call it |
| How one customer's data is separated from another's | Finding whether the tenant boundary sits in the query layer or only in application logic a request can route around |
| Where sign-in, sessions and password reset are handled | Following a session from issue to expiry, including what happens to it when a role changes or a password is reset |
| Where payments, personal information and admin functions live | Setting where the reading goes deepest |
| The queues, webhooks and integrations the code accepts input from | Marking the trust boundaries where untrusted input enters |
Which parts of the code to point the reviewer at
For access control, the reviewer takes each route that reads or writes data and finds the check that ties the caller to the object. A route added later without that check is what the reading looks for. The router files, or a generated list of routes with the handler for each, give that work its starting point.
For injection, untrusted input is followed from the request handler through each function it passes to, up to the query, shell call, template or deserialiser that consumes it. Name the data access layer and any module that builds a query, a command or a template from strings.
Name the languages, frameworks and infrastructure as code tools in use, with their versions.
If the team already runs static analysis, dependency scanning or secret scanning, share the latest output. The reviewer reads that output first to choose where the reading starts. A finding reaches the report once a reviewer has read and confirmed it, and issues with no practical exploit path are left out.
How to make the dependency tree match what ships
The dependency tree is read for known vulnerabilities and unmaintained packages, and for whether a build resolves a pinned version or whatever is latest at build time. Commit the lock files for every package manager in use, so the tree the reviewer reads is the tree that ships. Where a build deliberately resolves to the latest version of a package, note it in the scope, and the reviewer reads what that build pulls in.
List the private package registries and internal libraries the build pulls from, and include the internal libraries in scope where they handle authentication, authorisation or data access.
Which code a test environment never reaches
A code review reads code behind feature flags and paths a black-box test does not reach. Name those paths so they sit in the scope by name: features behind flags, admin and support tools, scheduled jobs, and migration and maintenance scripts that run with elevated privilege.
If a penetration test is planned, schedule the review first. With the flaws visible in source fixed, a web application penetration test spends its window on what only a running system shows: configuration, deployment and the paths between services. Where a finding needs proof against a live system, that is scoped separately as penetration testing.
Who owns the findings and when the re-review runs
Each finding comes with its severity, location, impact, evidence and fix, so the engineer who owns the file can fix it without a meeting. Name that engineer before the review starts, along with a second contact for findings in shared code or infrastructure.
Set the date the fixes will be merged. Once they land, each fix is read against its original finding and confirmed to close the issue without opening another, and each finding's status is recorded as closed, partially closed or open. A merge date agreed up front lets the re-review be booked against it.
Teams preparing for ISO 27001 certification can name the person who files the report as evidence for the secure development controls. SaaS vendors can name the person who answers customer security questionnaires.
A checklist to run before the review starts
Our reviewers are engineers who ship and run production software. A director scopes and runs every engagement, and Black Shard holds SMB1001:2026 Gold, issued by CyberCert. To start a secure code review, book a 30-minute scoping call. It costs nothing, and the fixed scope and price reach you in writing before any review work begins.
- [ ] List the repositories and services in scope, with the branch and commit to be reviewed.
- [ ] Include infrastructure as code, pipeline definitions and mobile build configuration.
- [ ] Grant read access to those repositories, with full history, and nothing further.
- [ ] Record the date that access is removed.
- [ ] Write down each role and what it may do, and where one customer's data is separated from another's.
- [ ] Mark the code that handles sign-in, sessions, permissions, payments, personal information and admin functions.
- [ ] Name the data access layer and every module that builds queries, commands or templates from strings.
- [ ] Name the languages, frameworks and infrastructure as code tools in use, with versions.
- [ ] Commit lock files so the dependency tree matches what ships.
- [ ] List feature flags, scheduled jobs, admin tools and scripts a test environment never reaches.
- [ ] Share the latest scanner output, if the team runs scanners.
- [ ] Name the engineer who will receive findings and own the fixes.
- [ ] Set the date fixes will be merged, so the re-review can be booked against it.



