@abdulr7man/pensieve 0.0.0-stage → 1.2.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 +684 -0
- package/README.md +180 -2
- package/VERSION +1 -0
- package/agents/README.md +16 -0
- package/agents/pensieve-code-auditor.md +58 -0
- package/agents/pensieve-mapper.md +46 -0
- package/agents/pensieve-planner.md +67 -0
- package/agents/pensieve-reconner.md +76 -0
- package/agents/pensieve-reporter.md +61 -0
- package/agents/pensieve-roe-checker.md +46 -0
- package/agents/pensieve-scoper.md +77 -0
- package/agents/pensieve-tester.md +83 -0
- package/agents/pensieve-validator.md +62 -0
- package/bin/pensieve +452 -0
- package/bin/pensieve-installer.cjs +5 -0
- package/commands/pensieve-close.md +6 -0
- package/commands/pensieve-map.md +6 -0
- package/commands/pensieve-new-engagement.md +6 -0
- package/commands/pensieve-pause.md +15 -0
- package/commands/pensieve-plan.md +6 -0
- package/commands/pensieve-progress.md +34 -0
- package/commands/pensieve-quick.md +8 -0
- package/commands/pensieve-recon.md +6 -0
- package/commands/pensieve-report.md +6 -0
- package/commands/pensieve-resume.md +6 -0
- package/commands/pensieve-retest.md +10 -0
- package/commands/pensieve-scope.md +49 -0
- package/commands/pensieve-surface.md +8 -0
- package/commands/pensieve-test.md +6 -0
- package/commands/pensieve-validate.md +6 -0
- package/docker/Dockerfile.pensieve-toolbox +75 -0
- package/docker/compose.pensieve-net.yml +37 -0
- package/docker/squid.conf.template +21 -0
- package/package.json +39 -4
- package/packs/ad/ad-killchain/checklist.md +64 -0
- package/packs/ad/ad-killchain/pack.yaml +19 -0
- package/packs/cloud/cloud-cis/checklist.md +66 -0
- package/packs/cloud/cloud-cis/pack.yaml +20 -0
- package/packs/fintech/practice-core/checklist.md +33 -0
- package/packs/fintech/practice-core/learnings.md +5 -0
- package/packs/fintech/practice-core/pack.yaml +18 -0
- package/packs/infra/ptes-infra/checklist.md +22 -0
- package/packs/infra/ptes-infra/pack.yaml +19 -0
- package/packs/mobile/owasp-masvs/checklist.md +80 -0
- package/packs/mobile/owasp-masvs/pack.yaml +20 -0
- package/packs/owasp-api-v4/checklist.md +85 -0
- package/packs/owasp-api-v4/learnings.md +6 -0
- package/packs/owasp-api-v4/pack.yaml +23 -0
- package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
- package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
- package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
- package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
- package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
- package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
- package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
- package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
- package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
- package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
- package/packs/thickclient/thickclient-core/checklist.md +60 -0
- package/packs/thickclient/thickclient-core/pack.yaml +24 -0
- package/packs/web/asvs-l2/checklist.md +50 -0
- package/packs/web/asvs-l2/learnings.md +6 -0
- package/packs/web/asvs-l2/pack.yaml +19 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
- package/packs/web/owasp-testing-checklist/checklist.md +52 -0
- package/packs/web/owasp-testing-checklist/learnings.md +47 -0
- package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
- package/packs/web/unauth-perimeter/checklist.md +72 -0
- package/packs/web/unauth-perimeter/pack.yaml +18 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
- package/packs/whitebox/code-audit-core/checklist.md +36 -0
- package/packs/whitebox/code-audit-core/learnings.md +6 -0
- package/packs/whitebox/code-audit-core/pack.yaml +14 -0
- package/prompts/orchestrator-core.md +52 -0
- package/reference/attack-playbooks.md +57 -0
- package/reference/otp-relay.md +98 -0
- package/reference/param-profiles.md +48 -0
- package/reference/templates/FINDING.md +97 -0
- package/reference/tool-selection.md +64 -0
- package/reference/vulnerability-finding-standard.md +80 -0
- package/runtimes/hermes/hooks/injection-scan.py +290 -0
- package/runtimes/hermes/hooks/scope-guard.py +136 -0
- package/skills/pensieve/SKILL.md +134 -0
- package/skills/pensieve-close/SKILL.md +31 -0
- package/skills/pensieve-map/SKILL.md +25 -0
- package/skills/pensieve-new-engagement/SKILL.md +28 -0
- package/skills/pensieve-pause/SKILL.md +22 -0
- package/skills/pensieve-plan/SKILL.md +39 -0
- package/skills/pensieve-progress/SKILL.md +35 -0
- package/skills/pensieve-quick/SKILL.md +47 -0
- package/skills/pensieve-recon/SKILL.md +30 -0
- package/skills/pensieve-report/SKILL.md +46 -0
- package/skills/pensieve-resume/SKILL.md +33 -0
- package/skills/pensieve-retest/SKILL.md +35 -0
- package/skills/pensieve-scope/SKILL.md +35 -0
- package/skills/pensieve-surface/SKILL.md +36 -0
- package/skills/pensieve-test/SKILL.md +35 -0
- package/skills/pensieve-validate/SKILL.md +28 -0
- package/skills/pensieve-wiki/SKILL.md +39 -0
- package/src/installer/cli.cjs +209 -0
- package/src/installer/home.cjs +155 -0
- package/src/installer/runtimes.cjs +276 -0
- package/src/installer/uninstall.cjs +342 -0
- package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
- package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
- package/src/pensieve-sdk/lib/approvals.cjs +408 -0
- package/src/pensieve-sdk/lib/audit.cjs +290 -0
- package/src/pensieve-sdk/lib/checklist.cjs +337 -0
- package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
- package/src/pensieve-sdk/lib/close.cjs +133 -0
- package/src/pensieve-sdk/lib/config.cjs +156 -0
- package/src/pensieve-sdk/lib/cvss.cjs +91 -0
- package/src/pensieve-sdk/lib/env.cjs +272 -0
- package/src/pensieve-sdk/lib/evidence.cjs +217 -0
- package/src/pensieve-sdk/lib/findings.cjs +1096 -0
- package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
- package/src/pensieve-sdk/lib/graph.cjs +607 -0
- package/src/pensieve-sdk/lib/ids.cjs +63 -0
- package/src/pensieve-sdk/lib/init.cjs +79 -0
- package/src/pensieve-sdk/lib/liveness.cjs +176 -0
- package/src/pensieve-sdk/lib/loop.cjs +619 -0
- package/src/pensieve-sdk/lib/migrate.cjs +57 -0
- package/src/pensieve-sdk/lib/monitor.cjs +69 -0
- package/src/pensieve-sdk/lib/pack.cjs +607 -0
- package/src/pensieve-sdk/lib/paths.cjs +73 -0
- package/src/pensieve-sdk/lib/pdf.cjs +291 -0
- package/src/pensieve-sdk/lib/recon.cjs +296 -0
- package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
- package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
- package/src/pensieve-sdk/lib/report.cjs +1135 -0
- package/src/pensieve-sdk/lib/runbook.cjs +124 -0
- package/src/pensieve-sdk/lib/sarif.cjs +154 -0
- package/src/pensieve-sdk/lib/scope.cjs +621 -0
- package/src/pensieve-sdk/lib/security.cjs +61 -0
- package/src/pensieve-sdk/lib/skills.cjs +193 -0
- package/src/pensieve-sdk/lib/state.cjs +610 -0
- package/src/pensieve-sdk/lib/subagent.cjs +658 -0
- package/src/pensieve-sdk/lib/target.cjs +149 -0
- package/src/pensieve-sdk/lib/tools.cjs +66 -0
- package/src/pensieve-sdk/lib/vault.cjs +122 -0
- package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
- package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
- package/src/pensieve-sdk/package.json +11 -0
- package/templates/ACCOUNTS.md +35 -0
- package/templates/ATTACK-SURFACE.md +30 -0
- package/templates/FINDING.md +43 -0
- package/templates/PLAN.md +33 -0
- package/templates/PROJECT.md +29 -0
- package/templates/ROE.md +50 -0
- package/templates/RUN-LOG.md +19 -0
- package/templates/SCOPE.md +32 -0
- package/templates/VALIDATION.md +62 -0
- package/templates/report/REPORT.md +49 -0
- package/workflows/close.md +34 -0
- package/workflows/map.md +39 -0
- package/workflows/new-engagement.md +37 -0
- package/workflows/plan.md +45 -0
- package/workflows/progress.md +28 -0
- package/workflows/quick.md +67 -0
- package/workflows/recon.md +87 -0
- package/workflows/report.md +51 -0
- package/workflows/resume.md +26 -0
- package/workflows/retest.md +53 -0
- package/workflows/scope.md +47 -0
- package/workflows/surface.md +29 -0
- package/workflows/test.md +95 -0
- package/workflows/validate.md +34 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* frontmatter.cjs — YAML-frontmatter subset parse/stringify/get/set.
|
|
4
|
+
* Strict subset by design (our templates write it, our parser reads it):
|
|
5
|
+
* nested maps (2-space indent), scalar lists, quoted/bare scalars.
|
|
6
|
+
* No anchors, no flow collections, no block scalars.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function parseScalar(raw) {
|
|
10
|
+
const s = raw.trim();
|
|
11
|
+
if (s === '' || s === 'null' || s === '~') return null;
|
|
12
|
+
if (s === '[]') return []; // emitYaml emits empty arrays in flow form —
|
|
13
|
+
if (s === '{}') return {}; // the subset must round-trip what it writes
|
|
14
|
+
if (s === 'true') return true;
|
|
15
|
+
if (s === 'false') return false;
|
|
16
|
+
if (/^-?\d+(\.\d+)?$/.test(s)) return Number(s);
|
|
17
|
+
if (s.length >= 2 && s.startsWith('"') && s.endsWith('"')) {
|
|
18
|
+
return s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
19
|
+
}
|
|
20
|
+
if (s.length >= 2 && s.startsWith("'") && s.endsWith("'")) {
|
|
21
|
+
return s.slice(1, -1).replace(/''/g, "'");
|
|
22
|
+
}
|
|
23
|
+
return s;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function stripComment(line) {
|
|
27
|
+
// strip ' #...' from unquoted values
|
|
28
|
+
let inS = false, inD = false;
|
|
29
|
+
for (let i = 0; i < line.length; i++) {
|
|
30
|
+
const c = line[i];
|
|
31
|
+
if (c === "'" && !inD) inS = !inS;
|
|
32
|
+
else if (c === '"' && !inS) inD = !inD;
|
|
33
|
+
else if (c === '#' && !inS && !inD && i > 0 && line[i - 1] === ' ') {
|
|
34
|
+
return line.slice(0, i);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return line;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function parseYaml(yamlText) {
|
|
41
|
+
const lines = yamlText.split('\n');
|
|
42
|
+
const root = {};
|
|
43
|
+
// stack entries: { indent, value } where value is the container object/array
|
|
44
|
+
const stack = [{ indent: -1, value: root }];
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < lines.length; i++) {
|
|
47
|
+
const line = lines[i];
|
|
48
|
+
if (!line.trim() || line.trim().startsWith('#')) continue;
|
|
49
|
+
const indent = line.match(/^ */)[0].length;
|
|
50
|
+
const content = stripComment(line.slice(indent)).replace(/\s+$/, '');
|
|
51
|
+
if (!content) continue;
|
|
52
|
+
|
|
53
|
+
while (stack.length > 1 && indent <= stack[stack.length - 1].indent) stack.pop();
|
|
54
|
+
const parent = stack[stack.length - 1].value;
|
|
55
|
+
|
|
56
|
+
if (content.startsWith('- ')) {
|
|
57
|
+
if (!Array.isArray(parent)) throw new Error(`list item outside list at line ${i + 1}`);
|
|
58
|
+
parent.push(parseScalar(content.slice(2)));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const m = /^([^:]+):(?:\s+(.*))?$/.exec(content);
|
|
63
|
+
if (!m) throw new Error(`cannot parse yaml line ${i + 1}: ${content}`);
|
|
64
|
+
const key = m[1].trim();
|
|
65
|
+
const rawVal = m[2];
|
|
66
|
+
|
|
67
|
+
if (rawVal !== undefined && rawVal.trim() !== '') {
|
|
68
|
+
if (typeof parent !== 'object' || Array.isArray(parent)) throw new Error(`map entry in non-map at line ${i + 1}`);
|
|
69
|
+
parent[key] = parseScalar(rawVal);
|
|
70
|
+
} else {
|
|
71
|
+
// look ahead: next meaningful line decides map vs list
|
|
72
|
+
let child = {};
|
|
73
|
+
for (let j = i + 1; j < lines.length; j++) {
|
|
74
|
+
const nl = lines[j];
|
|
75
|
+
if (!nl.trim() || nl.trim().startsWith('#')) continue;
|
|
76
|
+
const nIndent = nl.match(/^ */)[0].length;
|
|
77
|
+
const nContent = nl.slice(nIndent).trim();
|
|
78
|
+
if (nIndent > indent || (nIndent === indent && nContent.startsWith('- '))) {
|
|
79
|
+
if (nContent.startsWith('- ')) child = [];
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (typeof parent !== 'object' || Array.isArray(parent)) throw new Error(`map entry in non-map at line ${i + 1}`);
|
|
84
|
+
parent[key] = child;
|
|
85
|
+
stack.push({ indent, value: child });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return root;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function needsQuote(s) {
|
|
92
|
+
return (
|
|
93
|
+
s === '' ||
|
|
94
|
+
/^[\s\-?:,[\]{}#&*!|>'"%@`]/.test(s) ||
|
|
95
|
+
/[:#]/.test(s) ||
|
|
96
|
+
/\s$/.test(s) ||
|
|
97
|
+
/^(null|true|false|~|-?\d+(\.\d+)?)$/i.test(s)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function scalarToYaml(v) {
|
|
102
|
+
if (v === null || v === undefined) return 'null';
|
|
103
|
+
if (typeof v === 'boolean' || typeof v === 'number') return String(v);
|
|
104
|
+
const s = String(v);
|
|
105
|
+
if (needsQuote(s)) return '"' + s.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
|
|
106
|
+
return s;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function emitYaml(obj, indent, out) {
|
|
110
|
+
const pad = ' '.repeat(indent);
|
|
111
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
112
|
+
if (Array.isArray(v)) {
|
|
113
|
+
if (v.length === 0) { out.push(`${pad}${k}: []`); continue; }
|
|
114
|
+
out.push(`${pad}${k}:`);
|
|
115
|
+
for (const item of v) out.push(`${pad} - ${scalarToYaml(item)}`);
|
|
116
|
+
} else if (v !== null && typeof v === 'object') {
|
|
117
|
+
out.push(`${pad}${k}:`);
|
|
118
|
+
emitYaml(v, indent + 2, out);
|
|
119
|
+
} else {
|
|
120
|
+
out.push(`${pad}${k}: ${scalarToYaml(v)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const FENCE = /^---\s*$/;
|
|
127
|
+
|
|
128
|
+
function split(text) {
|
|
129
|
+
const lines = String(text).split('\n');
|
|
130
|
+
if (!FENCE.test(lines[0])) return { yaml: null, body: String(text) };
|
|
131
|
+
for (let i = 1; i < lines.length; i++) {
|
|
132
|
+
if (FENCE.test(lines[i])) {
|
|
133
|
+
return { yaml: lines.slice(1, i).join('\n'), body: lines.slice(i + 1).join('\n') };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { yaml: null, body: String(text) };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function parse(text) {
|
|
140
|
+
const { yaml, body } = split(text);
|
|
141
|
+
if (yaml === null) return { data: {}, body };
|
|
142
|
+
return { data: parseYaml(yaml), body: body.replace(/^\n/, '') };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function stringify(data, body) {
|
|
146
|
+
const out = emitYaml(data, 0, []);
|
|
147
|
+
const b = body === undefined ? '' : String(body);
|
|
148
|
+
return '---\n' + out.join('\n') + '\n---\n' + (b.startsWith('\n') || b === '' ? b : '\n' + b);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function getPath(obj, path) {
|
|
152
|
+
let cur = obj;
|
|
153
|
+
for (const part of String(path).split('.')) {
|
|
154
|
+
if (cur === null || typeof cur !== 'object') return undefined;
|
|
155
|
+
cur = cur[part];
|
|
156
|
+
}
|
|
157
|
+
return cur;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function get(text, path) {
|
|
161
|
+
return getPath(parse(text).data, path);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function set(text, path, value) {
|
|
165
|
+
const { data, body } = parse(text);
|
|
166
|
+
const parts = String(path).split('.');
|
|
167
|
+
let cur = data;
|
|
168
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
169
|
+
if (cur[parts[i]] === null || typeof cur[parts[i]] !== 'object' || Array.isArray(cur[parts[i]])) {
|
|
170
|
+
cur[parts[i]] = {};
|
|
171
|
+
}
|
|
172
|
+
cur = cur[parts[i]];
|
|
173
|
+
}
|
|
174
|
+
cur[parts[parts.length - 1]] = value;
|
|
175
|
+
return stringify(data, body);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = { parse, stringify, get, set, split, parseYaml, emitYaml };
|