LangGraph pipeline · graph.py · graph.astream(), thread = session_id
validaterefuses → audit
guardrails.py · rbac.py · abac.py · report_access.py · netpolicy.pyauthorization; per-user targets / profiles / scopes; own reports only; scope = host + www + allowed; metadata / link-local / reserved IPs refused
choose_scopeinterrupt() · human in the loop
what to test: website + code · website only · code onlybefore any request; paused + checkpointed (or named: scan_scope); code scopes need scan:source; code only skips recon: auth, sandbox_check, dast and the probes pass straight on, so no request goes to any website (URL optional)
reconcrawl + discovery
tools/recon.py · discovery.pyin-scope pages, robots, sitemap, .well-known; file links never fetched; ≤3 requests at once, each page once (no #fragment copies), one request fewer after each 429 / 5xx / slow answer (3 → 2 → 1); a failed page retried 3 times
authJWT · form login · SSO/MFA detection
tools/auth_flow.py · auth_detect.pynever signs in to identity providers; an MFA page is not a login
auth_challengeinterrupt() · human in the loop
SSO: hand over the session · MFA: one-time codepaused + checkpointed; answer validated; timeout → unauthenticated
code_sourceinterrupt() · human in the loop
SAST step: code files · .zip · public .git link (+ branch/tag) · skippaused + checkpointed; pre-guardrails: authorization, scan:source, owner · git: .git link, allowlisted host, network policy, ls-remote reachable + ref exists, hardened shallow clone (1 retry) · then starts code_sast ∥ JS check ∥ dast in parallel (LangGraph Send, CPU count, 1-4 at once)
code_sastyour source code, sandboxed
code_upload.analyse_for_scan → Kubernetes Job (or the Python process sandbox)pre/post guardrails (sandbox + code step); no network; non-Python files marked partial; .exe/.bat/.cmd = warnings, .sh = notes; PEP 8 + ruff lint rules for Python; then code_tools on the host (static, never run): ruff, mypy, bandit, radon, semgrep + pip-audit on pinned requirements (only network: the vulnerability DB); one report · parallel with sandbox_check and dast
sastonly if sandbox check is off
subagents/sast_subagent.py (subgraph)skipped while sandbox_check runs the same JavaScript rules
sandbox_checkwebsite JS SAST · parallel
Kubernetes Job scopeguard-job-<session_id>source + page/script text as a zip on stdin; deny-all NetworkPolicy; memory 5x, 10x on OOM retry (resumes from checkpoint); deleted after · no kubectl (auto-check at start) or cluster not ready → Python process sandbox
dastsandboxed child process · parallel
scopeguard sandbox.py → worker.py → engine.pystarts from recon's pages, up to MAX_CRAWL_PAGES (60); failed pages retried 3 times; python -I, audit hook, pinned egress IPs; GET/HEAD/OPTIONS/TRACE; session cookie/bearer; headers, CORS, exposed files, GraphQL introspection, SRI, XSS/SSTI/SQLi/CRLF … (docs/SECURITY_CHECKS.md)
plan_probesjoins the parallel scans · LLM plan
code_exec.plan_probes → codegen_subagent.pylarge context chunked (10% overlap) + summarized until it fits one chunk, then extracted as a validated ProbePlan of whitelisted probes, stored in state · deferred: runs once, after every scan branch; LLM steps from here on are sequential
run_probesruns the stored plan
tools/probe_runner.pyre-validates the plan; GET/OPTIONS only, no generated code; timeouts retried (tenacity: up to 5 tries, backoff 2-16 s, at least Retry-After, 180 s budget per scan)
aggregatedeterministic
pentest_agent/dedupe.py · scopeguard/citations.pyone finding per issue + URL (merged duplicates, highest severity), red flags, built-in summary citing [Sn]
reporthtml · md · json · docx
tools/report_tool.py · scopeguard report / docx_reportall four formats from the same structured data
auditevery route ends here
audit_log.py → scopeguard/audit.pyhash-chained (HMAC) JSONL record: who, what, outcome, sign-in result, report hashes; no secrets
Each step picks the next with Command(goto). State is checkpointed after every step (AES-encrypted with CHECKPOINT_ENCRYPTION_KEY), so {"resume": true} continues a run, including one paused for sign-in. A step past AGENT_MAX_ITERATIONS is skipped and the run moves on to the report and the audit record.
Outside the server
HTTP requests, in scope only
Target website
- links outside scope recorded, never fetched
- every connection: resolve → check IP → connect to that IP (no DNS rebinding)
- cloud metadata / link-local always blocked
- no file downloads; text capped, binaries discarded unread
- 429 → Retry-After; no redirects followed
human in the loop
Operator's own browser
- SSO sign-in at the identity provider
- hands back only the target session
- IdP password and MFA factor never reach the agent
optional
Groq LLM · llm.py
- plan_probes only (the report keeps aggregate's cited summary)
- ≤ PROBE_CONTEXT_CHUNK_CHARS (4000) of data per request; more is chunked, summarized, extracted
- 413: limit learned, rebuilt smaller (tenacity, 3 tries)
- paced to Groq's per-minute budget (x-ratelimit headers): waits for the reset instead of a 429
- 429: waits exactly what Groq asks, 5 retries, ≤ 120 s, then fallback
- ≥ 60 s between two summary calls (LLM_SUMMARY_DELAY_SECONDS)
- no key or prompt file → deterministic output
optional
LangSmith
- one trace per scan; tokens, keys, passwords, cookies redacted
local disk · data/
Files the server writes
- reports/<session_id>/report.*
- checkpoints/main.sqlite (AES at rest; async aiosqlite, WAL + busy timeout: server and MCP/A2A scans write it concurrently; older than CHECKPOINT_RETENTION_HOURS (24) deleted + VACUUM)
- audit/audit.jsonl (pentest-audit verify)
- audit/code_audit.jsonl (pentest-audit --trail code verify)
- uploads/<id>/ (archive until scanned, checkpoint)
- logs/pentest-agent.log