AI Pentesting

Penetration Testing Scope of Work: How to Define It (2026)

Amartya | CodeAnt AI Code Review Platform
Sonali Sood

Founding GTM, CodeAnt AI

A penetration test is only as good as its scope. Define it too narrowly and the tester validates a login page while your real attack surface, the GraphQL API, the multi-tenant boundary, the CI/CD pipeline, goes untested. Define it too vaguely and you get mid-engagement change orders, a blown budget, and a report that does not reflect what an attacker can actually reach.

The scope of work is the document that prevents both failures. It defines exactly what will be tested, how, when, and under what rules, so the engagement produces findings you can act on and evidence an auditor will accept, without surprises on either side.

This guide explains what a penetration testing scope of work actually is, the elements a real one must contain, how to define in-scope and out-of-scope boundaries for a modern architecture, and how to write the rules of engagement that keep testing safe and productive. It is the practical, developer-facing version, not a legal template.

Why Scope of Work Is Make-or-Break for Pentests

The scope of work is not paperwork. It is your control surface for cost, coverage, and operational safety. Get it right and you validate real exploitability against the critical assets that matter, inside budget and compliance timelines. Get it wrong and you either waste tens of thousands of dollars rediscovering issues your scanners already flagged, or you miss the exploitable Broken Object Level Authorization chain exposing millions of customer records because your API gateway was never in scope.

The reason this matters more in 2026 is that modern attack surfaces do not fit the "test annually" model. You are shipping microservices weekly, your GraphQL endpoints auto-generate from schema changes, your cloud infrastructure mutates with every Terraform apply, and your authentication flows span OAuth providers, API keys, JWT refresh logic, and session cookies, all of which need adversarial validation beyond static analysis. A scope frozen to last year's architecture tests a system that no longer exists.

The stakes stack up across four fronts:

  • Cloud-native architectures mean your attack surface now includes S3 bucket policies, IAM privilege chains, container escapes, and service-mesh configuration, none of which a network-diagram scope captures.

  • API-first development creates hundreds of endpoints where a single missing authorization check leaks a database, so the API layer has to be scoped endpoint by endpoint, not as "the API."

  • Continuous deployment introduces vulnerabilities between annual tests. Code tested in January can be 40% different by March, and the scope has to account for that drift.

  • Compliance pressure (SOC 2, PCI DSS 11.4, HIPAA) requires evidence that testing covered the right assets at the right depth, which a vague scope cannot demonstrate to an auditor.

The difference between informed scoping and "test everything we can afford" is stark. One finds the exploitable GraphQL Broken Object Level Authorization that could exfiltrate hundreds of millions of records. The other burns the budget running reconnaissance against tools your team already completed.

What a Penetration Testing Scope of Work Actually Is

A scope of work (SOW) is the agreement that defines the boundaries and rules of a penetration test. It answers four questions before anyone touches a system: what gets tested, how it gets tested, when, and under what constraints. It sits between the higher-level RFP, which is how you solicit and select a vendor, and the contract, which is the legal and commercial agreement. The SOW is the technical heart of the engagement.

A good SOW does three jobs at once. It protects you, by ensuring the vulnerabilities that matter actually get tested rather than a convenient subset. It protects the tester, by authorizing exactly what they are permitted to do, which matters legally because unauthorized testing is a crime. And it protects the relationship, by removing the ambiguity that turns into disputes when a tester discovers an asset nobody scoped.

The recognized methodologies build scoping in as the first phase for exactly this reason. The Penetration Testing Execution Standard (PTES) opens with pre-engagement interactions, NIST SP 800-115 begins with planning, the OWASP Web Security Testing Guide starts with information gathering, and OSSTMM opens with defining the engagement's rules and channels. Every credible standard treats the boundary as the thing everything downstream depends on, because a test that is scoped wrong cannot be salvaged by testing hard.

The Essential Elements of a Scope of Work

A complete SOW has seven elements. Missing any one of them is where engagements go wrong.

1. Objectives and success criteria. Why the test is happening, compliance evidence, risk reduction, pre-launch validation, and what success looks like in measurable terms. "Prove whether a standard user can reach admin functions" is a success criterion. "Find vulnerabilities" is not.

2. In-scope assets. The exact systems, applications, APIs, and networks to be tested, named specifically. This is the element teams get wrong most often, covered in detail below.

3. Out-of-scope items. The systems, techniques, and third parties explicitly excluded, which is what prevents both accidental damage and scope disputes.

