@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.
Files changed (179) hide show
  1. package/LICENSE +684 -0
  2. package/README.md +180 -2
  3. package/VERSION +1 -0
  4. package/agents/README.md +16 -0
  5. package/agents/pensieve-code-auditor.md +58 -0
  6. package/agents/pensieve-mapper.md +46 -0
  7. package/agents/pensieve-planner.md +67 -0
  8. package/agents/pensieve-reconner.md +76 -0
  9. package/agents/pensieve-reporter.md +61 -0
  10. package/agents/pensieve-roe-checker.md +46 -0
  11. package/agents/pensieve-scoper.md +77 -0
  12. package/agents/pensieve-tester.md +83 -0
  13. package/agents/pensieve-validator.md +62 -0
  14. package/bin/pensieve +452 -0
  15. package/bin/pensieve-installer.cjs +5 -0
  16. package/commands/pensieve-close.md +6 -0
  17. package/commands/pensieve-map.md +6 -0
  18. package/commands/pensieve-new-engagement.md +6 -0
  19. package/commands/pensieve-pause.md +15 -0
  20. package/commands/pensieve-plan.md +6 -0
  21. package/commands/pensieve-progress.md +34 -0
  22. package/commands/pensieve-quick.md +8 -0
  23. package/commands/pensieve-recon.md +6 -0
  24. package/commands/pensieve-report.md +6 -0
  25. package/commands/pensieve-resume.md +6 -0
  26. package/commands/pensieve-retest.md +10 -0
  27. package/commands/pensieve-scope.md +49 -0
  28. package/commands/pensieve-surface.md +8 -0
  29. package/commands/pensieve-test.md +6 -0
  30. package/commands/pensieve-validate.md +6 -0
  31. package/docker/Dockerfile.pensieve-toolbox +75 -0
  32. package/docker/compose.pensieve-net.yml +37 -0
  33. package/docker/squid.conf.template +21 -0
  34. package/package.json +39 -4
  35. package/packs/ad/ad-killchain/checklist.md +64 -0
  36. package/packs/ad/ad-killchain/pack.yaml +19 -0
  37. package/packs/cloud/cloud-cis/checklist.md +66 -0
  38. package/packs/cloud/cloud-cis/pack.yaml +20 -0
  39. package/packs/fintech/practice-core/checklist.md +33 -0
  40. package/packs/fintech/practice-core/learnings.md +5 -0
  41. package/packs/fintech/practice-core/pack.yaml +18 -0
  42. package/packs/infra/ptes-infra/checklist.md +22 -0
  43. package/packs/infra/ptes-infra/pack.yaml +19 -0
  44. package/packs/mobile/owasp-masvs/checklist.md +80 -0
  45. package/packs/mobile/owasp-masvs/pack.yaml +20 -0
  46. package/packs/owasp-api-v4/checklist.md +85 -0
  47. package/packs/owasp-api-v4/learnings.md +6 -0
  48. package/packs/owasp-api-v4/pack.yaml +23 -0
  49. package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
  50. package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
  51. package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
  52. package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
  53. package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
  54. package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
  55. package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
  56. package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
  57. package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
  58. package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
  59. package/packs/thickclient/thickclient-core/checklist.md +60 -0
  60. package/packs/thickclient/thickclient-core/pack.yaml +24 -0
  61. package/packs/web/asvs-l2/checklist.md +50 -0
  62. package/packs/web/asvs-l2/learnings.md +6 -0
  63. package/packs/web/asvs-l2/pack.yaml +19 -0
  64. package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
  65. package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
  66. package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
  67. package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
  68. package/packs/web/owasp-testing-checklist/checklist.md +52 -0
  69. package/packs/web/owasp-testing-checklist/learnings.md +47 -0
  70. package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
  71. package/packs/web/unauth-perimeter/checklist.md +72 -0
  72. package/packs/web/unauth-perimeter/pack.yaml +18 -0
  73. package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
  74. package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
  75. package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
  76. package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
  77. package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
  78. package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
  79. package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
  80. package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
  81. package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
  82. package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
  83. package/packs/whitebox/code-audit-core/checklist.md +36 -0
  84. package/packs/whitebox/code-audit-core/learnings.md +6 -0
  85. package/packs/whitebox/code-audit-core/pack.yaml +14 -0
  86. package/prompts/orchestrator-core.md +52 -0
  87. package/reference/attack-playbooks.md +57 -0
  88. package/reference/otp-relay.md +98 -0
  89. package/reference/param-profiles.md +48 -0
  90. package/reference/templates/FINDING.md +97 -0
  91. package/reference/tool-selection.md +64 -0
  92. package/reference/vulnerability-finding-standard.md +80 -0
  93. package/runtimes/hermes/hooks/injection-scan.py +290 -0
  94. package/runtimes/hermes/hooks/scope-guard.py +136 -0
  95. package/skills/pensieve/SKILL.md +134 -0
  96. package/skills/pensieve-close/SKILL.md +31 -0
  97. package/skills/pensieve-map/SKILL.md +25 -0
  98. package/skills/pensieve-new-engagement/SKILL.md +28 -0
  99. package/skills/pensieve-pause/SKILL.md +22 -0
  100. package/skills/pensieve-plan/SKILL.md +39 -0
  101. package/skills/pensieve-progress/SKILL.md +35 -0
  102. package/skills/pensieve-quick/SKILL.md +47 -0
  103. package/skills/pensieve-recon/SKILL.md +30 -0
  104. package/skills/pensieve-report/SKILL.md +46 -0
  105. package/skills/pensieve-resume/SKILL.md +33 -0
  106. package/skills/pensieve-retest/SKILL.md +35 -0
  107. package/skills/pensieve-scope/SKILL.md +35 -0
  108. package/skills/pensieve-surface/SKILL.md +36 -0
  109. package/skills/pensieve-test/SKILL.md +35 -0
  110. package/skills/pensieve-validate/SKILL.md +28 -0
  111. package/skills/pensieve-wiki/SKILL.md +39 -0
  112. package/src/installer/cli.cjs +209 -0
  113. package/src/installer/home.cjs +155 -0
  114. package/src/installer/runtimes.cjs +276 -0
  115. package/src/installer/uninstall.cjs +342 -0
  116. package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
  117. package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
  118. package/src/pensieve-sdk/lib/approvals.cjs +408 -0
  119. package/src/pensieve-sdk/lib/audit.cjs +290 -0
  120. package/src/pensieve-sdk/lib/checklist.cjs +337 -0
  121. package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
  122. package/src/pensieve-sdk/lib/close.cjs +133 -0
  123. package/src/pensieve-sdk/lib/config.cjs +156 -0
  124. package/src/pensieve-sdk/lib/cvss.cjs +91 -0
  125. package/src/pensieve-sdk/lib/env.cjs +272 -0
  126. package/src/pensieve-sdk/lib/evidence.cjs +217 -0
  127. package/src/pensieve-sdk/lib/findings.cjs +1096 -0
  128. package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
  129. package/src/pensieve-sdk/lib/graph.cjs +607 -0
  130. package/src/pensieve-sdk/lib/ids.cjs +63 -0
  131. package/src/pensieve-sdk/lib/init.cjs +79 -0
  132. package/src/pensieve-sdk/lib/liveness.cjs +176 -0
  133. package/src/pensieve-sdk/lib/loop.cjs +619 -0
  134. package/src/pensieve-sdk/lib/migrate.cjs +57 -0
  135. package/src/pensieve-sdk/lib/monitor.cjs +69 -0
  136. package/src/pensieve-sdk/lib/pack.cjs +607 -0
  137. package/src/pensieve-sdk/lib/paths.cjs +73 -0
  138. package/src/pensieve-sdk/lib/pdf.cjs +291 -0
  139. package/src/pensieve-sdk/lib/recon.cjs +296 -0
  140. package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
  141. package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
  142. package/src/pensieve-sdk/lib/report.cjs +1135 -0
  143. package/src/pensieve-sdk/lib/runbook.cjs +124 -0
  144. package/src/pensieve-sdk/lib/sarif.cjs +154 -0
  145. package/src/pensieve-sdk/lib/scope.cjs +621 -0
  146. package/src/pensieve-sdk/lib/security.cjs +61 -0
  147. package/src/pensieve-sdk/lib/skills.cjs +193 -0
  148. package/src/pensieve-sdk/lib/state.cjs +610 -0
  149. package/src/pensieve-sdk/lib/subagent.cjs +658 -0
  150. package/src/pensieve-sdk/lib/target.cjs +149 -0
  151. package/src/pensieve-sdk/lib/tools.cjs +66 -0
  152. package/src/pensieve-sdk/lib/vault.cjs +122 -0
  153. package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
  154. package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
  155. package/src/pensieve-sdk/package.json +11 -0
  156. package/templates/ACCOUNTS.md +35 -0
  157. package/templates/ATTACK-SURFACE.md +30 -0
  158. package/templates/FINDING.md +43 -0
  159. package/templates/PLAN.md +33 -0
  160. package/templates/PROJECT.md +29 -0
  161. package/templates/ROE.md +50 -0
  162. package/templates/RUN-LOG.md +19 -0
  163. package/templates/SCOPE.md +32 -0
  164. package/templates/VALIDATION.md +62 -0
  165. package/templates/report/REPORT.md +49 -0
  166. package/workflows/close.md +34 -0
  167. package/workflows/map.md +39 -0
  168. package/workflows/new-engagement.md +37 -0
  169. package/workflows/plan.md +45 -0
  170. package/workflows/progress.md +28 -0
  171. package/workflows/quick.md +67 -0
  172. package/workflows/recon.md +87 -0
  173. package/workflows/report.md +51 -0
  174. package/workflows/resume.md +26 -0
  175. package/workflows/retest.md +53 -0
  176. package/workflows/scope.md +47 -0
  177. package/workflows/surface.md +29 -0
  178. package/workflows/test.md +95 -0
  179. 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 };