@xaccefy/pi-casefile 0.3.1 → 0.5.1
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/README.md +8 -8
- package/package.json +1 -1
- package/src/index.ts +37 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-casefile
|
|
2
2
|
|
|
3
|
-
Local
|
|
3
|
+
Local security case book for Pi Agent. Keeps your guesses → proven findings behind a PoC gate, saved in SQLite, run in a sandbox.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ Or via the XPI umbrella package: `pi install npm:@xaccefy/pi-xpi`
|
|
|
12
12
|
|
|
13
13
|
## XP mode (default OFF)
|
|
14
14
|
|
|
15
|
-
The
|
|
15
|
+
The attack-mode text stays **quiet by default** so your normal coding isn't buried in security talk.
|
|
16
16
|
|
|
17
17
|
| Control | Effect |
|
|
18
18
|
|---------|--------|
|
|
@@ -21,7 +21,7 @@ The cyber-workflow context injection is **quiet by default** so normal dev work
|
|
|
21
21
|
| `PI_XP_MODE=on` | Force ON for this process (overrides file) |
|
|
22
22
|
| `PI_XP_MODE=off` | Force OFF |
|
|
23
23
|
|
|
24
|
-
When **ON**, every prompt
|
|
24
|
+
When **ON**, every prompt gets the attacker-minded workflow plus any open cases. When **OFF**, nothing is added; tools still work.
|
|
25
25
|
|
|
26
26
|
State is persisted next to the ledger as `xp-mode` (e.g. `.pi/xp-mode`).
|
|
27
27
|
|
|
@@ -42,12 +42,12 @@ hypothesis → investigating → confirmed → reported
|
|
|
42
42
|
blocked killed (terminal)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
- **investigating**
|
|
46
|
-
- **confirmed** only
|
|
47
|
-
- **reported**
|
|
48
|
-
- **killed** / **reported** are
|
|
45
|
+
- **investigating** needs `evidence` + `confidence`
|
|
46
|
+
- **confirmed** only by running the PoC (`PromoteFinding`, exit 0) — you can't just set status to confirmed
|
|
47
|
+
- **reported** needs `CaseReport` first
|
|
48
|
+
- **killed** / **reported** are final (no more edits)
|
|
49
49
|
|
|
50
|
-
There is **no** `impact_proof`
|
|
50
|
+
There is **no** `impact_proof` field. Put proof in `impact` or `evidence`.
|
|
51
51
|
|
|
52
52
|
## Tools
|
|
53
53
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -487,6 +487,43 @@ Keep killed reasons explicit in assumptions/blockers:
|
|
|
487
487
|
- \`environmental_issue\`
|
|
488
488
|
- \`not_applicable\` (true bug / interesting behavior, no realistic attacker value)
|
|
489
489
|
Documenting kills prevents re-opening dead ends.
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## 9. Tool Ecosystem (USE PROACTIVELY)
|
|
494
|
+
|
|
495
|
+
You have offensive tools beyond casefile. Use them — do not rely on memory or guesswork.
|
|
496
|
+
|
|
497
|
+
| Tool | When to use | Do NOT skip it when... |
|
|
498
|
+
|------|------------|------------------------|
|
|
499
|
+
| **ExploitSearch** | Before writing any PoC. Search for known techniques, bypasses, and attack primitives relevant to the target stack/vuln class. | ...you are investigating a hypothesis or building a PoC. Ground your approach in real write-ups, not memory. |
|
|
500
|
+
| **engage** | When testing a live web target that requires authentication. Add a session (cookie/OAuth/mTLS) then run curl/httpx/ffuf with auth injected. | ...the user has supplied credentials or a target URL for authenticated testing. |
|
|
501
|
+
| **web_search** | To find CVEs, advisories, prior bug reports, documentation, or any live information about the target. | ...you need to check if a vulnerability is known, find version-specific issues, or research a technology. |
|
|
502
|
+
| **web_fetch** | To read full page content from a URL you already have (advisory, write-up, target page). | ...you have a specific URL to inspect. |
|
|
503
|
+
| **context7** | To look up current library/framework API docs and behavior. | ...you need to understand how a framework feature works (auth, parsing, routing). |
|
|
504
|
+
| **deepwiki** | To ask questions about a public GitHub repository's architecture and internals. | ...the target is an open-source project and you need to understand its design. |
|
|
505
|
+
| **codebase-memory-mcp** | To index a codebase and trace source-to-sink paths. index_repository, get_architecture, search_graph, trace_path. | ...you have access to the target source code and need structural reachability analysis. |
|
|
506
|
+
|
|
507
|
+
**pdtm CLI tools** (run via bash; each takes auth/flags differently — read the flags, do not guess):
|
|
508
|
+
- subfinder -d host (-silent, -t threads) — passive subdomain enum from API sources; no target auth. Pipe to httpx, not straight to nuclei.
|
|
509
|
+
- httpx -u <url> / -l hosts.txt (-t threads, -td tech-detect, -mc match-status, -H "Name: Value") — fast probe of authed endpoints; supports Header/Cookie/Bearer.
|
|
510
|
+
- ffuf -u <url> -w wordlist (-t threads, -rate, -H "..." -b "c=v", -mc/-fs filters) — authed fuzzing / content discovery.
|
|
511
|
+
- whatweb <url> (-a aggression 1-4, -t threads, --cookie) — tech fingerprint; positional URL, no -u.
|
|
512
|
+
- naabu -host <ip> / -l (-p ports, -rate, -c top-ports) — port scan; hosts, not web-auth.
|
|
513
|
+
- katana -u <url> / -list (-d depth, -jc js-crawl, -H "...") — crawl (engage spider already does authed crawl).
|
|
514
|
+
- nuclei -l hosts.txt / -u <url> (-tags, -severity, -type http, -silent; -c threads -bs host-batch -rl rate-limit -timeout 5 -retries 0): FAST when filtered, slow only if naive.
|
|
515
|
+
- Do not run all 9000+ templates. Filter: -tags cve,exposure,rce -severity critical,high -type http -t http/misconfiguration/.
|
|
516
|
+
- Pre-filter targets: subfinder -> httpx -mc 200,403 -> nuclei (cuts ~80% of work).
|
|
517
|
+
- Tune: -c 100-200 -bs 50-100 -rl 300 (avoid Cloudflare tarpit) -timeout 5 -retries 0 -mhe 10.
|
|
518
|
+
- Many hosts: -scan-strategy host-spray (v3). Few hosts many templates: template-spray.
|
|
519
|
+
- engage is auth/session/creds only (cookie/OAuth/mTLS, signup/login) — not a general scanner.
|
|
520
|
+
|
|
521
|
+
**Default behavior when XP mode is ON:**
|
|
522
|
+
1. Start recon with ExploitSearch + web_search before diving into code.
|
|
523
|
+
2. Use engage for any authenticated web target the user has set up.
|
|
524
|
+
3. Use context7/deepwiki to understand framework internals before claiming a vuln.
|
|
525
|
+
4. Use codebase-memory-mcp (if available) to prove reachability structurally.
|
|
526
|
+
5. Log everything to casefile (CaseAdd/CaseUpdate). Do not skip the ledger.
|
|
490
527
|
`.trim();
|
|
491
528
|
|
|
492
529
|
function sanitizeContextText(v?: string, max = 160): string | undefined {
|