Penetration testing and source code review answer different questions. A penetration test shows that a route available to the tester can produce an unwanted result in a running system. Code review helps explain why that result is possible, which neighboring branches use the same dangerous mechanism, and where the root cause should be fixed. The saving comes from a shared evidence chain, not from cutting one of the methods.

A buyer needs an engagement in which one object can be traced from an HTTP request to a handler, authorization decision, commit, build, and retest. Without that link, two teams can inspect the same area and still disagree about whether the finding applies to the released version. A general source code security audit helps define code-review boundaries; this article addresses the handoff between the two methods.

Separate Three Kinds of Result

The report should distinguish a proven defect, a potential path, and an unavailable check. A proven defect was reproduced in an authorized environment: the role, request, response, and state before and after are known. A potential path was found in code, but its executability depends on configuration, routing, or an external service. An unavailable check means that the required build, role, data, or integration was not provided.

These categories should not be merged into one vulnerability count. A potential path defines a next test; it does not automatically prove exploitation. An unavailable check limits the conclusion; it is not evidence that the defect is absent. Clear labels prevent both exaggerated risk and premature closure.

Scroll sideways to compare

CategoryMinimum evidencePermitted conclusionNext action
Proven defectEnvironment version, role, request, observed state changeBehavior is confirmed under the stated conditionsLocate the cause and verify the fix
Potential pathCommit, file, function, reachability conditionsCode permits a dangerous path if the named conditions holdTest routing and configuration dynamically
Unavailable checkWhat was needed and why it was missingThe question remains openProvide access or explicitly accept the limitation

Give Every Route a Shared Identifier

Create a route identifier for each critical scenario, such as R-07 export invoice. It connects the entry point, method and URL pattern, role, test object, handler, intermediate calls, and sensitive operation. For microservices, add the queue, message name, or internal RPC.

The penetration tester records the actual request sequence and correlation identifiers. The code reviewer links it to an immutable revision rather than a moving branch. If a framework constructs routes declaratively, the routing table and applied middleware belong in the evidence. This can reveal another entry point into the same function that the dynamic test did not invoke.

Evidence chain from behavior to fix
  1. RouteRecord the role, request, object, and observed state in the agreed environment
  2. CodeLink the handler, controls, and sensitive operation to an immutable commit
  3. BuildConfirm which artifact and configuration are deployed on the test environment
  4. FixIdentify the changed revision and the expected new invariant
  5. RetestRepeat the original scenario and adjacent variants on the new build

Bind the Commit to the Build

A matching release name is insufficient. Record the commit SHA, dependencies and submodules, build profile, artifact identifier or digest, and deployment record. Build provenance can confirm which inputs produced an artifact, but it does not by itself prove that the build process or application is secure.

Before work begins, the environment owner supplies a manifest: repositories and revisions, container versions, security-relevant flags, enabled routes, and external dependencies. The assessors verify it against the test environment. If the running system does not match the supplied code, record a version discrepancy; do not silently transfer a conclusion between different objects.

Divide the Work Without Duplicating It

The two disciplines first model assets, roles, trust boundaries, and critical routes together. The dynamic tester then seeks observable violations, while the code reviewer traces selected paths and their alternatives. Paying both teams to build separate inventories without exchanging results creates effort but weak evidence.

A route card is a practical acceptance unit. It names an owner, security invariant, dynamic tests, manually reviewed code, status, and evidence. A penetration-test finding becomes an entry point for root-cause analysis. A suspicious code branch becomes a specific dynamic test. For web systems, this plan fits naturally into a web application penetration test.

Work Through an Illustrative Scenario

Consider a fictional invoice service. A user downloads a PDF through /invoices/{id}. Testing proves that a viewer can replace id and receive another tenant's invoice. The code shows a shared loadInvoice(id) method: the primary route checks only for a session, while a queue-based export obtains a tenant value from a message and calls the same method.

Only the reproduced web route is a proven defect. The queue remains a potential path until the ability to publish a message and the consumer configuration are confirmed. If the queue is unavailable, that is a separate limitation. The fix moves the tenant check into the shared method and requires the caller's subject context. Retesting covers the original URL, export, direct identifiers, neighboring roles, and negative cases.

This treatment does not inflate one cause into two findings. It records one root cause, one confirmed path, and one variant that still needs verification.

Require Acceptance Evidence

For every route card, the buyer receives the route identifier, original revision and build, result classification, minimal reproduction, root-cause location, fixing commit, and retest build. Secrets and unnecessary personal data are removed, while the identifiers needed for review remain.

Closure must answer two questions: has the original violation disappeared, and does the same dangerous mechanism remain on adjacent entry points? One successful request after the fix cannot answer the second question. A differential code review examines the change, while dynamic retesting confirms the behavior of the new build. The pentest scope planner helps list roles, environments, and integrations before missing access is discovered at the end.

State the Limits of the Conclusion

Even a connected engagement does not prove the absence of every vulnerability. Manual review covers selected routes, and dynamic testing is constrained by the available roles, data, configuration, and time. The report should list untested services, production differences, unavailable roles, and assumptions about the build.

Pentest.red can be an optional next step when one evidence model is needed for both code and the running system. Useful inputs are critical routes, immutable revisions, a build manifest, test roles, and permitted effects. The result should be a reviewable connection between behavior, cause, and retest, never a promise of absolute security.

PENTEST.RED

Discuss pentest scope and pricing

We start by agreeing on systems, access, constraints and the expected evidence.

Prepare your testing scope

Based on in-depth research, edited for clarity and practical use.

PENTEST.RED / RED JOURNAL