4. Testing approach. Black box, gray box, or white box, and what access the tester receives. The choice decides what the test can even find: black box reaches infrastructure exposure and unauthenticated flaws, gray box adds the authenticated attack chains that matter most (Broken Object Level Authorization, IDOR, privilege escalation, SSRF), and white box adds the deep logic and code-level flaws that need full source. We cover the three depths in Black Box vs White Box vs Gray Box Penetration Testing, and for most modern applications gray box is the right default because it mirrors a realistic attacker with a compromised account.

5. Rules of engagement. Testing windows, rate limits, prohibited actions, escalation paths, and break-glass procedures. Detailed below.

6. Deliverables. The report format, the evidence required per finding (a working proof-of-concept, CVSS scoring, remediation guidance), and the compliance mapping expected.

7. Timeline and logistics. The testing window, key contacts, the retest policy, and how findings will be communicated during the engagement rather than only at the end.

A Worked Example: A Filled-In Mini-SOW

Every element above is a rule. Here is what they look like assembled into one short, usable scope of work for a fictional company, Northwind Health, a HIPAA-regulated telehealth SaaS. Lift the structure and swap in your own specifics.

PENETRATION TESTING SCOPE OF WORK, Northwind Health Inc.

1. Objectives
Risk-reduction testing of the new provider-messaging API plus annual
HIPAA/SOC 2 validation. Success = a proven answer to "can a provider
reach another tenant's patient data?" with SOC 2 CC6.1 and
HIPAA 164.312(a)(1) control mapping.

2. In scope
- Web app: app.northwind.health (React), 52 routes, 4 roles
  (patient, provider, admin, billing)
- REST API: api.northwind.health/v3, 94 endpoints
- GraphQL: provider-messaging service, 18 queries, 11 mutations
- Auth: Okta OIDC + JWT
- Cloud: AWS (EKS, RDS Postgres, S3 attachments), IAM in scope
- Multi-tenant: cross-tenant PHI access testing required

3. Out of scope
Marketing site, the Twilio and e-prescribing third-party platforms,
DoS/stress testing, social engineering, physical security.

4. Approach
Code-aware gray box. Credentials for all 4 roles, OpenAPI 3.0 and
GraphQL schemas, read access to the messaging service source,
read-only AWS console.

5. Rules of engagement
Production testing Saturdays 2-6 AM ET, 100 req/sec cap, WAF blocks
at 500 req/5 min/IP. Staging 24/7 with anonymized data. MFA disabled
on the five provided test accounts. Break-glass contact: [name, phone]

PENETRATION TESTING SCOPE OF WORK, Northwind Health Inc.

1. Objectives
Risk-reduction testing of the new provider-messaging API plus annual
HIPAA/SOC 2 validation. Success = a proven answer to "can a provider
reach another tenant's patient data?" with SOC 2 CC6.1 and
HIPAA 164.312(a)(1) control mapping.

2. In scope
- Web app: app.northwind.health (React), 52 routes, 4 roles
  (patient, provider, admin, billing)
- REST API: api.northwind.health/v3, 94 endpoints
- GraphQL: provider-messaging service, 18 queries, 11 mutations
- Auth: Okta OIDC + JWT
- Cloud: AWS (EKS, RDS Postgres, S3 attachments), IAM in scope
- Multi-tenant: cross-tenant PHI access testing required

3. Out of scope
Marketing site, the Twilio and e-prescribing third-party platforms,
DoS/stress testing, social engineering, physical security.

4. Approach
Code-aware gray box. Credentials for all 4 roles, OpenAPI 3.0 and
GraphQL schemas, read access to the messaging service source,
read-only AWS console.

5. Rules of engagement
Production testing Saturdays 2-6 AM ET, 100 req/sec cap, WAF blocks
at 500 req/5 min/IP. Staging 24/7 with anonymized data. MFA disabled
on the five provided test accounts. Break-glass contact: [name, phone]

PENETRATION TESTING SCOPE OF WORK, Northwind Health Inc.

1. Objectives
Risk-reduction testing of the new provider-messaging API plus annual
HIPAA/SOC 2 validation. Success = a proven answer to "can a provider
reach another tenant's patient data?" with SOC 2 CC6.1 and
HIPAA 164.312(a)(1) control mapping.

2. In scope
- Web app: app.northwind.health (React), 52 routes, 4 roles
  (patient, provider, admin, billing)
- REST API: api.northwind.health/v3, 94 endpoints
- GraphQL: provider-messaging service, 18 queries, 11 mutations
- Auth: Okta OIDC + JWT
- Cloud: AWS (EKS, RDS Postgres, S3 attachments), IAM in scope
- Multi-tenant: cross-tenant PHI access testing required

3. Out of scope
Marketing site, the Twilio and e-prescribing third-party platforms,
DoS/stress testing, social engineering, physical security.

