# How are scope, authorization and dangerous actions controlled?

> Open-source AI pentest and offensive-security agents — a good answer covers: Target allowlists or scope files, authorization checks, human-in-the-loop approval, sandboxing and network isolation, rate limits, and what stops the agent from acting outside the engagement.

Canonical page: https://llms-technical-reviews.com/offensive-security-agents/q/scope-safety/

## Verdict

Nebula (in Docker mode) and Decepticon enforce scope in code at both the tool call and the network layer, with Pentest Swarm AI close behind. The rest enforce one path or only the prompt. Only RedAmon and Nebula require human approval by default.

**Call plus network enforcement.** [Nebula](/p/nebula/)'s deterministic `PolicyEngine` checks every brokered call against CIDRs, domains, URLs and ports and requires approval for exploitation-class tools. Containers start with no egress, but new Projects default to Host mode: once acknowledged, `run_command` runs on the host with no scope check, and a `bypass_permissions` flag allows everything. [Decepticon](/p/decepticon/) refuses gated tools when the RoE file is missing and compiles the RoE into an nftables allowlist. Its approval gate and spend cap are off until configured, and the firewall shares a container with the agent, which runs as root with `NET_ADMIN`. [Pentest Swarm AI](/p/pentest-swarm-ai/) checks scope in every tool adapter, scans exploit commands and guards Go-native dials. Exclusions and port limits never reach those checks, `enforce_strict` is read by no code, and its MCP tool and keyless-by-default API skip the operator authorization gate.

**One enforced path.** [RedAmon](/p/redamon/) asks for confirmation before dangerous tools by default, but nothing checks a command's arguments against scope, the hard domain blocklist skips IP mode, and its Kali container runs with `seccomp:unconfined`. [Shannon](/p/shannon/) enforces only `code_path` rules; URL and domain rules are prompt text. [CyberStrike](/p/cyberstrike/)'s `http_replay` refuses uncaptured hosts, but every agent's base rule is `"*": "allow"` on a host shell. [PentestGPT](/p/pentestgpt/) checks the planned target string, not where its full-access shell connects. [PentestAgent](/p/pentestagent/)'s gate reads keys like `target` and never inspects `terminal` commands. [RAPTOR](/p/raptor/) scopes its `/web` scanner to one origin; its default sandbox profile degrades silently when the host lacks namespaces, and only `strict` fails closed.

**Prompt only or nothing.** [Strix](/p/strix/) tells the model its target list is "the starting scope, not a ceiling", with no approval step and an opt-in Docker network. [PentAGI](/p/pentagi/) has strong container hardening but no allowlist, prompts that declare everything pre-authorised, and `ASK_USER` off. [HexStrike AI](/p/hexstrike-ai/) binds an unauthenticated command API to all interfaces.

Pick: Nebula in container mode for policy-checked calls and deny-by-default egress.
Pick: Decepticon for RoE-driven red teaming; enable its approval gate and budget.
Pick: Strix, PentAGI or CyberStrike only behind your own firewall or isolated network.

## Per-project answers

### usestrix/strix (answered)

Strix implements multiple layers of scope and safety control:

**Target allowlist via `build_scope_context`** — Every target is typed and authorized before the run. `inputs.py:build_scope_context()` (lines 192–224) builds an `authorized_targets` list from the scan config, recording each target's type (repository, local_code, web_application, ip_address, api_spec), its value/URL, and its workspace path. API specs auto-authorize their declared `base_urls` as in-scope web targets. This list is rendered into the system prompt via `scope.jinja`, telling the model what it may target.

**Workspace mount safety** — `check_mountable_dir()` in `interface/utils.py:1406–1441` prevents mounting system directories (`/bin`, `/etc`, `/usr`, etc.), home directories, and credential directories (`.ssh`, `.aws`, `.kube`) into the sandbox. Forbidden paths include 15 root trees and 12 sensitive dir names.

**Human-in-the-loop approval** — Interactive mode enables `wait_for_user`, which parks the agent and yields control. The outer agent loop in `execution.py:_run_agent_loop()` (lines 328–387) parks on the user indefinitely when interactive, with a 300s auto-resume timeout. Tools can declare `needs_approval` callbacks; the SDK enforces user confirmation before execution.

**Docker sandbox isolation** — The sandbox container runs with `NET_ADMIN`/`NET_RAW` capabilities (`docker_client.py:254–257`) but has optional network isolation: `STRIX_DOCKER_SANDBOX_NETWORK` can place it on an isolated Docker network (lines 57–66). Resource limits are available via env vars (`STRIX_SANDBOX_MEM_LIMIT`, `STRIX_SANDBOX_CPUS`, `STRIX_SANDBOX_PIDS_LIMIT`). Container logs are capped at 50 MB×3 files by default (`docker_client.py:130–137`).

**Rate limits and turn limits** — `max_turns` defaults to 500 (`settings.py:14`). The `LLM_MAX_TOOL_CALLS_PER_TURN` setting (default 32, `settings.py:104–108`) caps degenerate responses. Model-level retry has 5 attempts with exponential backoff (`models.py:687–701`). Stream idle timeout (300s), first-event timeout (120s), and total timeout (600s) prevent hung model calls (`models.py:277–290`).

