@xaccefy/pi-casefile 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +12 -8
- package/package.json +2 -2
- package/skills/casefile/SKILL.md +3 -3
- package/src/evidence.ts +1 -0
- package/src/harness-verify.ts +3 -3
- package/src/index.ts +319 -299
- package/src/ledger.ts +12 -12
- package/src/pipeline-submit.ts +34 -42
- package/src/scratchpad.ts +18 -5
- package/src/workflow.ts +38 -38
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -16,13 +16,17 @@ The attack-mode text stays **quiet by default** so your normal coding isn't buri
|
|
|
16
16
|
|
|
17
17
|
| Control | Effect |
|
|
18
18
|
|---------|--------|
|
|
19
|
-
| `/xp` | Toggle
|
|
20
|
-
| `/xp on`
|
|
21
|
-
| `
|
|
19
|
+
| `/xp` | Toggle SWARM/OFF |
|
|
20
|
+
| `/xp on` | Default enabled mode: SWARM |
|
|
21
|
+
| `/xp swarm` | Bounded multi-agent workflow: auditor/tracer/skeptic/chain only |
|
|
22
|
+
| `/xp lite` | Focused workflow: single-agent, no subagent dispatch |
|
|
23
|
+
| `/xp off` | Quiet mode explicitly |
|
|
24
|
+
| `PI_XP_MODE=on` | Force SWARM for this process (same as `swarm`) |
|
|
25
|
+
| `PI_XP_MODE=swarm` | Force SWARM for this process (overrides file) |
|
|
22
26
|
| `PI_XP_MODE=lite` | Force LITE (single-agent, no subagent dispatch) |
|
|
23
27
|
| `PI_XP_MODE=off` | Force OFF |
|
|
24
28
|
|
|
25
|
-
When **
|
|
29
|
+
When **LITE**, every prompt gets the attacker-minded workflow plus any open cases, done by the main agent alone — no `subagent` dispatch (CTF / single-shot engagements). When **SWARM**, the bounded pipeline is injected and only auditor/tracer/skeptic/chain are delegated; validation, patching, reporting, and ConfirmFinding stay with the main agent. When **OFF**, nothing is added; tools still work.
|
|
26
30
|
|
|
27
31
|
State is persisted next to the ledger as `xp-mode` (e.g. `.pi/xp-mode`).
|
|
28
32
|
|
|
@@ -48,10 +52,10 @@ hypothesis → investigating → confirmed → reported
|
|
|
48
52
|
|
|
49
53
|
- **investigating** needs `evidence` + `confidence`
|
|
50
54
|
- **confirmed** only through the two-phase gate — `PromoteFinding` runs the PoC 2× target + 1× control, requires complete zero-exit runs and nonce-bound discriminating response-body evidence, then the harness performs a DNS-pinned identical replay and requires two conclusive responses with `target_only`. Reflection-capable requests may add a post-PoC harness-generated canary that must appear only on target. Status-only/trivial matchers and incomplete response capture are rejected. Exit zero is necessary but never proof. The main agent performs semantic review and calls `ConfirmFinding`, which captures a second fresh harness replay and binds it to the verdict; worker processes are rejected. Blind/OOB claims fail closed without a source-separated oracle.
|
|
51
|
-
- **Every promotion requires
|
|
55
|
+
- **Every promotion requires a distinct `control_target`** pre-approved by the operator in `PI_POC_CONTROL_TARGETS`; an agent cannot invent its own easy control. `control_path` defaults to `poc_path` and exists only as an override — if supplied, it must contain the same bytes as the PoC (sha256 enforced). The control run is stored as `controlVerified`. Crashes, transport-inconclusive controls, status-only evidence, and missing evidence all block promotion.
|
|
52
56
|
- **New cases require `disproveIf`** — falsification conditions (what would disprove this hypothesis). A hypothesis that can't say what kills it isn't one yet.
|
|
53
57
|
- **A kill must be justified**: either an EvidenceAdd `refutation` item, or a canonical kill-reason token (intended_behavior, duplicate, framework_protection, out_of_scope, insufficient_impact, no_attack_path, ...) in assumptions/nextStep. Bare `status: "killed"` is rejected.
|
|
54
|
-
- **reported** needs `CaseContext` first (records the report path; the
|
|
58
|
+
- **reported** needs `CaseContext` first (records the report path; the main agent produces the final file)
|
|
55
59
|
- **killed** / **reported** are final (no more edits)
|
|
56
60
|
|
|
57
61
|
## Evidence items
|
|
@@ -65,8 +69,8 @@ hypothesis → investigating → confirmed → reported
|
|
|
65
69
|
| `CaseAdd` | Open a case (`title` + `disproveIf` required; start as `hypothesis` or `investigating`) |
|
|
66
70
|
| `CaseUpdate` | Evidence, impact, severity, status (not direct confirm) |
|
|
67
71
|
| `EvidenceAdd` | Role-typed, hashed evidence item on a case (refutation justifies kills; cleanup tracks cleanup) |
|
|
68
|
-
| `PromoteFinding` | Phase 1: PoC 2× target + 1× operator-approved control, then DNS-pinned harness-owned replay requiring conclusive `target_only`; optional reflection canary upgrades the recorded proof strength when observed only on target. `local:true` and private replay are operator-gated; blind/OOB proof fails closed without source separation |
|
|
69
|
-
| `ConfirmFinding` | Phase 2: main-agent-only semantic decision plus a fresh harness-owned target/control replay (CONFIRMED promotes; NOT_CONFIRMED keeps investigating; worker calls are rejected) |
|
|
72
|
+
| `PromoteFinding` | Phase 1: main-agent-only PoC 2× target + 1× operator-approved control, then DNS-pinned harness-owned replay requiring conclusive `target_only`; optional reflection canary upgrades the recorded proof strength when observed only on target. `local:true` and private replay are operator-gated; blind/OOB proof fails closed without source separation |
|
|
73
|
+
| `ConfirmFinding` | Phase 2: main-agent-only semantic decision plus a fresh harness-owned target/control replay (CONFIRMED promotes; NOT_CONFIRMED keeps investigating; worker/subagent gate calls are rejected) |
|
|
70
74
|
| `CaseGet` / `CaseList` / `CaseSearch` | Read / filter / search |
|
|
71
75
|
| `CaseLink` / `CaseUnlink` | Bidirectional exploit chains |
|
|
72
76
|
| `ChainSuggest` | Scan cases for exploitable chain combinations (credential+endpoint→ATO, redirect+OAuth→token theft, XSS+state-change→CSRF, IDOR+user-data, SSTI→RCE, race+payment, info-disclosure+SSRF), ranked by confidence |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaccefy/pi-casefile",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Offensive security case tracker for Pi Agent — bug bounties, CTFs, security audits",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"main": "src/index.ts",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@xaccefy/pi-shared": "0.9.
|
|
52
|
+
"@xaccefy/pi-shared": "0.9.2",
|
|
53
53
|
"undici": "^8.9.0"
|
|
54
54
|
},
|
|
55
55
|
"pi": {
|
package/skills/casefile/SKILL.md
CHANGED
|
@@ -13,9 +13,9 @@ Use Casefile to maintain durable security investigation state across agent turns
|
|
|
13
13
|
1. Check existing cases before opening a new one with CaseList or CaseSearch.
|
|
14
14
|
2. Open new leads with CaseAdd as `hypothesis` or `investigating`.
|
|
15
15
|
3. Promote cases with CaseUpdate only after materially new evidence, proof, impact, blockers, remediation, or status changes.
|
|
16
|
-
4. Mark `confirmed` only via the two-phase gate — `PromoteFinding` (PoC 2× target + 1× operator-approved control, nonce-bound body evidence, then a DNS-pinned conclusive `target_only` replay; use the post-PoC harness-generated canary for reflection-capable requests) → the main agent personally reviews → `ConfirmFinding`, which captures a fresh second harness replay before commit. Never delegate
|
|
16
|
+
4. Mark `confirmed` only via the two-phase gate — main-agent `PromoteFinding` (PoC 2× target + 1× operator-approved control, nonce-bound body evidence, then a DNS-pinned conclusive `target_only` replay; use the post-PoC harness-generated canary for reflection-capable requests) → the main agent personally reviews → `ConfirmFinding`, which captures a fresh second harness replay before commit. Never delegate validation or confirmation; worker/subagent gate calls are rejected. Exit zero is run integrity, never vulnerability proof. A predicate differential is evidence, not an automatic exploit verdict. Blind/OOB findings remain investigating without a source-separated oracle.
|
|
17
17
|
5. Use CaseLink and CaseUnlink for exploit chains. Do not edit linked case IDs directly.
|
|
18
|
-
6. Use CaseContext only for confirmed or already reported cases: it writes the full context bundle (complete record, verification logs, links, pipeline artifacts) and records the report path. Then
|
|
18
|
+
6. Use CaseContext only for confirmed or already reported cases: it writes the full context bundle (complete record, verification logs, links, pipeline artifacts) and records the report path. Then write the report and CaseUpdate status=`reported`.
|
|
19
19
|
7. Use `killed` for disproven, duplicate, or dead-end leads, and include evidence, blockers, next step, or assumptions explaining why.
|
|
20
20
|
|
|
21
21
|
## State machine
|
|
@@ -41,4 +41,4 @@ hypothesis → investigating → confirmed → reported
|
|
|
41
41
|
- `CaseSearch`: search all fields or a scoped field.
|
|
42
42
|
- `CaseLink`: bidirectionally link two cases.
|
|
43
43
|
- `CaseUnlink`: remove a bidirectional case link.
|
|
44
|
-
- `CaseContext`: write the case context bundle (complete record, PoC/disconfirmation logs, links, pipeline artifacts) for a confirmed or reported case and record the report path for the
|
|
44
|
+
- `CaseContext`: write the case context bundle (complete record, PoC/disconfirmation logs, links, pipeline artifacts) for a confirmed or reported case and record the report path for the main agent.
|
package/src/evidence.ts
CHANGED
|
@@ -137,6 +137,7 @@ function validRegexArray(v: unknown): v is string[] {
|
|
|
137
137
|
boundedStringArray(v, MAX_REGEX_VALUES, MAX_REGEX_CHARS) &&
|
|
138
138
|
v.every((re) => {
|
|
139
139
|
try {
|
|
140
|
+
// nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp -- compile-only validation; evaluation runs in a worker with a hard timeout.
|
|
140
141
|
new RegExp(re);
|
|
141
142
|
return true;
|
|
142
143
|
} catch {
|
package/src/harness-verify.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Harness-side target/control replay — Tier 2 of docs/poc-trust-model.md.
|
|
3
3
|
*
|
|
4
|
-
* The machine floor cannot trust a
|
|
4
|
+
* The machine floor cannot trust a caller's self-reported `re_executed`
|
|
5
5
|
* boolean. This module makes the HARNESS re-send the evidence's `verify`
|
|
6
6
|
* request with its own HTTP client and apply the same `expect` predicates
|
|
7
7
|
* (status / body_contains / body_regex) to target and control responses. The
|
|
8
|
-
*
|
|
9
|
-
* and predicate execution
|
|
8
|
+
* main agent supplies the predicate; the harness owns both evidence acquisition
|
|
9
|
+
* and predicate execution before the later semantic review.
|
|
10
10
|
*
|
|
11
11
|
* Policy:
|
|
12
12
|
* - Private/internal hosts require explicit operator authorization; otherwise
|