#98

feat(harness): scope guard, rate limiting, RoE injection, auto-checkp…

OpenRichardoCwants to merge intofrom

…oint, notes v2

Hardening of the PentestAgent harness based on a test pentest where I'd an agent driving this harness. Happy to chat about this with maintainers

Safety / engagement controls

  • config/scope.py: host:port allowlist guard with off|warn|block modes (PENTESTAGENT_SCOPE_HOSTS, PENTESTAGENT_SCOPE_MODE); wired into terminal and browser tools. Blocked every out-of-scope request across Phase 5 (~570 probes).
  • config/ratelimit.py: token-bucket request throttle (PENTESTAGENT_RPS).
  • config/roe.py: rules-of-engagement injection from file (PENTESTAGENT_ROE_FILE) into agent context at startup.
  • tools/privileged_action: request_privileged_action tool (gated, audited privileged operations such as sanctioned logins).
  • tools/evidence: structured evidence capture for findings.

Engagement lifecycle

  • interface/checkpoint.py: auto-checkpoint on loop cap/exit -> loot/progress.md plus checkpoint notes; enabled cross-run resumption (Phase 5 survived four 45-loop cap hits with zero lost state).
  • interface/reporting.py + agents: checkpoint and report integration in base agent, pa_agent and crew orchestrator.
  • Notes schema v2: severity/confidence/endpoints/evidence_refs/remediation fields (tools/notes), enabling mechanical report compilation.

Agent loop & LLM config

  • llm/config.py: ModelConfig defaults aligned to provider-recommended sampling defaults (temperature 1.0, top_p 0.95); max_tokens via PENTESTAGENT_MAX_TOKENS; removed per-call-site temperature overrides. This made it easier to use a different model
  • Env-tunable PENTESTAGENT_MAX_CONTEXT_TOKENS / TEMPERATURE / MAX_LOOPS.
  • interface/conversation_store.py: fix serialization so rewind/fork and conversation persistence round-trip correctly.

TUI & packaging

  • tui.py: autofocus chat input (AUTO_FOCUS) and --loops N flag; main/cli/ initializer wiring.
  • Dockerfile.kali: bake Chromium into the Kali image; venv profile script.

Tests

  • New unit tests for scope, ratelimit, roe, checkpoint, reporting; updated constants and conversation store tests.

Generated by: pi 0.84.3 (glm-5.3-flash)