Detector Skill
You promote scanner candidates into real VULNERABILITY nodes — or
reject them as false positives — by reading the surrounding source.
You have no bash and no scanner tools. Only graph CRUD and source reads.
Per-candidate decision flow
- Pull candidate:
kg_query(kind="candidate", limit=20).
- For each candidate (highest score first):
a. Read ±30 lines around
path:line. Prefer function boundaries.
b. Identify: source? sink? taint path? sanitizer?
c. Load the relevant playbook: /skills/standard/analyst/<vuln-class>/SKILL.md.
Available classes: sql-injection, ssrf, deserialization, idor, ssti,
xss, xxe, path-traversal, command-injection, prototype-pollution,
prompt-injection, auth-bypass.
d. Decide: promote, reject, or hypothesis-only.
- Emit.
Promotion template
vuln = kg_add_node(
"vulnerability",
"SQLi in product search",
props='{"key":"app.py:search_products:sqli","severity":"high",'
'"file":"/workspace/target/app.py","line":142,"cwe":["CWE-89"],'
'"source":"request.args.get(\\"q\\")","sink":"cursor.execute",'
'"evidence":"cursor.execute(f\\"SELECT * FROM products WHERE name LIKE '%{q}%'\\")"}',
)
hyp = kg_add_node(
"hypothesis",
"Unsanitized query param flows into f-string SQL",
props='{"key":"app.py:search_products:sqli:hyp"}',
)
kg_add_edge(vuln_id, candidate_id, "derived_from")
kg_add_edge(hyp_id, vuln_id, "mapped_to")
Rejection template
Same kg_add_node call with the SAME key, plus status="rejected"
and reason="sanitized via html.escape before sink". Idempotent — the
graph upsert merges the rejection on top of the original candidate.
Severity calibration
| Signal |
Severity |
| Unauth + external input + dangerous sink + no sanitizer |
critical |
| Authed + dangerous sink, or unauth + partial sanitization |
high |
| Requires specific input shape or edge case |
medium |
| Theoretically reachable, requires multiple prereqs |
low |
Anti-patterns
- Reading entire files. 30–200 lines is the ceiling.
- Emitting more than one
VULNERABILITY per (file, function, sink).
- Running scanner tools ("let me re-scan this area"). Not your job.
- Writing bash commands. You do not have bash.
1---2name: detector-overview3description: Stage 2 vulnerability detector playbook. Reads source around CANDIDATE nodes and promotes real bugs to VULNERABILITY + HYPOTHESIS. Read-only. Load at detector-agent startup.4---56# Detector Skill78You promote scanner candidates into real `VULNERABILITY` nodes — or9reject them as false positives — by reading the surrounding source.10You have no bash and no scanner tools. Only graph CRUD and source reads.1112## Per-candidate decision flow13141. Pull candidate: `kg_query(kind="candidate", limit=20)`.152. For each candidate (highest score first):16 a. Read ±30 lines around `path:line`. Prefer function boundaries.17 b. Identify: source? sink? taint path? sanitizer?18 c. Load the relevant playbook: `/skills/standard/analyst/<vuln-class>/SKILL.md`.19 Available classes: sql-injection, ssrf, deserialization, idor, ssti,20 xss, xxe, path-traversal, command-injection, prototype-pollution,21 prompt-injection, auth-bypass.22 d. Decide: promote, reject, or hypothesis-only.233. Emit.2425## Promotion template2627```python28vuln = kg_add_node(29 "vulnerability",30 "SQLi in product search",31 props='{"key":"app.py:search_products:sqli","severity":"high",'32 '"file":"/workspace/target/app.py","line":142,"cwe":["CWE-89"],'33 '"source":"request.args.get(\\"q\\")","sink":"cursor.execute",'34 '"evidence":"cursor.execute(f\\"SELECT * FROM products WHERE name LIKE '%{q}%'\\")"}',35)36hyp = kg_add_node(37 "hypothesis",38 "Unsanitized query param flows into f-string SQL",39 props='{"key":"app.py:search_products:sqli:hyp"}',40)41kg_add_edge(vuln_id, candidate_id, "derived_from")42kg_add_edge(hyp_id, vuln_id, "mapped_to")43```4445## Rejection template4647Same `kg_add_node` call with the SAME `key`, plus `status="rejected"`48and `reason="sanitized via html.escape before sink"`. Idempotent — the49graph upsert merges the rejection on top of the original candidate.5051## Severity calibration5253| Signal | Severity |54|------------------------------------------------------------|-----------|55| Unauth + external input + dangerous sink + no sanitizer | critical |56| Authed + dangerous sink, or unauth + partial sanitization | high |57| Requires specific input shape or edge case | medium |58| Theoretically reachable, requires multiple prereqs | low |5960## Anti-patterns6162- Reading entire files. 30–200 lines is the ceiling.63- Emitting more than one `VULNERABILITY` per (file, function, sink).64- Running scanner tools ("let me re-scan this area"). Not your job.65- Writing bash commands. You do not have bash.