**Budget enforcement** — `max_budget_usd` with policies `stop` or `pause` (`hooks.py:165–450`). Three warn bands (70%/85%/95%) inject escalation prompts into the stream. Subagents stop at 90% reserve so the root can finish writing the report. The `BudgetExceededError` propagates through the agent tree and triggers `coordinator.trigger_budget_stop()`.

**Illegal operations** — `finish_scan` refuses to run if child agents are still active (`finish/tool.py:322–335`). `agent_finish` refuses to run for root agents (`agents_graph/tools.py:679–690`). The model cannot send messages to itself, stop itself, or stop unknown agents.

> **Editor's note.** Correction: no Strix tool uses `needs_approval`, so there is no per-action approval; and `authorized_targets` is prompt text only — scope.jinja tells the model the list is 'the starting scope, not a ceiling' and never to question authorization, with no network-level enforcement (a dedicated Docker network is opt-in via STRIX_DOCKER_SANDBOX_NETWORK).

Citations: [strix/core/inputs.py:192-224](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/inputs.py#L192-L224) · [strix/interface/utils.py:1342-1440](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/interface/utils.py#L1342-L1440) · [strix/runtime/docker_client.py:1-67](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/runtime/docker_client.py#L1-L67) · [strix/core/hooks.py:165-250](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/core/hooks.py#L165-L250) · [strix/config/settings.py:93-108](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/config/settings.py#L93-L108) · [strix/tools/finish/tool.py:311-353](https://github.com/usestrix/strix/blob/6b7ae2ebe4d47037a927aade23265ff4e4f27e84/strix/tools/finish/tool.py#L311-L353)

### KeygraphHQ/shannon (answered)

Scope, authorization, and dangerous actions are controlled through **five layers of defense**:

**1. Preflight Validation** (`apps/worker/src/services/preflight.ts:534-579`): Five sequential checks run before any agent starts: repo path existence and type, config file validation against a closed JSON Schema (`additionalProperties: false`), code_path rules matching real filesystem entries, credential validation via a minimal pi session probe, and target URL reachability (DNS + HTTP HEAD with pinned lookup to prevent DNS rebinding). The target URL check includes a **link-local metadata blocklist** (`169.254.0.0/16`, `apps/worker/src/services/preflight.ts:67-79`) to prevent scanning cloud metadata services.

**2. Config-level Scoping** (`code_path` avoid/focus rules): The YAML config supports `rules.avoid` and `rules.focus` with type `code_path`, which are glob patterns scoped to the target repository. Avoid rules are enforced via the **`@gotgenes/pi-permission-system`** extension (`apps/worker/src/ai/pi/permission-system.ts`): each avoid pattern is translated into a cross-cutting `path` deny entry that blocks file access (`read/edit/write/grep/find/ls`) AND recognized bash file operations (`cat/grep/sed/…`) on matching paths, across every tool and child `task` session. `external_directory: allow` keeps legitimate access outside the mounted working directory unblocked (`apps/worker/src/ai/pi/permission-system.ts:78-93`). Config values are also sanitized against dangerous patterns (path traversal, HTML/JS/data/file URLs, `apps/worker/src/config-parser.ts:55-61`).

**3. Task Formation Boundaries** (`apps/worker/src/ai/pi/task-formation-executor.ts:43-44`): Always-denied paths (`.git`, `.shannon`, `.pi`) block access to git history, scan internals, and credentials. Task formation agents are confined to `read`, `grep`, `find`, `ls`, `glob`, `submit_result` tools only — no bash or write access.

**4. Container Isolation**: Each scan runs in an ephemeral `docker run --rm` container with a per-invocation task queue, ensuring repo isolation and preventing cross-scan interference. The target repo is mounted read-only where appropriate.

**5. Cancellation Signals**: Temporal cancellation signals are threaded through agent sessions (`apps/worker/src/ai/pi/pi-executor.ts:322-328`), allowing UI/CLI cancel to abort in-flight agent sessions rather than waiting for timeouts.

> **Editor's note.** Correction: only `code_path` avoid rules are enforced (via pi-permission-system); URL/subdomain/domain/method/header/parameter rules and rules_of_engagement are prompt text only, the 169.254/16 block applies just to the preflight target check, and the worker runs with seccomp=unconfined on an unfiltered bridge network.

Citations: [apps/worker/src/services/preflight.ts:534-579](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/services/preflight.ts#L534-L579) · [apps/worker/src/services/preflight.ts:67-79](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/services/preflight.ts#L67-L79) · [apps/worker/src/ai/pi/permission-system.ts:78-93](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/ai/pi/permission-system.ts#L78-L93) · [apps/worker/src/ai/pi/permission-system.ts:114-127](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/ai/pi/permission-system.ts#L114-L127) · [apps/worker/src/ai/pi/task-formation-executor.ts:38-44](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/ai/pi/task-formation-executor.ts#L38-L44) · [apps/worker/src/config-parser.ts:51-61](https://github.com/KeygraphHQ/shannon/blob/b9744f6cecc5429333873b86a6762f1d70c54fc2/apps/worker/src/config-parser.ts#L51-L61)

### vxcontrol/pentagi (answered)

PentAGI implements safety through Docker sandboxing, capability dropping, and configuration-gated controls rather than target allowlists or scope files.

**Docker sandbox isolation.** Every flow runs inside a Docker container. The `WorkerSpec()` function (`pkg/docker/worker_spec.go:18-26`) creates containers with `CapDrop: ["ALL"]` and a carefully curated `CapAdd` allowlist (CHOWN, DAC_OVERRIDE, NET_RAW, SYS_PTRACE, etc.). SYS_ADMIN, SYS_MODULE, SYS_RAWIO, and SYS_BOOT are explicitly forbidden (line 30-31). NET_ADMIN is only added when `DOCKER_NET_ADMIN` is configured (line 39-41). The default pentest image is `vxcontrol/kali-linux` (`pkg/config/config.go:67`), but `DOCKER_ALLOWED_IMAGES` can restrict which images are usable. The binary also has an `LLM_FALLBACK_PROVIDER` config option.

**Network isolation.** Agents operate inside the Docker sandbox; the host Docker network is configurable via `DOCKER_NETWORK`. The `DOCKER_INSIDE_*` config options (lines 50-52) point sandbox containers at a separate Docker daemon, preventing agents from accessing the host daemon. `DOCKER_INSIDE_POLICY_TESTS` (line 60) optionally runs authorization policy tests before granting agent access.

**Human-in-the-loop.** The `ASK_USER` config flag (`pkg/config/config.go:25`) enables the `ask` barrier tool which pauses the subtask and waits for human input. When enabled, the primary agent's tool set includes `AskUserToolName` (`pkg/tools/tools.go:1061-1065`). The flow goes to `Waiting` status, and the system sends a subscription event; the human's response resumes the subtask.

**Rate limiting and stop controls.** There is no built-in API rate limiting per se, but server-side context cancellation (`context.WithCancel`) provides stop capability. The `StopFlow` tool (registry line 424-430) cancels the executing task context. `ErrFlowStateGuard` (`pkg/tools/flow_manager.go:22`) prevents state-conflicting tool calls from being retried with argument fixing. The `repeatingDetector` in the performer (performer.go:323-348) aborts chains that repeat the same tool call consecutively.

> **Editor's note.** Correction: there is no target allowlist or egress control at all, and the primary_agent/generator/installer prompts state every task is pre-authorized and must not include authorization or confirmation steps; ASK_USER defaults to false, so the `ask` barrier (the only human checkpoint) is absent unless the operator enables it.

Citations: [backend/pkg/docker/worker_spec.go:18-44](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/docker/worker_spec.go#L18-L44) · [backend/pkg/config/config.go:21-76](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/config/config.go#L21-L76) · [backend/pkg/tools/tools.go:1061-1065](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/tools/tools.go#L1061-L1065) · [backend/pkg/tools/flow_manager.go:14-33](https://github.com/vxcontrol/pentagi/blob/cffed9485aa1cca70762cd08a57ac62a80406258/backend/pkg/tools/flow_manager.go#L14-L33)

### GreyDGL/PentestGPT (answered)

Scope control is enforced through multiple deterministic layers with **no human-in-the-loop approval** during the run. The `RunSpec` (`memory.py:37-43`) stores `allowed_targets` as a tuple of URL strings from the CLI `--target` argument. The `compile_plan()` function (`plan.py:157`) calls `_target_is_allowed()` (`plan.py:148`) which uses a two-stage check: first by `_url_contains()` — comparing canonicalized scheme, hostname, port, and path prefix — then by exact non-URL string match. A task whose target does not exactly match an allowed target is rejected with `PlanValidationError`. The Supervisor's system prompt (`agents.py:24`) instructs: "Every new task target must byte-for-byte copy one supplied allowed target. Ports, schemes, vhosts, URLs, and paths belong only in the objective; never decorate the target field." There is no rate-limiting module, network isolation, or sandboxing inside the framework — `SandboxPolicy.FULL_ACCESS` is used for both roles (`trial.py:73`). The deployment container/VM itself is the security boundary, as documented. The `max_decisions` cap (default 20, CLI-configurable up to 1000) stops the loop after a bounded number of cycles. The `max_attempts_per_task` (default 2) prevents infinite retries on a single task. The executor's turn budget is per-task-kind (`agents.py:209-216`: DISCOVER=5, ENUMERATE=6, TEST=5, EXPLOIT=9, VERIFY=4, RECOVER=6). Task kind is a hard boundary: TEST tasks are validated to not contain exploit phrases like "capture the flag" or "reverse shell" (`plan.py:201-203`). The legacy client has no automated scoping; it relies on the human user to stay in bounds.

> **Editor's note.** Correction: the scope check is not exact-match only; a URL target passes when scheme, host and port match and its path extends an allowed URL's path (plan.py L136-L154). It also validates only the task's target string: both roles run with FULL_ACCESS provider tools, so nothing in code limits which hosts the Executor's shell actually reaches.

Citations: [pentestgpt_agent/src/pentestgpt_agent/plan.py:91-154](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/plan.py#L91-L154) · [pentestgpt_agent/src/pentestgpt_agent/plan.py:193-204](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/plan.py#L193-L204) · [pentestgpt_agent/src/pentestgpt_agent/agents.py:15-43](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/agents.py#L15-L43) · [pentestgpt_agent/src/pentestgpt_agent/agents.py:209-216](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/agents.py#L209-L216) · [pentestgpt_agent/src/pentestgpt_agent/trial.py:131-136](https://github.com/GreyDGL/PentestGPT/blob/e8b1bb77d1ac00329675cec3b060aba971ec1ac8/pentestgpt_agent/src/pentestgpt_agent/trial.py#L131-L136)

### 0x4m4/hexstrike-ai (answered)

**There are effectively no scope, authorization, or safety controls in the code.** The Flask server binds to `host="0.0.0.0"` (line 17289) with no authentication on any endpoint. The `/api/command` endpoint (line 9137) accepts arbitrary shell commands with no validation or allowlist — it builds the command string from user input and passes it directly to `subprocess.Popen` with `shell=True`. Every tool endpoint (nmap, sqlmap, hydra, etc.) accepts a `target` parameter and injects it unsanitized into a shell command. There is no target allowlist, scope file, domain validation, or IP-range check anywhere in the codebase. The MCP config (`hexstrike-ai-mcp.json`) has `"alwaysAllow": []` (empty) but the comment says "Turn off alwaysAllow if you don't want autonomous execution!" — offering no in-code guard. The `FailureRecoverySystem` (line 4449) has a `RATE_LIMITED` error class (line 1563), but this handles *detecting* rate-limiting errors from tool output (e.g., "429 Too Many Requests") and suggests retry strategies — it does *not* enforce any rate limit on the server's own outgoing requests. The `ThreadPoolExecutor` in the smart-scan endpoint caps concurrent tool execution at 5 workers (line 9776), which is the only implicit throttle. There is no human-in-the-loop approval, no sandboxing (no Docker/Kali isolation), and no network egress control — the server trusts the MCP client entirely.


Citations: [hexstrike_server.py:17256-17289](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L17256-L17289) · [hexstrike_server.py:9137-9158](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L9137-L9158) · [hexstrike_server.py:10327-10375](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L10327-L10375) · [hexstrike_server.py:4449-4541](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L4449-L4541) · [hexstrike_server.py:9776-9780](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike_server.py#L9776-L9780) · [hexstrike-ai-mcp.json:1-14](https://github.com/0x4m4/hexstrike-ai/blob/d689933ff579d839c676c82b231f8e98326c5f04/hexstrike-ai-mcp.json#L1-L14)

### BitterSecurity/Decepticon (answered)

**Multi-layer architectural enforcement.** Scope and authorization are enforced through five independent layers that must all be satisfied for a potentially harmful action to proceed.

**1. RoE document.** The `RoE` model (`decepticon_core/types/engagement.py`, lines 275–304) defines engagement_name, client, dates, `in_scope`/`out_of_scope` entries (hostnames, CIDRs, domain globs), `prohibited_actions`, `permitted_actions`, and an `authorization_reference`. The `MachineEnforcement` model (`decepticon_core/types/roe.py`, lines 66–102) adds `forbidden_destinations`, `forbidden_command_patterns`, `max_concurrent_connections`, `min_inter_request_delay_ms`, and authorized/blackout time windows.

**2. Parser-side guardrail.** `RoEGuardrailMiddleware` (`middleware/roe.py`, lines 1–63) intercepts every call to gated tools (`bash`, `http_request`, `browser_action`, `web_fetch`, `web_search`, etc.) and extracts the target via `extract_targets()`. It uses `evaluate_command()`, `evaluate_target()`, and `evaluate_time_window()` from `decepticon_core.types.roe` to compare against the engagement's machine enforcement rules. Decisions are written to an audit sink (`<workspace>/audit/roe-decisions.jsonl`).

**3. Network-layer backstop.** `EgressPolicy` (`middleware/egress.py`, lines 1–80) compiles the same `MachineEnforcement` rules into nftables connect-allowlists and DNS allowlists that the sandbox kernel applies. Layer 2 cannot be bypassed by command indirection — packets to out-of-scope IPs are dropped at the network edge.

**4. Human-in-the-loop.** `HITLApprovalMiddleware` (`middleware/hitl.py`, lines 1–58) intercepts tool calls matching configurable high-impact policies (e.g. C2 deployment, credential dumping, lateral movement into sensitive scope) and pauses the run until an operator approves, denies, or redirects the action. Default is deny-on-timeout.

**5. Budget and critical-tool protections.** `BudgetEnforcementMiddleware` (`middleware/budget.py`) enforces USD spend caps via LiteLLM `/spend/tags`. Tools `ask_user_question` and `complete_engagement_planning` are `SAFETY_CRITICAL_TOOLS` (`agents/build.py`, lines 60–64) — disabling or replacing them requires the `DECEPTICON_ALLOW_SAFETY_OVERRIDES=1` env gate. `SafetyRegistry` (`decepticon_core/registry/safety.py`) manages the merged set of safety-critical slots and tools.

> **Editor's note.** Correction: not all five layers are active by default. The HITL approval slot is built only when DECEPTICON_HITL__ENABLED is set (agents/middleware_slots.py L476-L503), and USD budget caps are a no-op until configured. The RoE parser gate is fail-closed, but egress provisioning failures are only logged and retried, and the nftables rules live in the same container where the agent's shell runs as root with NET_ADMIN.

Citations: [packages/decepticon-core/decepticon_core/types/engagement.py:275-305](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon-core/decepticon_core/types/engagement.py#L275-L305) · [packages/decepticon-core/decepticon_core/types/roe.py:66-102](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon-core/decepticon_core/types/roe.py#L66-L102) · [packages/decepticon/decepticon/middleware/roe.py:1-63](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/middleware/roe.py#L1-L63) · [packages/decepticon/decepticon/middleware/egress.py:1-80](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/middleware/egress.py#L1-L80) · [packages/decepticon/decepticon/middleware/hitl.py:1-58](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/middleware/hitl.py#L1-L58) · [packages/decepticon/decepticon/agents/build.py:56-70](https://github.com/BitterSecurity/Decepticon/blob/cd252a5467b91ccfdb46fde9562c75d671d33604/packages/decepticon/decepticon/agents/build.py#L56-L70)

### gadievron/raptor (answered)

Scope and safety are enforced through **multiple independent layers** with a fail-closed posture. **Target scope**: the engagement ledger is CLOSED over an operator-given install directory — `core/engagement/ledger.py` enumerates only files under `target_root` and records provenance with `derived_from_target` field lists for every target-derived value. The ledger explicitly binds content by SHA-256: the chain module's content-binding refuses to analyse bytes that differ from the ledger's recorded hash, and stale chain state is archived, not reused. **Sandbox isolation**: every subprocess runs through `core/sandbox/` which layers network namespaces (no interfaces), mount namespaces (pivot_root to private tmpfs with RO system dirs), Landlock filesystem rules, and seccomp syscall filtering. The egress proxy enforces a hostname allowlist and rejects CONNECT targets with non-printable bytes or non-globally-routable resolved IPs. **Disable consent**: turning off sandbox (`--no-sandbox` or `--sandbox none`) requires explicit consent via `core/sandbox/disable_consent.py` — validated minted nonces, not just terminal presence. Sandbox-unavailability is fail-closed: `core/run/sandbox_policy.py` raises `SandboxUnavailableError` unless the operator has set `RAPTOR_ALLOW_UNSANDBOXED_TOOLS=1`. **Budget governor**: the engagement supervisor (`core/engagement/supervise.py`) enforces budget gates — no LLM-capable launch starts without `--max-cost`, `--envelope`, or `--uncapped` opt-out. The feasibility enforcer (`governor.enforce_feasibility`) compares policy cost estimates against the envelope; an unattended conflict parks the engagement before any segment spends. **Human-in-the-loop**: parks are sticky — segment-death parks, code-drift parks, and envelope-exhaustion parks all require an operator to `--acknowledge <park-id>` before resuming. **Rate limits**: LLM concurrency is capped at `MAX_WORKERS_CAP=32` with provider-specific RPM awareness and a `CC_MAX_WORKERS_DEFAULT=4` for the Claude Code transport.

> **Editor's note.** Correction: only the `strict` sandbox profile fails closed; the default `full` profile warns and degrades when namespaces or Landlock are unavailable. Live web testing is scoped by a ScopeReceipt in packages/web/execution_policy.py that rejects off-origin actions and actions above the approved risk level (default `active`).

Citations: [core/sandbox/__init__.py:1-100](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/sandbox/__init__.py#L1-L100) · [core/sandbox/cli.py:30-80](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/sandbox/cli.py#L30-L80) · [core/run/sandbox_policy.py:1-80](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/run/sandbox_policy.py#L1-L80) · [core/engagement/supervise.py:786-880](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/engagement/supervise.py#L786-L880) · [core/engagement/governor.py:1049-1077](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/engagement/governor.py#L1049-L1077) · [core/llm/concurrency.py:1-54](https://github.com/gadievron/raptor/blob/265236fc9f328be7df46cee36969fd447463c3c6/core/llm/concurrency.py#L1-L54)

### CyberStrikeus/CyberStrike (answered)

**Scope checking** is implemented via the `scope_check` tool (`tool/scope-check.ts`) which validates targets against scope items supporting exact domain match, wildcard domains (*.example.com), CIDR ranges (10.0.0.0/24), and URL prefix matching. It returns an explicit warning for out-of-scope targets.

**Authorization/permission system** (`permission/next.ts`) is a ruleset-based engine. Each agent has a flat list of `PermissionNext.Rule` objects (permission, pattern, action). Actions are "allow", "deny", or "ask" (human-in-the-loop). Rules are evaluated by the `Wildcard.match()` function with last-match-wins semantics. Each agent's permission is constructed by merging defaults with user config, and special per-agent overrides. For example, the injection agent denies destructive SQL patterns (DROP TABLE, xp_cmdshell, INTO OUTFILE), while proxy-tester subagents deny direct HTTP clients (curl, wget, Python requests) to force traffic through the controlled `http_replay` tool.

**Lane discipline** (`tool/vuln-scope.ts`): proxy vulnerability testers (`proxy-tester-*`) are structurally restricted to their own vulnerability class. `vrtScopeViolation()` checks the `TESTER_VRT_SCOPE` map at report time; finding titles are cross-checked via `classifyFindingTitle()` to prevent category spoofing. Off-class findings are still recorded via `add_intel(vulnerability_hint)` for re-routing, never dropped.

**Human-in-the-loop** is implemented by the `Permission.ask()` mechanism in `permission/index.ts`: permission requests that are not pre-approved are presented to the user (via the TUI or plugin hooks) and the agent blocks until the user responds with "once", "always", or "reject". The `Permission.RejectedError` is thrown when denied.

**Rate limiting and sandboxing:** The bash tool uses native OS process isolation (spawn with shell, no Docker/Kali sandbox detected). Network isolation relies on tool-level permissions (blocking curl/wget). Rate limiting is not directly implemented at the agent level — each tool has configurable timeouts. The bash tool invokes commands via the system shell with detached processes on non-Windows. External directory writes are permission-gated via `external_directory` rules.

> **Editor's note.** Correction: the base ruleset for every agent is `"*": "allow"`, so the primary agent runs shell and security tools without asking; `scope_check` is advisory (the model supplies both target and scope list). The one enforced scope is in `http_replay`, which refuses hosts not captured in the session and rate-limits sends via the replay governor.

Citations: [packages/cyberstrike/src/permission/index.ts:1-210](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/permission/index.ts#L1-L210) · [packages/cyberstrike/src/permission/next.ts:1-100](https://github.com/CyberStrikeus/CyberStrike/blob/61044eddf31d1549b54cea64a5c0dd694ab0341b/packages/cyberstrike/src/permission/next.ts#L1-L100)

### samugit83/redamon (answered)

**Three-layer defense: hard guardrail → soft guardrail → tool confirmation.**

**1. Hard guardrail** (`hard_guardrail.py`): deterministic, non-disableable. Blocks government/military domains by TLD pattern (`.gov`, `.mil`, `.edu`, `.int`, and 28 country-variant patterns) and 340+ exact-blocked international-organization domains (UN, WHO, World Bank, Red Cross, etc.). Runs at session start in `initialize_node` (`initialize_node.py:178-186`) and on every scope change (`_scope_gate()` checks `_scope_signature`). Cannot be bypassed — no LLM involved, no settings toggle.

**2. Soft LLM guardrail** (`guardrail.py`): a separate LLM call (using GPT system prompt) that classifies targets as "allowed" or "blocked" with categories like major tech companies, cloud providers, social media, financial institutions, healthcare, critical infrastructure, etc. The fail-closed policy means an LLM error blocks the run (`initialize_node.py:129-136`). The prompt instructs: "When in doubt, ALLOW" — lenient by design. For IP-mode targets, it reverse-DNS-resolves public IPs to hostnames and checks those. The guardrail re-runs mid-session if `_scope_signature` changes (`initialize_node.py:221`).

**3. Operator confirmation for dangerous actions.** Tools in `DANGEROUS_TOOLS` (`project_settings.py:42-55` — nmap, nuclei, curl, metasploit_console, kali_shell, execute_code, hydra, ffuf, playwright, etc.) require manual operator approval. The think node sets `awaiting_tool_confirmation=True`, the graph pauses at `await_tool_confirmation` (`orchestrator.py:856`), and the operator approves/modifies/rejects via `process_tool_confirmation_node()`. Phase transitions also require approval (configurable via `REQUIRE_APPROVAL_FOR_EXPLOITATION`), handled by `await_approval_node`/`process_approval_node` (`approval_nodes.py`).

**4. RoE (Rules of Engagement)** timing checks run every turn in `initialize_node` (`initialize_node.py:234-292`): engagement start/end dates, allowed days-of-week, time windows (with timezone support). Breaches surface as `_roe_warnings` in state.

**5. Sandboxing and network isolation.** All pentest MCP servers run inside the `kali-sandbox` container (not the agent container), so tool execution is network-separated. The capture proxy routes target-facing traffic; API-key tools (Shodan, Tavily, SerpAPI) explicitly bypass the proxy (`tools.py:119-120`). Supply-chain's `execute_guarddog` dispatches through a hardened, network-isolated analyzer container (`supply_chain_tools.py`). `PhaseAwareToolExecutor` enforces per-phase tool gating. `TOOL_MUTEX_GROUPS` prevents parallel access to singleton resources like Metasploit. `_CURL_LONG_WITH_ARG` (`tools.py:155-168`) validates curl argument structure to block injection attempts. The `tool_deadline_seconds()` mechanism (`tools.py:2168`) abandons hung tool calls rather than hanging the session.

> **Editor's note.** Correction: the hard guardrail only runs for domain-mode projects (IP mode skips it), the LLM guardrail auto-allows private and PTR-less public IPs and can be disabled with AGENT_GUARDRAIL_ENABLED, and the kali-sandbox container has NET_ADMIN/NET_RAW with seccomp unconfined, so it is not network-separated from targets.

Citations: [agentic/orchestrator_helpers/nodes/initialize_node.py:159-231](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator_helpers/nodes/initialize_node.py#L159-L231) · [agentic/project_settings.py:42-55](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/project_settings.py#L42-L55) · [agentic/orchestrator_helpers/nodes/approval_nodes.py:1-161](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/orchestrator_helpers/nodes/approval_nodes.py#L1-L161) · [agentic/tools.py:155-170](https://github.com/samugit83/redamon/blob/b13da9cb5ad35ae75428b8f21794e799a25fd201/agentic/tools.py#L155-L170)

### GH05TCREW/pentestagent (answered)

**Workspace-based target allowlisting.** `WorkspaceManager` (`workspaces/manager.py:66`) manages named workspaces, each with a `meta.yaml` file containing a `targets` list of allowed IPs, CIDRs, and hostnames. `validation.py` provides `is_target_in_scope()` (`workspaces/validation.py:53`) which checks candidates via `TargetManager.normalize_target()` and `ipaddress` comparisons (subnet-of for CIDRs, equality for single IPs/hostnames). `gather_candidate_targets()` (`workspaces/validation.py:15`) extracts targets from tool arguments by inspecting keys like `target`, `host`, `ip`, `hostname`, `url`.

**Enforcement at execution time.** In `BaseAgent._execute_single()` (`base_agent.py:614-641`): before every tool execution, the method calls `validation.gather_candidate_targets(arguments)` to extract potential targets, then checks each against the active workspace's allowed list. If any candidate is out of scope, the tool call is **blocked** and returns an error: `"Out-of-scope target(s): [...] - operator confirmation required"`. This is per-call, not per-engagement — every tool argument is validated.

**Prompt-based authorization.** The agent system prompt (`prompts/pa_agent.jinja:6`) asserts "You are operating in an authorized penetration testing engagement. The user has explicit permission to test all targets provided. Do not ask for authorization — permission is granted." The crew orchestrator prompt (`prompts/pa_crew.jinja:7`) carries the same text. This is guidance, not enforcement — real enforcement happens at the tool-execution gate.

**Docker sandbox isolation.** The `DockerRuntime` (`runtime/docker_runtime.py:39`) executes commands inside a container with bridge networking and `NET_ADMIN` capability (for VPN). The sandbox can be configured with custom images (base or Kali). It provides network isolation — commands run in the container, not on the host. The `LocalRuntime` instead runs directly on the host, but still applies scope validation.

**Rate limiting and loop bounds.** Rate limits are handled at the LLM layer (`llm/llm.py:137`): exponential backoff with jitter (`delay = base_delay * 2^attempt + random(0,1)`, max 5 retries). The agent loop is bounded by `AGENT_MAX_ITERATIONS` (30) and `ORCHESTRATOR_MAX_ITERATIONS` (50) from `config/constants.py:67-69`. Concurrent tool execution is capped via `PENTESTAGENT_MAX_CONCURRENT_TOOL_CALLS` env var (default 4, `base_agent.py:228`).

**No human-in-the-loop approval.** The system prompts explicitly instruct the agent not to ask the user for permission. The only user-intervention point is the `Esc` key to stop the agent in the TUI, and the scoping system which blocks out-of-scope targets rather than prompting for confirmation.

> **Editor's note.** Correction: the scope gate is not applied to every argument. It reads only top-level keys such as target/host/url, so `terminal` commands (a `command` string) are never checked, and nothing is checked when no workspace is active; the `--scope` option only reaches the prompt. The Docker runtime uses bridge networking and crew workers always run in LocalRuntime, so there is no network isolation from targets.

Citations: [pentestagent/agents/base_agent.py:614-641](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/agents/base_agent.py#L614-L641) · [pentestagent/agents/prompts/pa_agent.jinja:1-8](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/agents/prompts/pa_agent.jinja#L1-L8) · [pentestagent/config/constants.py:60-70](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/config/constants.py#L60-L70) · [pentestagent/llm/llm.py:137-157](https://github.com/GH05TCREW/pentestagent/blob/8dde193e41d34ac53ee87374316e5d2fe7cec946/pentestagent/llm/llm.py#L137-L157)

### Armur-Ai/Pentest-Swarm-AI (answered)

Safety is implemented across **six independent layers**:

**1. Scope validation**: `internal/scope/validator.go:24-38` defines `Validate()` and `ValidateCommand()`. The `ScopeDefinition` (`validator.go:15-20`) carries `AllowedDomains`, `AllowedCIDRs`, `ExcludedCIDRs` and `AllowedPorts`. Domain matching supports exact, wildcard (`*.example.com`), and subdomain suffixes. `ValidateCommand()` (`validator.go:178-203`) regex-scans every command string for IPs/domains and rejects any out-of-scope target before execution. `ValidateAndLog` in `audit.go:17-36` wraps validation with mandatory structured logging for audit trails.

**2. Egress guard**: `internal/scope/egress.go:22-36` wraps the Go network dialer so any outbound connection to an out-of-scope host is refused at the TCP layer — a last-line defense beneath request- and command-level checks (labelled SAFE-6). The authenticated HTTP session (`swarm_runner.go:498`) incorporates this guard.

**3. Shell safety**: `internal/shellsafe/shellsafe.go:14-112` provides a quote-aware command parser that rejects unquoted shell metacharacters (`|`, `>`, `<`, `&`, `;`, `` ` ``, `$()`). Commands requiring shell features must explicitly wrap in `sh -c "..."`.

**4. Safe mode and executable allowlist**: The exploit executor (`internal/agent/exploit/executor.go:19-100`) enforces `safeMode` which blocks commands containing destructive tokens (rm, DROP, TRUNCATE, kill, chmod, shutdown). The `allowedExecutables` set (`executor.go:31`, populated from `coordinator.RegisteredToolNames()`) restricts which binaries the LLM can invoke — no arbitrary shell commands.

**5. Human-in-the-loop**: `Assist` mode (`runner.go:91-95`, `executor.go:46`) prompts the operator y/N before every executed step via `ConfirmFunc`. Available through `--assist` on the CLI.

**6. Rate limits and budgets**: The scheduler enforces per-agent rate limits (`scheduler.go:104-111, 355-359`), per-agent token budgets (`scheduler.go:335-352`), per-campaign time budgets (`swarm_runner.go:798-820`), and per-campaign cost caps (`MaxCostUSD` at `swarm_runner.go:264-268`). A quiescence timeout (`scheduler.go:232-271`) completes the campaign after 60s of inactivity. The `scope.enforce_strict: true` config (`config.example.yaml:155`) is documented as always-on and non-disablable.

> **Editor's note.** Correction: the `scope.enforce_strict` setting is read by no code, and `--exclude`/`--allow-ports` never reach the tool-adapter or command checks (the runners pass a scope rebuilt from allowed domains/CIDRs only; only the egress and oracle guards see the full scope). The operator authorization gate covers CLI campaigns only: the MCP `scan_target` tool and the `serve` API start campaigns without it, and the API binds with no key by default.

Citations: [internal/agent/exploit/executor.go:19-100](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/agent/exploit/executor.go#L19-L100) · [internal/swarm/scheduler.go:97-112](https://github.com/Armur-Ai/Pentest-Swarm-AI/blob/40985e3184a5622fa76dc0b491ccb51b48d7acdf/internal/swarm/scheduler.go#L97-L112)

### berylliumsec/nebula (answered)

Scope and safety are enforced at multiple layers, all rooted in the `ScopePolicy` domain object (`domain.py:728-760`).

**Target allowlists**: `ScopePolicy` defines `allowed_cidrs` (CIDR networks), `allowed_domains` (with `*.` wildcard for subdomains), `allowed_urls` (with path prefix matching), `allowed_ports` — or operator may set `allow_all_targets: true`. It also supports `prohibited_actions` (exact tool name or action string bans), `not_before`/`not_after` time windows, and `local_only` (blocks `cloud_transfer`).

**PolicyEngine** (`policy.py:194-300`) evaluates every tool invocation before execution. It checks time windows, prohibited actions, target normalization (`_normalize_target` parses URLs and host:port at `policy.py:87-144`), and scope matching (`_domain_allowed` at `policy.py:147-157`, `_ip_allowed` at `160-164`, `_url_allowed` at `167-191`). Critically, DNS resolution happens at policy time (not at tool time): `resolved_ips` are captured, so DNS rebinding can't widen scope (`policy.py:43`).

**Risk classification**: Each `ToolSpec` is tagged with a `RiskClass` (`domain.py:243-252`): `LOCAL_READ`, `PASSIVE`, `ACTIVE_SCAN`, `WORKSPACE_WRITE`, `CREDENTIAL_USE`, `EXPLOITATION`, `PERSISTENCE`, `DESTRUCTIVE`, `SCOPE_CHANGE`. Classes above `ACTIVE_SCAN` always require operator approval (`policy.py:197-203, 292-298`). Writes outside the workspace and credential use also always require approval (`policy.py:277-290`).

**Human-in-the-loop**: `ApprovalRequired` (`tools.py:204-209`) is raised by the broker and caught by the `_approval` graph node (`orchestration.py:1961-1980`). LangGraph's `interrupt()` pauses the mission, persisting the checkpoint. The operator approves, edits, or rejects through the UI; the run resumes from its checkpoint (`orchestration.py:639 resume()`). Approval cards are durable and survive core restarts. `ToolNotPermitted` (`tools.py:147-158`) refuses calls that a scope setting permanently blocks.

**Request-level authorization**: `McpApprovalMode` offers `RISK_BASED`, `ALLOW`, `ASK`, `DENY` per MCP server profile (`domain.py:498-503`). The first call to any MCP tool in a session triggers a what-changed capability snapshot shown to the operator.

**Sandbox isolation**: Container execution uses `docker/podman run` with `--network=none` by default. SCOPED mode adds iptables-level egress rules pinned to resolved IPs (`sandbox.py:270-299`). VPN mode routes through an OpenVPN profile. The container runs non-root (uid 65532:65532) with a read-only root filesystem by default (`sandbox.py:297-298`).

**Rate limits**: `ScopePolicy.max_concurrency` (default 1, max 256) limits parallel operations. `RunBudget.per_target_active_operations` (default 1) limits operations on the same target. `ToolSpec.timeout_seconds` (max 86400) bounds individual tool runs.

**Scope import** (`scope_import.py:1-100`) is a separate AI-assisted flow where the operator uploads a document (RFP, rules of engagement, etc.), the model extracts CIDR/domain/URL candidates, and the operator reviews and applies them — the model never writes scope directly.

> **Editor's note.** Correction: new Projects default to Host execution mode. Once the operator acknowledges it, run_command runs Bash on the host with host networking, scope is not applied to commands (only the time window), and the default on_boundary approval policy does not gate them. A bypass_permissions scope flag also makes the PolicyEngine allow everything.

Citations: [src/nebula/v3/domain.py:728-760](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/domain.py#L728-L760) · [src/nebula/v3/policy.py:194-300](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/policy.py#L194-L300) · [src/nebula/v3/policy.py:87-144](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/policy.py#L87-L144) · [src/nebula/v3/sandbox.py:270-299](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/sandbox.py#L270-L299) · [src/nebula/v3/tools.py:204-209](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/tools.py#L204-L209) · [src/nebula/v3/scope_import.py:1-100](https://github.com/berylliumsec/nebula/blob/7332d9a05127933d2cc649e6797c9586466cfa8a/src/nebula/v3/scope_import.py#L1-L100)
