fivosense 0.1.6 → 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 (132) hide show
  1. package/.kilo/skill/fivosense/skill.json +5 -5
  2. package/DEPLOYMENT_GUIDE.md +2 -2
  3. package/GITHUB_PUSH.md +4 -4
  4. package/LICENSE +1 -1
  5. package/README.md +290 -208
  6. package/RELEASE_READY.md +3 -3
  7. package/bin/fivosense.mjs +6 -0
  8. package/dist/ai/client.d.ts +6 -0
  9. package/dist/ai/client.d.ts.map +1 -1
  10. package/dist/ai/client.js +4 -1
  11. package/dist/ai/client.js.map +1 -1
  12. package/dist/ai/judge.d.ts +6 -0
  13. package/dist/ai/judge.d.ts.map +1 -1
  14. package/dist/ai/judge.js +6 -0
  15. package/dist/ai/judge.js.map +1 -1
  16. package/dist/cli/index.d.ts +3 -1
  17. package/dist/cli/index.d.ts.map +1 -1
  18. package/dist/cli/index.js +6 -1
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/core/orchestrator.d.ts +4 -1
  21. package/dist/core/orchestrator.d.ts.map +1 -1
  22. package/dist/core/orchestrator.js +6 -0
  23. package/dist/core/orchestrator.js.map +1 -1
  24. package/dist/core/scope.d.ts +4 -1
  25. package/dist/core/scope.d.ts.map +1 -1
  26. package/dist/core/scope.js +6 -0
  27. package/dist/core/scope.js.map +1 -1
  28. package/dist/editors/vscode.d.ts +4 -2
  29. package/dist/editors/vscode.d.ts.map +1 -1
  30. package/dist/editors/vscode.js +6 -0
  31. package/dist/editors/vscode.js.map +1 -1
  32. package/dist/engine/adversary.d.ts +6 -0
  33. package/dist/engine/adversary.d.ts.map +1 -1
  34. package/dist/engine/adversary.js +4 -1
  35. package/dist/engine/adversary.js.map +1 -1
  36. package/dist/engine/graph.d.ts +4 -1
  37. package/dist/engine/graph.d.ts.map +1 -1
  38. package/dist/engine/graph.js +6 -0
  39. package/dist/engine/graph.js.map +1 -1
  40. package/dist/engine/poc.d.ts +6 -0
  41. package/dist/engine/poc.d.ts.map +1 -1
  42. package/dist/engine/poc.js +4 -1
  43. package/dist/engine/poc.js.map +1 -1
  44. package/dist/engine/reach.d.ts +4 -2
  45. package/dist/engine/reach.d.ts.map +1 -1
  46. package/dist/engine/reach.js +6 -0
  47. package/dist/engine/reach.js.map +1 -1
  48. package/dist/engine/sinks.d.ts +22 -32
  49. package/dist/engine/sinks.d.ts.map +1 -1
  50. package/dist/engine/sinks.js +338 -44
  51. package/dist/engine/sinks.js.map +1 -1
  52. package/dist/engine/sources.d.ts +11 -19
  53. package/dist/engine/sources.d.ts.map +1 -1
  54. package/dist/engine/sources.js +100 -24
  55. package/dist/engine/sources.js.map +1 -1
  56. package/dist/engine/taint.d.ts +6 -0
  57. package/dist/engine/taint.d.ts.map +1 -1
  58. package/dist/engine/taint.js +6 -0
  59. package/dist/engine/taint.js.map +1 -1
  60. package/dist/engine/verify.d.ts +4 -1
  61. package/dist/engine/verify.d.ts.map +1 -1
  62. package/dist/engine/verify.js +6 -0
  63. package/dist/engine/verify.js.map +1 -1
  64. package/dist/features/badge.d.ts +6 -0
  65. package/dist/features/badge.d.ts.map +1 -1
  66. package/dist/features/badge.js +4 -1
  67. package/dist/features/badge.js.map +1 -1
  68. package/dist/features/fix.d.ts +6 -0
  69. package/dist/features/fix.d.ts.map +1 -1
  70. package/dist/features/fix.js +4 -1
  71. package/dist/features/fix.js.map +1 -1
  72. package/dist/features/index.d.ts +6 -0
  73. package/dist/features/index.d.ts.map +1 -1
  74. package/dist/features/index.js +6 -0
  75. package/dist/features/index.js.map +1 -1
  76. package/dist/features/roast.d.ts +6 -0
  77. package/dist/features/roast.d.ts.map +1 -1
  78. package/dist/features/roast.js +4 -1
  79. package/dist/features/roast.js.map +1 -1
  80. package/dist/hooks/agent.d.ts +4 -1
  81. package/dist/hooks/agent.d.ts.map +1 -1
  82. package/dist/hooks/agent.js +6 -0
  83. package/dist/hooks/agent.js.map +1 -1
  84. package/dist/hooks/git.d.ts +4 -1
  85. package/dist/hooks/git.d.ts.map +1 -1
  86. package/dist/hooks/git.js +6 -0
  87. package/dist/hooks/git.js.map +1 -1
  88. package/dist/index.d.ts +4 -2
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +6 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/rules/destructive.d.ts +12 -21
  93. package/dist/rules/destructive.d.ts.map +1 -1
  94. package/dist/rules/destructive.js +306 -24
  95. package/dist/rules/destructive.js.map +1 -1
  96. package/dist/rules/secrets.d.ts +8 -10
  97. package/dist/rules/secrets.d.ts.map +1 -1
  98. package/dist/rules/secrets.js +294 -17
  99. package/dist/rules/secrets.js.map +1 -1
  100. package/mcp/index.js +7 -0
  101. package/mcp/package-lock.json +2 -2
  102. package/mcp/package.json +21 -4
  103. package/package.json +5 -5
  104. package/src/ai/client.ts +7 -0
  105. package/src/ai/judge.ts +7 -0
  106. package/src/cli/index.ts +7 -1
  107. package/src/core/orchestrator.ts +7 -0
  108. package/src/core/scope.ts +7 -0
  109. package/src/editors/vscode.ts +7 -0
  110. package/src/engine/adversary.ts +7 -0
  111. package/src/engine/graph.ts +7 -0
  112. package/src/engine/poc.ts +7 -0
  113. package/src/engine/reach.ts +7 -0
  114. package/src/engine/sinks.ts +358 -45
  115. package/src/engine/sources.ts +109 -24
  116. package/src/engine/taint.ts +7 -0
  117. package/src/engine/verify.ts +7 -0
  118. package/src/features/badge.ts +7 -0
  119. package/src/features/fix.ts +7 -0
  120. package/src/features/index.ts +7 -0
  121. package/src/features/roast.ts +7 -0
  122. package/src/hooks/agent.ts +7 -0
  123. package/src/hooks/git.ts +7 -0
  124. package/src/index.ts +7 -0
  125. package/src/rules/destructive.ts +316 -26
  126. package/src/rules/secrets.ts +306 -17
  127. package/vscode-extension/CHANGELOG.md +14 -2
  128. package/vscode-extension/LICENSE +1 -1
  129. package/vscode-extension/README.md +28 -23
  130. package/vscode-extension/fivosense-vscode-0.1.1.vsix +0 -0
  131. package/vscode-extension/package-lock.json +6 -6
  132. package/vscode-extension/package.json +5 -3