4. Approach
Code-aware gray box. Credentials for all 4 roles, OpenAPI 3.0 and
GraphQL schemas, read access to the messaging service source,
read-only AWS console.

5. Rules of engagement
Production testing Saturdays 2-6 AM ET, 100 req/sec cap, WAF blocks
at 500 req/5 min/IP. Staging 24/7 with anonymized data. MFA disabled
on the five provided test accounts. Break-glass contact: [name, phone]

Notice what this does that "test the application" cannot: it names the objective and its compliance targets, enumerates the surface down to endpoint and role counts, calls out cross-tenant testing explicitly, ties deliverables to the exact controls the auditor will ask for, and makes the working PoC a condition rather than a hope.

Defining In-Scope Assets for a Modern Architecture

Scope failures almost always trace back to an incomplete asset inventory. A tester cannot validate what nobody listed, and the assets teams forget are exactly the ones attackers find. Name your in-scope assets with real specificity across five layers.

  • The application layer: web applications with their frameworks (React SPA, Rails monolith), the number of user roles, and the routes. "Customer portal at app.example.com, React front end, 4 roles, 52 routes" beats "the web app."

  • The API layer: REST endpoints with counts, GraphQL schemas, gRPC services, webhook receivers, and WebSocket connections. APIs are the most commonly under-scoped layer, and the GraphQL testing checklist shows why they need their own line.

  • The authentication surface: which mechanisms are in scope, OAuth flows, JWT handling, SAML, API keys, session management, because auth is where the highest-impact flaws live.

  • The infrastructure and cloud layer: specific cloud accounts and services (ECS, Lambda, S3, RDS), the container and orchestration layer (Kubernetes RBAC, container escape, the service mesh and its control plane), and whether cloud IAM and misconfigurations are in scope. Cloud-native systems add attack surface a network-diagram scope never captures, over-permissive S3 policies, IAM privilege-escalation chains, exposed pod service accounts, so each of these needs a named line. The cloud pentesting guide covers what to name here.

  • The multi-tenant and data layer: if you run multi-tenant SaaS, cross-tenant isolation must be explicitly in scope, because it is the highest-impact vulnerability class and it is never tested by default.

A concrete in-scope block reads like this:




Why code-aware scoping is more accurate. A code-aware platform reads your codebase to enumerate the API endpoints, authentication requirements, and data flows automatically, which produces a complete inventory in hours rather than the days a manual asset-discovery workshop takes, and it catches the shadow endpoints a network diagram misses. That accuracy is what makes a fixed-scope engagement possible: both sides see the full attack surface before pricing.

Defining Out-of-Scope Items Clearly

