Field manual · 03

Scope, RoE and security modes

Targets, exclusions, the Rules of Engagement gate, the AI scope draft, DEFAULT versus SAFE.

Scope is the authorization boundary, and the plugin treats it that way: it is checked in code at the moment of action, not written into a prompt and hoped for. Get the fields right once and every later refusal makes sense.

Scope fields and matching

The scope object has four lists. All are optional individually, but at least one of targets, CIDRs or domains is required to start an engagement.

FieldAcceptsMatching rule
TargetsHosts, host:port, or full http(s) URLsExact host; when a port is present it must match; a URL is compared by host and port
CIDRsIPv4 ranges such as 10.0.0.0/24Address containment inside the range; IPv6 CIDRs are not supported
DomainsBare suffixes such as example.comApex and every subdomain match; a leading dot is ignored
ExclusionsAny of the forms aboveExclusions win over every positive entry, including partial CIDR overlap

Five rules decide the edge cases. An empty scope means no active testing, not "everything allowed". The four cloud metadata addresses (169.254.169.254, 100.100.100.200, metadata.google.internal, metadata.google.com) are refused even if someone puts them in scope. Only http: and https: reach the browser and HTTP client; file:, data:, javascript:, chrome:, devtools: and view-source: are refused. When the runtime is Docker, a tool target of localhost, 127.0.0.0/8 or ::1 is refused before execution, because inside the container it would address the container rather than the Host. And exclusions are not a hint: a range that merely touches an excluded range is out.

Scope can be supplied when the engagement is created — pentest_start_engagement takes targets, cidrs, domains and exclusions — but after that, replacing it is operator-only. An agent call to pentest_scope without target is refused by design, and the rejection is audited. A scope save replaces the whole object rather than merging, so review all four fields before you press save. The one agent path that can change the boundary is a discovery expansion, described next.

Scope and RoE drawer with the engagement name, client, the Build scope with AI prompt and its four filled scope fields, Save scope, the applied scope-expansion records and the engagement controls
Figure 1. The Scope & RoE drawer (1.3.0 capture, 28 November 2026). Build scope with AI fills the four fields from one prompt but applies nothing: you still review targets, exclusions, CIDR ranges and domains and press Save scope. Below them the discovery-expansion record shows what the agent proposed and what was applied inside an authorized root, with provenance; Accept and start — the authorization checkbox — is the control that records acceptance, which this session had already given (the header reads RoE accepted). Acceptance unlocks the mode switch and gated phases and survives a later scope edit.

The Rules of Engagement

Acceptance records the client, an emergency contact, the start and end dates, free-text constraints, a timestamp and an actor. It is per engagement, never inherited, and it is the switch that unlocks gated phases and the mode control. Three actions exist only in the operator bridge — accepting the RoE, switching the mode and resolving an approval — and the engine refuses them for any other actor. The agent's tool set contains no equivalent call.

Acceptance survives a scope change. That is intentional: adding a host to an authorized engagement should not force you to re-attest the whole relationship, but it does mean the audit trail, not the acceptance timestamp, is where you prove what was in scope at any moment. Every scope save, acceptance and mode change is appended with actor and time.

Acceptance is not a checklist item

Accepting the RoE attests that you are authorized to test the listed scope. The plugin records the attestation and enforces the lists; it cannot verify that your permission is real. If the written authorization and the drawer disagree, fix the drawer before the first packet.

Scope expansion after a discovery

Recon and OSINT routinely find a host nobody listed. Stopping the engagement for a drawer edit is safe but wasteful, so 1.3 adds a constrained expansion path: the agent calls pentest_scope with target plus the discovering factId or evidenceId, a short source, a reason and an optional confidence (default 0.6). Supplying scope arrays in the same call is refused — an expansion is not a replacement.

SituationDecisionWhat you see
Inside an authorized target, CIDR or domain rootapplied automatically; the new entry is audited with its sourceA scope change plus scope_expanded in the audit trail
Outside every rootpending proposal, not authorizedA row in Scope proposals with target, root matched or missed, source, confidence, reason and time, plus a scope_proposal_created audit entry
Exclusion or cloud-metadata endpointRefused before any proposalscope_expansion_rejected with the reason
Already in scope or already proposedduplicate, no changeAn unchanged result naming the existing status

The operator resolves a pending proposal with Approve or Reject in the Scope & RoE drawer. An approval adds the target; a rejection records the decision and leaves the boundary alone. The Rules of Engagement acceptance is never reset by an expansion, because it is still the same authorized relationship — the audit trail, not the acceptance timestamp, is where you prove what was in scope at any moment.

This is deliberately narrower than “the agent can edit scope”. It cannot replace the lists, it cannot override an exclusion, and it cannot authorize itself outside a root. The planner lives in lib/host/scope.js (classifyScopeTarget, planScopeExpansion, resolveScopeProposal, reconcileScopeExpansion), so the decision is deterministic and testable.