@@ -1,59 +1,147 @@
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
  * Catalog of untrusted input sources (taint origins)
3
10
  * These represent user-controlled data that could be malicious
11
+ * 40+ patterns across 8 categories
4
12
  */
5
13
 
6
14
  export interface SourcePattern {
7
15
  pattern: string;
8
- category: 'http' | 'file' | 'env' | 'cli' | 'external';
16
+ category: 'http' | 'file' | 'env' | 'cli' | 'external' | 'browser' | 'websocket' | 'process';
9
17
  description: string;
10
18
  severity: 'critical' | 'high' | 'medium';
11
19
  }
12
20
 
13
- /**
14
- * HTTP/API sources - user input from web requests
15
- */
21
+ // ============================================================
22
+ // HTTP/API sources user input from web requests
23
+ // ============================================================
16
24
  export const HTTP_SOURCES: SourcePattern[] = [
17
25
  { pattern: 'req.query', category: 'http', description: 'URL query parameters', severity: 'critical' },
18
26
  { pattern: 'req.params', category: 'http', description: 'Route parameters', severity: 'critical' },
19
27
  { pattern: 'req.body', category: 'http', description: 'Request body', severity: 'critical' },
20
28
  { pattern: 'req.headers', category: 'http', description: 'HTTP headers', severity: 'high' },
21
29
  { pattern: 'req.cookies', category: 'http', description: 'Cookies', severity: 'high' },
30
+ { pattern: 'req.files', category: 'http', description: 'Uploaded files', severity: 'critical' },
31
+ { pattern: 'req.file', category: 'http', description: 'Single uploaded file', severity: 'critical' },
32
+ { pattern: 'req.ip', category: 'http', description: 'Client IP address', severity: 'medium' },
33
+ { pattern: 'req.hostname', category: 'http', description: 'Request hostname', severity: 'medium' },
34
+ { pattern: 'req.path', category: 'http', description: 'Request path', severity: 'high' },
35
+ { pattern: 'req.url', category: 'http', description: 'Full request URL', severity: 'high' },
36
+ { pattern: 'req.originalUrl', category: 'http', description: 'Original request URL', severity: 'high' },
37
+ { pattern: 'req.get(', category: 'http', description: 'Get specific header', severity: 'high' },
38
+ { pattern: 'req.header(', category: 'http', description: 'Get header value', severity: 'high' },
22
39
  { pattern: 'request.query', category: 'http', description: 'Query string', severity: 'critical' },
23
40
  { pattern: 'request.body', category: 'http', description: 'Request body', severity: 'critical' },
24
- { pattern: 'ctx.request.body', category: 'http', description: 'Koa/context body', severity: 'critical' },
41
+ { pattern: 'request.headers', category: 'http', description: 'Request headers', severity: 'high' },
42
+ { pattern: 'request.params', category: 'http', description: 'Request params', severity: 'critical' },
43
+ { pattern: 'ctx.request.body', category: 'http', description: 'Koa context body', severity: 'critical' },
25
44
  { pattern: 'ctx.query', category: 'http', description: 'Koa query', severity: 'critical' },
45
+ { pattern: 'ctx.params', category: 'http', description: 'Koa params', severity: 'critical' },
46
+ { pattern: 'ctx.headers', category: 'http', description: 'Koa headers', severity: 'high' },
47
+ { pattern: 'event.body', category: 'http', description: 'Lambda event body', severity: 'critical' },
48
+ { pattern: 'event.queryStringParameters', category: 'http', description: 'Lambda query params', severity: 'critical' },
49
+ { pattern: 'event.pathParameters', category: 'http', description: 'Lambda path params', severity: 'critical' },
50
+ { pattern: 'event.headers', category: 'http', description: 'Lambda headers', severity: 'high' },
26
51
  ];