The out-of-scope section does two jobs: it prevents damage, and it prevents disputes. Both need to be explicit.

  • Systems to exclude: production databases you cannot risk, third-party SaaS you do not own (the tester cannot legally test Salesforce or Stripe's infrastructure), legacy systems mid-decommission, and any partner-owned assets.

  • Prohibited techniques: denial-of-service and stress testing, social engineering and phishing (unless explicitly a separate red-team scope), physical security testing, and anything destructive against production data.

  • The gray areas to settle up front: whether testing runs against production or staging, whether automated scanning is bounded by rate limits, and how a discovered-but-out-of-scope asset gets handled. Silence on these is what turns into a mid-engagement argument.

A useful rule: if a tester could plausibly wonder whether something is fair game, name it in one column or the other. Ambiguity is not neutral, it defaults to either an untested risk or an unwelcome surprise.

Rules of Engagement: Keeping Testing Safe and Productive

The rules of engagement (RoE) are the operational contract that lets testing happen without turning into an incident. A real RoE covers five things.

  • Testing windows. Approved hours (for production, often maintenance windows), blackout periods, and time-zone clarity, so testing does not collide with a launch or a peak-traffic event.

  • Rate limits and intensity. The request-per-second ceiling and how the tester should behave when a WAF starts blocking, so an aggressive scan does not read as an outage.

  • Escalation and break-glass. Who the tester calls if something breaks, and the procedure to pause testing immediately, with a named contact and a real phone number, not an email address.

  • Data handling. What the tester may access, view, and extract, especially for regulated data, and the requirement to use synthetic data where possible and delete all engagement data within 30 days with written attestation.

  • Authorization. Explicit written permission to test the named assets, which is what makes the testing legal. This is not a formality, it is the difference between a pentest and a computer-crime.

The Scoping Questionnaire: Questions to Answer Before You Write the SOW

A good scope of work is the output of a good scoping conversation. Before you draft the document, answer these questions, because each one that stays open becomes a change order or an untested risk later.

On objectives: What is driving this test, compliance, a recent incident, a pre-launch gate, or a maturity push? What single outcome would make it a success? Which frameworks (SOC 2, ISO 27001, PCI DSS, HIPAA) does the result need to satisfy?

On assets: What are the internet-facing applications and their frameworks? How many API endpoints, and do they include GraphQL or gRPC? What authentication mechanisms are in use? Which cloud accounts and services are involved? Is the architecture multi-tenant, and if so, is cross-tenant isolation in scope?

On access and approach: Will the tester get credentials and source access (gray or white box) or start from zero (black box)? Are there test accounts at each privilege level? Can testing run against production, or only staging, and does staging mirror production?

On constraints: What are the approved testing windows and blackout periods? What rate limits apply, and what does the WAF do under load? Who is the break-glass contact, with a real phone number? What data can the tester access, view, and extract?

On outcomes: What report format and evidence does each finding need (a working PoC, CVSS, remediation)? What is the retest policy and turnaround? How will findings be communicated during the engagement, not just at the end?

Run this list once, and the SOW writes itself. Skip it, and the gaps surface at the worst possible time, mid-engagement, when fixing them costs a change order and a delay.

How to Prevent Scope Creep

Scope creep is the silent budget-killer, and it almost always starts with an incomplete inventory that surfaces mid-engagement. Four practices keep it contained.

  • Do the discovery before you fix the price. Mandate a discovery phase that enumerates every in-scope asset before final pricing, so both sides see the full surface up front rather than negotiating change orders mid-test. A code-aware platform does this from the codebase in hours.

  • Version-control the scope. Treat the scope as a living artifact, a scope snapshot that names the assets, boundaries, and rules, updated when the environment changes, rather than a diagram that goes stale.

  • Define "significant change" objectively. For an ongoing or continuous engagement, name the triggers that pull new surface into scope (a new authentication flow, a new public endpoint, a new integration) rather than leaving it to judgment, which is exactly what compliance frameworks like PCI DSS mean by testing "after significant change."

  • Cap variance in the SOW. Agree a threshold, say 20%, within which normal iteration does not trigger a re-price, so ordinary weekly deploys do not generate surprise invoices.

Matching Scope to Your Compliance and Architecture

The right scope is not one-size-fits-all. It follows your compliance obligations and your architecture.

On compliance, the framework dictates the minimum scope. PCI DSS requires the cardholder data environment, its perimeter, and segmentation testing. SOC 2 and ISO 27001 expect both external and internal surfaces with attack-chain validation. HIPAA focuses on the systems handling PHI. Scope to the framework's requirement first, then extend to your actual risk. The SOC 2 and PCI DSS requirement guides spell out the mandated scope for each.

On architecture, the shape of your system decides where the depth goes. A simple monolith scopes to the app and its perimeter. An API-first or microservices platform must put the API layer, service-to-service auth, and the gateway in scope explicitly. A multi-tenant SaaS must name cross-tenant isolation, and a cloud-native product must name IAM and the infrastructure layer. The internal and external penetration testing guides map the two sides most SOWs need to cover.

A Precise Scope Is the Difference Between a Report and a Result

The scope of work is where a penetration test succeeds or fails before a single request is sent. Define the in-scope assets with real specificity, name what is out of scope to prevent damage and disputes, write rules of engagement that keep testing safe, and run a discovery phase so scope creep never surprises you. Get that right and the engagement produces findings your engineers can act on. Get it vague and you get a PDF that validated the wrong thing.

The most reliable way to get scope right is to build it from the code rather than a diagram. That is where CodeAnt AI fits: it reads your codebase to enumerate the real attack surface, the API endpoints, the authentication flows, the data paths, so the scope reflects what an attacker can actually reach rather than what someone remembered to list.

Because the same code intelligence that reviews your pull requests drives the testing, every finding within that scope lands with the exact file, line, and a working proof-of-concept, retests are unlimited, and you pay only when a high or critical is confirmed exploitable. Accurate scope in, actionable findings out.

Where to start this week

Take your last penetration testing scope and check it against your code, not your network diagram. Trace where sensitive data actually flows and note every API, service, and integration it touches, that is your real scope. Then run a free code-aware scan on your highest-risk application to see the enumerated attack surface next to what your SOW listed. The gap between them is usually where the untested risk lives.

Run a free code-aware pentest →

Related reading

FAQs

What is the difference between a scope of work and an RFP for penetration testing?

How detailed should the in-scope asset list be?

What should always be out of scope in a penetration test?

How do I stop scope creep from blowing my pentest budget?

Do the rules of engagement need to allow production testing?

Start Your 14-Day Free Trial

AI code reviews, security and quality trusted by modern engineering teams.

Table of Content
No headings found on page

Ship clean & secure code faster

Get Pentest Report

NO CC REQUIRED