The AI scope draft

Build scope with AI turns one plain-language description into a draft: name, client, summary, targets, CIDRs, domains, exclusions, assumptions and a confidence score. It reuses the Host model route, or the explicit scopeAI.provider and scopeAI.model when set. If no route is configured, the action is unavailable and the fields remain manual.

The privacy boundary is narrow and worth stating precisely: the only text sent to the model is the description you typed plus a static instruction. No engagement document, target list, graph node or credential is attached. The reply is treated as untrusted data and re-validated locally. Metadata endpoints and CIDRs covering them are removed, URLs are reduced to their origin, hostnames and CIDRs are parsed and deduplicated, lists are capped at 200 entries, assumptions at 30, and credential-looking strings are redacted before anything is shown back to you.

A draft is plain data. It fills the fields for review; nothing is saved or applied until you press Save scope, and the audit records the draft event rather than a scope change. The save is the change. No consent checkbox is needed for the prompt because it is your own text; scopeAI.allowRemoteContext is reported for parity with the wordlist feature, but a draft never attaches engagement data either way.

How a scope draft becomes an enforced boundary The operator description goes to the model route. The reply is validated locally: metadata endpoints removed, URLs reduced to origin, entries deduplicated and capped. The result fills the form; only Save scope writes the engagement and the audit entry. Every later execution, browser launch and HTTP request checks the saved scope, with exclusions winning. DRAFTING LOCAL VALIDATION ENFORCEMENT Your description the only text sent Model route strict JSON Validate locally metadata blocked URL → origin, dedupe capped at 200 per list Review nothing applied Save audited Scope check at the moment of action tool execution · browser launch and document redirects · HTTP, API discovery, requests and fuzzing · OSINT queries
Figure 2. The model proposes; the validator disposes. A draft that never reaches Save changes nothing, and enforcement always reads the saved scope rather than the form.

DEFAULT versus SAFE

The install default is defaultMode: default. DEFAULT runs the full PTES chain inside the accepted scope. SAFE is opt-in and holds exploitation-class categories for an operator decision. A new engagement inherits the configured default; a stored engagement keeps its own mode, and every switch is audited with actor and timestamp.

BehaviourDEFAULT (install default)SAFE (opt-in)
Recon, enumeration, vulnerability analysisRuns directlyRuns directly
Exploitation, privesc, lateral, exfiltration, credential, credential_dumpRuns directlyBlocks on an approval card; denial returns as a result
Scope checks, exclusions, metadata blockingAlways onAlways on
Append-only audit and evidence hashingAlways onAlways on
Who can switch the modeOperator only, after RoE acceptanceOperator only, after RoE acceptance

To keep the approval gate for every new engagement on an installation, set the mode in the profile row and reload the plugin:

- insert:
    - id: dsh-redteam
      name: dsh-redteam
      config:
        defaultMode: safe
        approvalTimeoutMs: 600000

Switching to DEFAULT does not disable scope enforcement, the audit trail or the authorization disclaimer every report carries. It only removes the approval step for gated categories.

Which mode for which engagement

EngagementModeWhy
Client web or API assessment with no exploitation agreedSAFEEvery intrusive step already needs a conversation; the gate makes the conversation explicit.
Internal Active Directory test with credentials and lateral scopeSAFECredential, lateral and privesc categories are exactly what the gate holds; approve per phase, not blanket.
Lab or CTF range you own, no third partiesDEFAULTNo approval bottleneck, and scope plus audit still bound the work.
Red-team exercise where speed is part of the testDEFAULTApproval latency would distort the exercise; the written RoE still governs.
Compliance-driven test with a fixed, non-destructive checklistSAFEPrevents an unplanned exploitation step from widening the engagement.
The choice is not a safety switch

Both modes enforce scope, audit, evidence and operator-only authority. SAFE adds a human decision before intrusive categories; it does not make an unauthorized target acceptable, and DEFAULT does not remove the authorization requirement. Choose based on how much interruption the engagement can tolerate, not on whether you trust the agent.

Next: running the engagement — phases, execution, approvals and closure. Deeper: SAFETY.md, CONFIGURATION.md and the tool reference.

What good looks like

  • Scope has four lists; exclusions win, metadata hosts are always blocked, and an empty scope means no active testing.
  • The agent may supply scope when it creates the engagement, but later scope edits are operator-only and a save replaces the whole object.
  • RoE acceptance is an operator attestation that unlocks gated phases and the mode switch; it survives scope edits but is always audited.
  • The AI scope draft sends only your typed description, validates the reply locally, and changes nothing until you press Save scope.
  • DEFAULT is the install default; SAFE only adds approvals for intrusive categories. Both modes enforce scope, audit and evidence.