How to run a code audit
A code audit answers a simple question: how healthy is this software, and what should we fix first? Done well, it is short, focused and ends with a plan rather than a pile of complaints.
Start with the goal
Agree why you are auditing. Are you about to acquire the product, hand it to a new team, prepare for a security review, or work out why it is slow? The goal decides where you look. An audit with no goal turns into a style critique.
Gather context before reading code
Ask for a short tour of the system, the deployment process, the main user journeys and the parts the team worries about. Look at the repository history to see how often it changes, who changes it and how large the changes are. Check that you can build and run it from scratch. If that takes days, you have already learned something important.
Review in layers
- Security. Check authentication, authorisation, input validation, secrets handling and dependency vulnerabilities. Look for hard-coded credentials and for places where user input reaches the database or the file system.
- Reliability. Look at error handling, logging, backups, monitoring and what happens when a third-party service fails.
- Performance. Find slow queries, missing indexes, unbounded lists and heavy pages. Measure before you guess.
- Maintainability. Assess structure, naming, duplication, test coverage and documentation. The question is how easily a new developer can make a safe change.
- Dependencies. List outdated or abandoned packages and the version of the language and framework in use.
Use tools, then use judgement
Static analysis, dependency scanners and test coverage reports find the cheap problems quickly. They do not tell you what matters. Judgement decides whether a finding is a real risk for this product.
Report in plain language
Group findings by severity and give each one an explanation, evidence and a suggested fix with a rough effort estimate. Lead with the few items that matter most. Include what is good, too: a team deserves to hear what to keep doing.
Finish with a plan
Turn the findings into a sequence: what to fix this week, this quarter and later. Offer to walk the team through the report. The audit is only useful if it changes what happens next.