27
52
 
28
- /**
29
- * File system sources - external file content
30
- */
53
+ // ============================================================
54
+ // File system sources external file content
55
+ // ============================================================
31
56
  export const FILE_SOURCES: SourcePattern[] = [
32
- { pattern: 'fs.readFileSync', category: 'file', description: 'File content', severity: 'high' },
33
- { pattern: 'fs.readFile', category: 'file', description: 'File content async', severity: 'high' },
34
- { pattern: 'readFileSync', category: 'file', description: 'File read', severity: 'high' },
57
+ { pattern: 'fs.readFileSync', category: 'file', description: 'Sync file read', severity: 'high' },
58
+ { pattern: 'fs.readFile', category: 'file', description: 'Async file read', severity: 'high' },
59
+ { pattern: 'readFileSync', category: 'file', description: 'Read file sync', severity: 'high' },
60
+ { pattern: 'fs.createReadStream', category: 'file', description: 'Create read stream', severity: 'high' },
61
+ { pattern: 'fs.promises.readFile', category: 'file', description: 'Promise file read', severity: 'high' },
62
+ { pattern: 'fs.watch', category: 'file', description: 'File watch events', severity: 'medium' },
63
+ { pattern: 'fs.watchFile', category: 'file', description: 'File watch', severity: 'medium' },
35
64
  ];
