Old monitors and tangled cables in a dark room
Audit the system, not just the files.

A codebase audit is an independent review of an entire software system: its source code, its database, how it is built and released, and how it behaves while it runs. The result is a written report that tells the owners what they have, what is risky, and what it would take to change it safely.

That differs from a code review, which checks one change, and from a security test, which looks for ways in. A codebase audit answers a business question: can we keep this system, change it, or replace it, and at what risk? For the general version of that question, start with what a code audit is. This article covers the harder case, a legacy code audit on a system nobody on the current team built.

Key takeaways
  • A codebase audit reviews a whole system and reports what is in it, where the risk sits, and what it would take to change it safely.
  • On a legacy system, the audit runs in four reads: what is in there, where the risk concentrates, the data layer, and one real transaction traced end to end.
  • Scanners return thin results on old stacks, so a legacy code audit leans on people reading the code and the database.
  • A good report says plainly what the auditors could not determine, and it stands on its own whether your team or someone else does the fixing.
01

What is a codebase audit?

A codebase audit looks at everything a system is made of, not only the files in one repository. That usually means several applications, a shared database, scheduled jobs, scripts on servers, and integrations with other systems.

Code reviewCode quality auditCodebase audit
ScopeOne changeThe code's maintainabilityThe whole system and its data
Includes the databaseRarelyRarelyYes
Includes runtime behaviorNoNoYes, on selected paths
Typical triggerEvery pull requestA quality concernA decision: keep, change or replace
OutputComments on a changeQuality findingsA ranked report with evidence

A code quality audit is often one part of a codebase audit. The codebase audit adds the data, the runtime and the people who can change each part.

02

How does a legacy code audit work?

A legacy code audit works best in four reads, done in order. Each one narrows where to look next.

1. What is in there

Start with an inventory. Count lines by language, list every repository, shared library, scheduled job and batch script, and find where each application starts. Then list what the system stands on: runtimes, frameworks, databases and operating systems, each with its support date checked on the vendor's own lifecycle page.

Two checks belong here because they can't wait. Search the full version history for credentials, not only the current code, because a password deleted years ago is still in the history. And check the licenses on third-party code, so nobody is surprised during a sale or a funding round.

2. Where the risk concentrates

A list of forty problems at equal weight can't be acted on. This read ranks them.

  • Change hotspots. Files that change often and are also complex are where defects and cost gather. Version history shows which ones.
  • Knowledge held by one person. History also shows which modules only one person has touched, and whether that person still works there.
  • Duplication. When the same logic is copied in five places, one fix becomes five.
  • Tests. Does a test suite exist, does it run today on a clean machine, and would the team ship on a green build?
  • Build and release. Can someone new build the system from what is in source control alone? Record every manual step.

3. The data layer

On many old systems, the database is the most readable part of the estate, and it is where much of the business logic hides. Rules end up in stored procedures, triggers and views, written over years by people who have since moved on.

Catalog the schema, then look at what the data enforces on its own. Are there foreign keys and constraints, or is the application the only thing keeping the data consistent? Look for columns that carry meaning nobody wrote down, such as a status of 9 or a null date that means "never." Our guide to business rule extraction goes deeper on finding rules in code and data.

4. One real transaction, traced end to end

Static reading tells you what code exists. It doesn't tell you what runs. So pick the single path the business cares about most, such as an order, a payment or a claim, and follow it through the running system: screens, services, database calls, jobs and outgoing files.

While it runs, read the database's own performance data to see what is slow and what blocks. Check whether the logs would let someone reconstruct a failure, and whether anyone has tested a restore recently. One path is one path, so the report should name which paths were traced and which were not.

03

Why do code scanners miss so much on old systems?

Code scanners are built for modern stacks. Dependency scanners read package manifests, and many legacy applications have none. Static analysis tools need a grammar for the language, and several older languages and platforms have little or no support. History-based analysis needs version control, and some estates live on a file share with no history at all.

The result is that a scanner can return a short, clean-looking report on a system that is in poor shape. That does not mean the system is sound. It is a sign the tool had little to read. On these systems the audit leans on people reading exported source, the database schema and the running system, and the schedule reflects that reading time rather than a tool's runtime.

If you're unsure what your stack is or how long it has left, our end-of-support guides cover several common platforms, including VB6, Oracle Forms and IBM i.

04

What access does a codebase audit need?

A codebase audit should need read-only access, and nothing more. That keeps it safe to grant.

  • A read-only copy of the source code, including version history where it exists.
  • Read-only access to the database schema. Structure is enough for most checks, without production data.
  • A test or staging environment for the traced transaction, or a supervised session on production.
  • A few hours with the people who maintain and use the system.

An auditor should not test whether a found credential works, run a load test or restore a backup. Those would change the system or carry risk. The report notes them as findings and leaves the action to you.

05

What should a codebase audit report contain?

A useful report ranks findings by what each could cost the business, with the evidence for each one: a file, a setting, a log line or a person who confirmed it. Your own engineers should be able to check every finding.

It also needs one section most reports skip: what we could not determine. Paths not traced, modules that could not be exported, behavior only seen under a load the audit didn't observe. Naming these tells you where the remaining uncertainty is before you spend money on a decision. For the full list of areas to cover, use our code audit checklist.

06

Fix it yourselves, or hand it over?

A codebase audit ends in a choice, and either answer is a good outcome. Your own team can take the report and work through it in order. Or another team can do the work as a separate project, with its own scope and price. The audit is worth paying for in both cases because it tells you what you own before anyone commits to changing it. If a rewrite is on the table, read before you rewrite a legacy system first.

07

What the 30-day assessment covers

Our 30-day assessment is a codebase audit of one system, fixed in scope, at a price agreed before we start. We read the system at rest in the first week and while it runs in the second, then write and check the findings with the people who know the system, and walk the report through with the people who decide.

The report ranks the risks with evidence and says what it would take to fix them. It stands on its own. Your team can act on it, or we can do the work as a separate project. Not sure which system to start with? Score your portfolio first.

Pick a time to talk about the system you'd audit first.