pentest · diff

git:20261015.6b3a06b to git:20261020.f1b0c39

1 added, 0 removed. Audit A to A.

---
name: pentest
description: >
Offline Strix attack on the local app with a local Ollama model; writes 05-pentest.json.
Explicit only: use when the user types /pentest or says "pentest it".
author: Varun Singh
phase: prove
lanes: [standard, full, hotfix]
reads: [diff, tasks.json, 05-secure.json]
writes: [05-pentest.json]
auto-trigger: false
preflight: graphs
disable-model-invocation: true
---
# /pentest: can the running app be attacked?
## Step 0: preflight
1. `lfg graphs ensure`. Non-zero exit: stop and show its output. Continue on a stale graph only if the user typed `--allow-stale`.
2. `lfg run path`. Exit 1: `lfg run new pentest-<branch-slug>`.
## Steps
1. **Pick the mode from the lane** (`tasks.json`, else `lfg lane --json`):
| Lane | Mode | Target |
|---|---|---|
| Standard / Hotfix | `quick`, diff scope vs `origin/main` | the repo directory |
| Full | `standard` | repo + the local app (e.g. `http://app.localhost`) |
| Pre-release (user says so) | `deep` | full stack from `docker compose` on LFG's internal network |
Express lane: say pentest isn't part of Express and ask before running anyway.
2. **Target must be local**: a local directory, `localhost`, `127.0.0.1`, `*.localhost`, `*.test`, or a compose service on an LFG internal network. If the user named anything else, refuse and say why.
3. **Run.** `lfg pentest --mode <mode> [--target <local url>]`. Never call `strix` directly; `lfg pentest` enforces the offline rules.
4. **If the preflight refuses** (Ollama not running, model missing or without tool calling, egress firewall not active, Docker down, non-local target): show its message and the fix the user must do. Do not work around it.
5. **Triage** `05-pentest.json`:
- Map each finding to code with `semantic_search_nodes_tool` / `get_impact_radius_tool` so it points at `file:symbol`.
- Mark likely false positives (smaller local models produce more) with the reason; keep them in the file.
6. **High or critical findings → checkpoint 3** (gate 4): ask the user to choose fix / accept with an `Issue`. A fix goes through `/fix`, then re-run `lfg pentest` in the same mode.
7. **Record** each confirmed finding as a dev-graph `Issue` (type `risk`); link with `PrWidensGap` when it maps to a known `Gap`.
## Output
`05-pentest.json` (written by `lfg pentest`; you add triage notes and decisions). Reply with:
```
Pentest <mode> · target <local target> · model <ollama model> · turns <n>
critical <n> · high <n> · medium <n> · low <n> · false positives <n>
<one line per high/critical: id, file:symbol, what an attacker gets, proposed fix>
Gate 4: pass|fail
```
## Rules
+ - **A run filed under another repo** (this repo's tasks live in another repo's run, e.g. `/lfg` resumed that repo's handoff): write this repo's results as `05-pentest-<repo>.json`, with `<repo>` the repo's folder name (e.g. `aegis-compliance-portal`), never over the run's own files. The dashboard shows them under this repo, and the owner repo keeps its own.
- Offline only: Ollama on loopback, no API key, no image pulls, no public targets. Production is never a target.
- Never set `LLM_API_KEY`, change `STRIX_LLM` to a cloud model, or disable the firewall to get a run through.
- Exploit details stay in the run folder; Linear gets a one-line summary only, after an explicit yes.
- Report honestly: a run that stopped early or hit `--max-turns` is reported as partial.