36
65
 
37
- /**
38
- * Environment/config sources - potentially untrusted config
39
- */
66
+ // ============================================================
67
+ // Environment/config sources
68
+ // ============================================================
40
69
  export const ENV_SOURCES: SourcePattern[] = [
41
70
  { pattern: 'process.env', category: 'env', description: 'Environment variables', severity: 'medium' },
42
71
  { pattern: 'process.argv', category: 'cli', description: 'Command-line arguments', severity: 'high' },
72
+ { pattern: 'process.stdin', category: 'process', description: 'Standard input', severity: 'high' },
73
+ { pattern: 'process.cwd', category: 'process', description: 'Current working directory', severity: 'medium' },
74
+ { pattern: 'process.platform', category: 'process', description: 'OS platform', severity: 'medium' },
75
+ { pattern: 'process.arch', category: 'process', description: 'CPU architecture', severity: 'medium' },
76
+ { pattern: 'process.env.PATH', category: 'env', description: 'PATH environment variable', severity: 'high' },
77
+ { pattern: 'process.env.HOME', category: 'env', description: 'Home directory', severity: 'medium' },
78
+ { pattern: 'process.env.USER', category: 'env', description: 'Current user', severity: 'medium' },
43
79
  ];
44
80
 
45
- /**
46
- * All sources combined
47
- */
48
- export const ALL_SOURCES = [
81
+ // ============================================================
82
+ // Browser sources — client-side user input
83
+ // ============================================================
84
+ export const BROWSER_SOURCES: SourcePattern[] = [
85
+ { pattern: 'document.location', category: 'browser', description: 'Document location', severity: 'high' },
86
+ { pattern: 'window.location', category: 'browser', description: 'Window location', severity: 'high' },
87
+ { pattern: 'location.hash', category: 'browser', description: 'URL hash fragment', severity: 'high' },
88
+ { pattern: 'location.search', category: 'browser', description: 'URL query string', severity: 'high' },
89
+ { pattern: 'location.href', category: 'browser', description: 'Full URL', severity: 'high' },
90
+ { pattern: 'document.referrer', category: 'browser', description: 'Referrer URL', severity: 'high' },
91
+ { pattern: 'document.cookie', category: 'browser', description: 'Browser cookies', severity: 'high' },
92
+ { pattern: 'document.URL', category: 'browser', description: 'Document URL', severity: 'high' },
93
+ { pattern: 'localStorage.getItem', category: 'browser', description: 'LocalStorage data', severity: 'medium' },
94
+ { pattern: 'sessionStorage.getItem', category: 'browser', description: 'SessionStorage data', severity: 'medium' },
95
+ { pattern: 'window.name', category: 'browser', description: 'Window name', severity: 'medium' },
96
+ { pattern: 'postMessage', category: 'browser', description: 'Cross-origin message', severity: 'high' },
97
+ { pattern: 'addEventListener("message"', category: 'browser', description: 'Message event listener', severity: 'high' },
98
+ { pattern: "addEventListener('message'", category: 'browser', description: 'Message event listener', severity: 'high' },
99
+ { pattern: 'event.data', category: 'browser', description: 'Event data', severity: 'high' },
100
+ { pattern: 'e.data', category: 'browser', description: 'Event data shorthand', severity: 'high' },
101
+ { pattern: 'this.value', category: 'browser', description: 'Input element value', severity: 'high' },
102
+ { pattern: 'target.value', category: 'browser', description: 'Event target value', severity: 'high' },
103
+ { pattern: 'input.value', category: 'browser', description: 'Input field value', severity: 'high' },
104
+ { pattern: 'textarea.value', category: 'browser', description: 'Textarea value', severity: 'high' },
105
+ ];
106
+
107
+ // ============================================================
108
+ // WebSocket sources
109
+ // ============================================================
110
+ export const WEBSOCKET_SOURCES: SourcePattern[] = [
111
+ { pattern: 'ws.on("message"', category: 'websocket', description: 'WebSocket message', severity: 'critical' },
112
+ { pattern: "ws.on('message'", category: 'websocket', description: 'WebSocket message', severity: 'critical' },
113
+ { pattern: 'socket.on("data"', category: 'websocket', description: 'Socket data', severity: 'critical' },
114
+ { pattern: "socket.on('data'", category: 'websocket', description: 'Socket data', severity: 'critical' },
115
+ { pattern: 'socket.on("message"', category: 'websocket', description: 'Socket message', severity: 'critical' },
116
+ { pattern: "socket.on('message'", category: 'websocket', description: 'Socket message', severity: 'critical' },
117
+ { pattern: 'wss.on("connection"', category: 'websocket', description: 'WebSocket connection', severity: 'high' },
118
+ ];
119
+
120
+ // ============================================================
121
+ // External data sources
122
+ // ============================================================
123
+ export const EXTERNAL_SOURCES: SourcePattern[] = [
124
+ { pattern: 'JSON.parse', category: 'external', description: 'JSON parse (external data)', severity: 'medium' },
125
+ { pattern: 'URLSearchParams', category: 'external', description: 'URL search params', severity: 'high' },
126
+ { pattern: 'FormData', category: 'external', description: 'Form data', severity: 'high' },
127
+ { pattern: 'XMLHttpRequest', category: 'external', description: 'XHR response', severity: 'high' },
128
+ { pattern: 'response.json()', category: 'external', description: 'Fetch JSON response', severity: 'high' },
129
+ { pattern: 'response.text()', category: 'external', description: 'Fetch text response', severity: 'high' },
130
+ { pattern: 'axios.interceptors', category: 'external', description: 'Axios interceptors', severity: 'medium' },
131
+ ];
132
+
133
+ // ============================================================
134
+ // All sources combined
135
+ // ============================================================
136
+ export const ALL_SOURCES: SourcePattern[] = [
49
137
  ...HTTP_SOURCES,
50
138
  ...FILE_SOURCES,
51
139
  ...ENV_SOURCES,
140
+ ...BROWSER_SOURCES,
141
+ ...WEBSOCKET_SOURCES,
142
+ ...EXTERNAL_SOURCES,
52
143
  ];
53
144
 
54
- /**
55
- * Check if a code string matches any source pattern
56
- */
57
145
  export function isSource(code: string): SourcePattern | null {
58
146
  for (const source of ALL_SOURCES) {
59
147
  if (code.includes(source.pattern)) {
@@ -63,9 +151,6 @@ export function isSource(code: string): SourcePattern | null {
63
151
  return null;
64
152
  }
65
153
 
66
- /**
67
- * Get all sources matching a category
68
- */
69
154
  export function getSourcesByCategory(category: SourcePattern['category']): SourcePattern[] {
70
155
  return ALL_SOURCES.filter(s => s.category === category);
71
156
  }
@@ -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
  * Taint Analysis - tracks data flow from sources to sinks
3
10
  * Generates taint-trace proofs for each vulnerability
@@ -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
  * Fix Verification - Re-analyze code after fix to check for regressions
3
10
  */
@@ -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
  * Security Badge Generator - Creates shareable security report cards
3
10
  */
@@ -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
  * Auto-fix Generator - Suggests and applies security fixes
3
10
  */
@@ -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
  * Features exports
3
10
  */
@@ -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
  * Roast Mode - Generates viral, shareable roasts for insecure code
3
10
  */
@@ -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
  * Agent PreToolUse Hook - Blocks dangerous AI actions in real-time
3
10
  */
package/src/hooks/git.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
  * Git Hooks - Pre-push security audit
3
10
  */
package/src/index.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
  * FivoSense - Neuro-symbolic AI security plugin
3
10
  * Entry point for the engine