A penetration test attacks your running application from the outside, while a source code review reads the code to find flaws before they ship. They find different problems, so most business apps that handle customer data need both: code review during development and a penetration test before launch and after major changes. If budget forces a choice, the answer depends on whether you own the code and how close you are to release.
This guide is for owners and operations leaders who are paying for a web or mobile app and need to know what security testing to ask for. We explain what each method finds, where each one falls short, and how to put both into your project plan and contract.
What is the difference between a penetration test and a code review?
A source code review is a person, a tool, or both, reading the human-readable code to find security flaws. Reviewers look for things like unsafe database queries, missing permission checks, secrets stored in code, and weak handling of passwords and sessions.
A penetration test treats the finished application as an attacker would. The tester works against a running system, tries to log in where they should not, change data they should not see, and chain small weaknesses into a real breach.
NIST's Secure Software Development Framework (SP 800-218) lists these as two separate practices. PW.7 covers reviewing and analyzing human-readable code. PW.8 covers testing executable code to find vulnerabilities that earlier reviews did not catch. One does not replace the other.
What does a code review catch that a pen test can miss?
Because the reviewer can see the logic, code review is good at finding problems that are hard to trigger from the outside.
- Hidden paths. Admin functions, old endpoints, or test code that no menu links to.
- Permission logic. Places where the code checks that a user is logged in but not that the record belongs to them.
- Hardcoded secrets. API keys and passwords written into the code or config files.
- Risky patterns at scale. The same unsafe query copied into 40 places, which a tester might only hit once.
The OWASP Web Security Testing Guide lists accuracy and completeness as strengths of source code review. It also lists the limits. It needs skilled, security-aware reviewers. It can miss issues in compiled third-party libraries and problems that only appear at runtime. And the code that gets deployed is not always the code that was reviewed.
What does a pen test catch that a code review can miss?
A penetration test checks the system as it actually runs in its environment. That catches problems that do not live in your own code.
- Configuration mistakes. Open storage buckets, verbose error pages, or debug modes left on in production.
- Infrastructure and hosting gaps. Exposed admin panels, weak TLS settings, or services running that nobody meant to expose.
- Chained attacks. Two low-risk issues that combine into a serious one once a tester strings them together.
- Third-party pieces. Login providers, payment widgets, and plugins as they behave in your setup.
OWASP also notes the main weakness: when pen testing is the only security activity, it happens too late. The guide says it "should not be considered as the primary or only testing technique." Problems found a week before launch are the most expensive ones to fix.
Which one do we recommend for your app?
For most business applications, we recommend both, at different times. Here is how we think about it:
- You are building custom software and own the code. Ask for code review on every change during the build, with automated scanning plus human review for login, payments, and permissions. Then run a penetration test on the staging system before launch.
- You are buying an off-the-shelf product. You usually cannot see the code. Ask the vendor for a recent independent penetration test summary and how they fixed the findings.
- The app is already live. Start with a penetration test to find what is exposed today, then add code review to the change process so new code does not add new holes.
- The app handles health, payment, or personal data. Plan for both and repeat the pen test after major releases. Your industry rules may set their own testing requirements, so confirm them with your compliance lead.
When should each test happen in the project?
OWASP's guidance is to test across the whole development life cycle and put more weight on the early stages. In practice, we plan it like this:
- Design. A short threat model: what data the app holds, who might want it, and which features are most at risk.
- Build. Automated code scanning on every change, plus human review of high-risk code. NIST's minimum standards for developer verification (NISTIR 8397) also list checks for hardcoded secrets and included software components.
- Before launch. A penetration test against a staging system that matches production, with time in the plan to fix findings and retest.
- After launch. A repeat pen test after major changes, and code review that never stops.
We cover the wider testing picture in our guide on custom software testing: what to require from a vendor.
What should you require from your development vendor?
Put security testing in writing before the project starts. If you are preparing a proposal request, add these items to your software development RFP:
- Who reviews code, how often, and which tools they use.
- Which features get mandatory human security review.
- Whether a penetration test is included, who performs it, and whether that tester is independent from the developers.
- How findings are tracked, ranked, fixed, and retested before launch.
- That you receive the test summary and fix log, not just a statement that testing was done.
If your vendor uses AI coding tools, ask how that code is reviewed. We list the questions to ask in Does your software vendor use AI?
Frequently asked questions
No. A vulnerability scan is an automated check for known issues. A penetration test is a person actively trying to break in, combining weaknesses the way a real attacker would. Scans are useful between tests but do not replace them.
Not fully. Automated scanners are fast and catch common patterns, but they miss business logic problems such as a user being able to view another customer's records. Use tools on every change and people on the highest-risk code.
Before first launch and after major changes are the minimum. Apps that handle sensitive data often test on a regular schedule as well. Check whether your industry or your customers' contracts set a specific frequency.
Ideally a tester who did not build the app, so they come in without assumptions. Ask for their scope, methods, and a written report with ranked findings and retest results.
Sources
- NIST SP 800-218: Secure Software Development Framework (SSDF) Version 1.1
- NIST SP 800-218 full text (practices PW.7 and PW.8)
- OWASP Web Security Testing Guide v4.2: Introduction
- NISTIR 8397: Guidelines on Minimum Standards for Developer Verification of Software
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment

