driftdetect-core 0.4.1 → 0.4.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 (237) hide show
  1. package/dist/boundaries/boundary-scanner.d.ts +76 -0
  2. package/dist/boundaries/boundary-scanner.d.ts.map +1 -0
  3. package/dist/boundaries/boundary-scanner.js +801 -0
  4. package/dist/boundaries/boundary-scanner.js.map +1 -0
  5. package/dist/boundaries/data-access-learner.d.ts +126 -0
  6. package/dist/boundaries/data-access-learner.d.ts.map +1 -0
  7. package/dist/boundaries/data-access-learner.js +486 -0
  8. package/dist/boundaries/data-access-learner.js.map +1 -0
  9. package/dist/boundaries/index.d.ts +6 -0
  10. package/dist/boundaries/index.d.ts.map +1 -1
  11. package/dist/boundaries/index.js +6 -0
  12. package/dist/boundaries/index.js.map +1 -1
  13. package/dist/boundaries/security-prioritizer.d.ts +118 -0
  14. package/dist/boundaries/security-prioritizer.d.ts.map +1 -0
  15. package/dist/boundaries/security-prioritizer.js +316 -0
  16. package/dist/boundaries/security-prioritizer.js.map +1 -0
  17. package/dist/call-graph/analysis/coverage-analyzer.d.ts +201 -0
  18. package/dist/call-graph/analysis/coverage-analyzer.d.ts.map +1 -0
  19. package/dist/call-graph/analysis/coverage-analyzer.js +553 -0
  20. package/dist/call-graph/analysis/coverage-analyzer.js.map +1 -0
  21. package/dist/call-graph/analysis/dead-code-detector.d.ts +145 -0
  22. package/dist/call-graph/analysis/dead-code-detector.d.ts.map +1 -0
  23. package/dist/call-graph/analysis/dead-code-detector.js +391 -0
  24. package/dist/call-graph/analysis/dead-code-detector.js.map +1 -0
  25. package/dist/call-graph/analysis/graph-builder.d.ts +142 -0
  26. package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -0
  27. package/dist/call-graph/analysis/graph-builder.js +624 -0
  28. package/dist/call-graph/analysis/graph-builder.js.map +1 -0
  29. package/dist/call-graph/analysis/impact-analyzer.d.ts +150 -0
  30. package/dist/call-graph/analysis/impact-analyzer.d.ts.map +1 -0
  31. package/dist/call-graph/analysis/impact-analyzer.js +329 -0
  32. package/dist/call-graph/analysis/impact-analyzer.js.map +1 -0
  33. package/dist/call-graph/analysis/index.d.ts +11 -0
  34. package/dist/call-graph/analysis/index.d.ts.map +1 -0
  35. package/dist/call-graph/analysis/index.js +9 -0
  36. package/dist/call-graph/analysis/index.js.map +1 -0
  37. package/dist/call-graph/analysis/path-finder.d.ts +117 -0
  38. package/dist/call-graph/analysis/path-finder.d.ts.map +1 -0
  39. package/dist/call-graph/analysis/path-finder.js +360 -0
  40. package/dist/call-graph/analysis/path-finder.js.map +1 -0
  41. package/dist/call-graph/analysis/reachability.d.ts +56 -0
  42. package/dist/call-graph/analysis/reachability.d.ts.map +1 -0
  43. package/dist/call-graph/analysis/reachability.js +357 -0
  44. package/dist/call-graph/analysis/reachability.js.map +1 -0
  45. package/dist/call-graph/demo.d.ts +11 -0
  46. package/dist/call-graph/demo.d.ts.map +1 -0
  47. package/dist/call-graph/demo.js +339 -0
  48. package/dist/call-graph/demo.js.map +1 -0
  49. package/dist/call-graph/enrichment/enrichment-engine.d.ts +126 -0
  50. package/dist/call-graph/enrichment/enrichment-engine.d.ts.map +1 -0
  51. package/dist/call-graph/enrichment/enrichment-engine.js +760 -0
  52. package/dist/call-graph/enrichment/enrichment-engine.js.map +1 -0
  53. package/dist/call-graph/enrichment/impact-scorer.d.ts +59 -0
  54. package/dist/call-graph/enrichment/impact-scorer.d.ts.map +1 -0
  55. package/dist/call-graph/enrichment/impact-scorer.js +328 -0
  56. package/dist/call-graph/enrichment/impact-scorer.js.map +1 -0
  57. package/dist/call-graph/enrichment/index.d.ts +12 -0
  58. package/dist/call-graph/enrichment/index.d.ts.map +1 -0
  59. package/dist/call-graph/enrichment/index.js +15 -0
  60. package/dist/call-graph/enrichment/index.js.map +1 -0
  61. package/dist/call-graph/enrichment/remediation-generator.d.ts +41 -0
  62. package/dist/call-graph/enrichment/remediation-generator.d.ts.map +1 -0
  63. package/dist/call-graph/enrichment/remediation-generator.js +609 -0
  64. package/dist/call-graph/enrichment/remediation-generator.js.map +1 -0
  65. package/dist/call-graph/enrichment/sensitivity-classifier.d.ts +71 -0
  66. package/dist/call-graph/enrichment/sensitivity-classifier.d.ts.map +1 -0
  67. package/dist/call-graph/enrichment/sensitivity-classifier.js +454 -0
  68. package/dist/call-graph/enrichment/sensitivity-classifier.js.map +1 -0
  69. package/dist/call-graph/enrichment/types.d.ts +402 -0
  70. package/dist/call-graph/enrichment/types.d.ts.map +1 -0
  71. package/dist/call-graph/enrichment/types.js +9 -0
  72. package/dist/call-graph/enrichment/types.js.map +1 -0
  73. package/dist/call-graph/extractors/base-extractor.d.ts +112 -0
  74. package/dist/call-graph/extractors/base-extractor.d.ts.map +1 -0
  75. package/dist/call-graph/extractors/base-extractor.js +140 -0
  76. package/dist/call-graph/extractors/base-extractor.js.map +1 -0
  77. package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts +76 -0
  78. package/dist/call-graph/extractors/csharp-data-access-extractor.d.ts.map +1 -0
  79. package/dist/call-graph/extractors/csharp-data-access-extractor.js +387 -0
  80. package/dist/call-graph/extractors/csharp-data-access-extractor.js.map +1 -0
  81. package/dist/call-graph/extractors/csharp-extractor.d.ts +87 -0
  82. package/dist/call-graph/extractors/csharp-extractor.d.ts.map +1 -0
  83. package/dist/call-graph/extractors/csharp-extractor.js +470 -0
  84. package/dist/call-graph/extractors/csharp-extractor.js.map +1 -0
  85. package/dist/call-graph/extractors/data-access-extractor.d.ts +76 -0
  86. package/dist/call-graph/extractors/data-access-extractor.d.ts.map +1 -0
  87. package/dist/call-graph/extractors/data-access-extractor.js +234 -0
  88. package/dist/call-graph/extractors/data-access-extractor.js.map +1 -0
  89. package/dist/call-graph/extractors/index.d.ts +26 -0
  90. package/dist/call-graph/extractors/index.d.ts.map +1 -0
  91. package/dist/call-graph/extractors/index.js +36 -0
  92. package/dist/call-graph/extractors/index.js.map +1 -0
  93. package/dist/call-graph/extractors/java-data-access-extractor.d.ts +101 -0
  94. package/dist/call-graph/extractors/java-data-access-extractor.d.ts.map +1 -0
  95. package/dist/call-graph/extractors/java-data-access-extractor.js +611 -0
  96. package/dist/call-graph/extractors/java-data-access-extractor.js.map +1 -0
  97. package/dist/call-graph/extractors/java-extractor.d.ts +87 -0
  98. package/dist/call-graph/extractors/java-extractor.d.ts.map +1 -0
  99. package/dist/call-graph/extractors/java-extractor.js +510 -0
  100. package/dist/call-graph/extractors/java-extractor.js.map +1 -0
  101. package/dist/call-graph/extractors/php-data-access-extractor.d.ts +93 -0
  102. package/dist/call-graph/extractors/php-data-access-extractor.d.ts.map +1 -0
  103. package/dist/call-graph/extractors/php-data-access-extractor.js +589 -0
  104. package/dist/call-graph/extractors/php-data-access-extractor.js.map +1 -0
  105. package/dist/call-graph/extractors/php-extractor.d.ts +104 -0
  106. package/dist/call-graph/extractors/php-extractor.d.ts.map +1 -0
  107. package/dist/call-graph/extractors/php-extractor.js +619 -0
  108. package/dist/call-graph/extractors/php-extractor.js.map +1 -0
  109. package/dist/call-graph/extractors/python-data-access-extractor.d.ts +90 -0
  110. package/dist/call-graph/extractors/python-data-access-extractor.d.ts.map +1 -0
  111. package/dist/call-graph/extractors/python-data-access-extractor.js +537 -0
  112. package/dist/call-graph/extractors/python-data-access-extractor.js.map +1 -0
  113. package/dist/call-graph/extractors/python-extractor.d.ts +98 -0
  114. package/dist/call-graph/extractors/python-extractor.d.ts.map +1 -0
  115. package/dist/call-graph/extractors/python-extractor.js +681 -0
  116. package/dist/call-graph/extractors/python-extractor.js.map +1 -0
  117. package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts +91 -0
  118. package/dist/call-graph/extractors/semantic-data-access-scanner.d.ts.map +1 -0
  119. package/dist/call-graph/extractors/semantic-data-access-scanner.js +498 -0
  120. package/dist/call-graph/extractors/semantic-data-access-scanner.js.map +1 -0
  121. package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts +122 -0
  122. package/dist/call-graph/extractors/typescript-data-access-extractor.d.ts.map +1 -0
  123. package/dist/call-graph/extractors/typescript-data-access-extractor.js +788 -0
  124. package/dist/call-graph/extractors/typescript-data-access-extractor.js.map +1 -0
  125. package/dist/call-graph/extractors/typescript-extractor.d.ts +145 -0
  126. package/dist/call-graph/extractors/typescript-extractor.d.ts.map +1 -0
  127. package/dist/call-graph/extractors/typescript-extractor.js +904 -0
  128. package/dist/call-graph/extractors/typescript-extractor.js.map +1 -0
  129. package/dist/call-graph/index.d.ts +127 -0
  130. package/dist/call-graph/index.d.ts.map +1 -0
  131. package/dist/call-graph/index.js +247 -0
  132. package/dist/call-graph/index.js.map +1 -0
  133. package/dist/call-graph/store/call-graph-store.d.ts +70 -0
  134. package/dist/call-graph/store/call-graph-store.d.ts.map +1 -0
  135. package/dist/call-graph/store/call-graph-store.js +210 -0
  136. package/dist/call-graph/store/call-graph-store.js.map +1 -0
  137. package/dist/call-graph/store/index.d.ts +7 -0
  138. package/dist/call-graph/store/index.d.ts.map +1 -0
  139. package/dist/call-graph/store/index.js +7 -0
  140. package/dist/call-graph/store/index.js.map +1 -0
  141. package/dist/call-graph/types.d.ts +376 -0
  142. package/dist/call-graph/types.d.ts.map +1 -0
  143. package/dist/call-graph/types.js +8 -0
  144. package/dist/call-graph/types.js.map +1 -0
  145. package/dist/index.d.ts +8 -0
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +12 -0
  148. package/dist/index.js.map +1 -1
  149. package/dist/lake/callgraph-shard-store.d.ts +168 -0
  150. package/dist/lake/callgraph-shard-store.d.ts.map +1 -0
  151. package/dist/lake/callgraph-shard-store.js +466 -0
  152. package/dist/lake/callgraph-shard-store.js.map +1 -0
  153. package/dist/lake/examples-store.d.ts +127 -0
  154. package/dist/lake/examples-store.d.ts.map +1 -0
  155. package/dist/lake/examples-store.js +389 -0
  156. package/dist/lake/examples-store.js.map +1 -0
  157. package/dist/lake/index-store.d.ts +82 -0
  158. package/dist/lake/index-store.d.ts.map +1 -0
  159. package/dist/lake/index-store.js +359 -0
  160. package/dist/lake/index-store.js.map +1 -0
  161. package/dist/lake/index.d.ts +93 -0
  162. package/dist/lake/index.d.ts.map +1 -0
  163. package/dist/lake/index.js +138 -0
  164. package/dist/lake/index.js.map +1 -0
  165. package/dist/lake/lake.bak/index-store.d.ts +82 -0
  166. package/dist/lake/lake.bak/index-store.d.ts.map +1 -0
  167. package/dist/lake/lake.bak/index-store.js +357 -0
  168. package/dist/lake/lake.bak/index-store.js.map +1 -0
  169. package/dist/lake/lake.bak/index.d.ts +81 -0
  170. package/dist/lake/lake.bak/index.d.ts.map +1 -0
  171. package/dist/lake/lake.bak/index.js +114 -0
  172. package/dist/lake/lake.bak/index.js.map +1 -0
  173. package/dist/lake/lake.bak/manifest-store.d.ts +51 -0
  174. package/dist/lake/lake.bak/manifest-store.d.ts.map +1 -0
  175. package/dist/lake/lake.bak/manifest-store.js +347 -0
  176. package/dist/lake/lake.bak/manifest-store.js.map +1 -0
  177. package/dist/lake/lake.bak/query-engine.d.ts +112 -0
  178. package/dist/lake/lake.bak/query-engine.d.ts.map +1 -0
  179. package/dist/lake/lake.bak/query-engine.js +370 -0
  180. package/dist/lake/lake.bak/query-engine.js.map +1 -0
  181. package/dist/lake/lake.bak/types.d.ts +428 -0
  182. package/dist/lake/lake.bak/types.d.ts.map +1 -0
  183. package/dist/lake/lake.bak/types.js +46 -0
  184. package/dist/lake/lake.bak/types.js.map +1 -0
  185. package/dist/lake/lake.bak/view-materializer.d.ts +70 -0
  186. package/dist/lake/lake.bak/view-materializer.d.ts.map +1 -0
  187. package/dist/lake/lake.bak/view-materializer.js +314 -0
  188. package/dist/lake/lake.bak/view-materializer.js.map +1 -0
  189. package/dist/lake/lake.bak/view-store.d.ts +57 -0
  190. package/dist/lake/lake.bak/view-store.d.ts.map +1 -0
  191. package/dist/lake/lake.bak/view-store.js +348 -0
  192. package/dist/lake/lake.bak/view-store.js.map +1 -0
  193. package/dist/lake/manifest-store.d.ts +51 -0
  194. package/dist/lake/manifest-store.d.ts.map +1 -0
  195. package/dist/lake/manifest-store.js +348 -0
  196. package/dist/lake/manifest-store.js.map +1 -0
  197. package/dist/lake/pattern-shard-store.d.ts +87 -0
  198. package/dist/lake/pattern-shard-store.d.ts.map +1 -0
  199. package/dist/lake/pattern-shard-store.js +347 -0
  200. package/dist/lake/pattern-shard-store.js.map +1 -0
  201. package/dist/lake/query-engine.d.ts +124 -0
  202. package/dist/lake/query-engine.d.ts.map +1 -0
  203. package/dist/lake/query-engine.js +453 -0
  204. package/dist/lake/query-engine.js.map +1 -0
  205. package/dist/lake/security-shard-store.d.ts +156 -0
  206. package/dist/lake/security-shard-store.d.ts.map +1 -0
  207. package/dist/lake/security-shard-store.js +498 -0
  208. package/dist/lake/security-shard-store.js.map +1 -0
  209. package/dist/lake/types.d.ts +428 -0
  210. package/dist/lake/types.d.ts.map +1 -0
  211. package/dist/lake/types.js +46 -0
  212. package/dist/lake/types.js.map +1 -0
  213. package/dist/lake/view-materializer.d.ts +70 -0
  214. package/dist/lake/view-materializer.d.ts.map +1 -0
  215. package/dist/lake/view-materializer.js +314 -0
  216. package/dist/lake/view-materializer.js.map +1 -0
  217. package/dist/lake/view-store.d.ts +57 -0
  218. package/dist/lake/view-store.d.ts.map +1 -0
  219. package/dist/lake/view-store.js +348 -0
  220. package/dist/lake/view-store.js.map +1 -0
  221. package/dist/parsers/tree-sitter/index.d.ts +1 -0
  222. package/dist/parsers/tree-sitter/index.d.ts.map +1 -1
  223. package/dist/parsers/tree-sitter/index.js +4 -0
  224. package/dist/parsers/tree-sitter/index.js.map +1 -1
  225. package/dist/parsers/tree-sitter/typescript-loader.d.ts +58 -0
  226. package/dist/parsers/tree-sitter/typescript-loader.d.ts.map +1 -0
  227. package/dist/parsers/tree-sitter/typescript-loader.js +250 -0
  228. package/dist/parsers/tree-sitter/typescript-loader.js.map +1 -0
  229. package/dist/store/project-config.d.ts +154 -0
  230. package/dist/store/project-config.d.ts.map +1 -0
  231. package/dist/store/project-config.js +235 -0
  232. package/dist/store/project-config.js.map +1 -0
  233. package/dist/store/project-registry.d.ts +241 -0
  234. package/dist/store/project-registry.d.ts.map +1 -0
  235. package/dist/store/project-registry.js +557 -0
  236. package/dist/store/project-registry.js.map +1 -0
  237. package/package.json +4 -2
@@ -0,0 +1,609 @@
1
+ /**
2
+ * Remediation Generator
3
+ *
4
+ * Generates actionable remediation guidance for security findings.
5
+ * Provides step-by-step instructions, code examples, and effort estimates.
6
+ */
7
+ /**
8
+ * Category-specific remediation templates
9
+ */
10
+ const REMEDIATION_TEMPLATES = {
11
+ injection: {
12
+ summary: 'Use parameterized queries or prepared statements to prevent injection attacks',
13
+ steps: [
14
+ 'Identify all user input that flows into the vulnerable code path',
15
+ 'Replace string concatenation with parameterized queries',
16
+ 'Use ORM methods instead of raw SQL where possible',
17
+ 'Implement input validation as defense in depth',
18
+ 'Add automated tests to verify the fix',
19
+ ],
20
+ codeExamples: [
21
+ {
22
+ description: 'SQL Injection - Use parameterized queries',
23
+ language: 'typescript',
24
+ vulnerable: `const query = \`SELECT * FROM users WHERE id = '\${userId}'\`;
25
+ db.query(query);`,
26
+ fixed: `const query = 'SELECT * FROM users WHERE id = $1';
27
+ db.query(query, [userId]);`,
28
+ },
29
+ {
30
+ description: 'SQL Injection - Use ORM',
31
+ language: 'typescript',
32
+ vulnerable: `db.query(\`SELECT * FROM users WHERE email = '\${email}'\`);`,
33
+ fixed: `await prisma.user.findUnique({ where: { email } });`,
34
+ },
35
+ {
36
+ description: 'Command Injection - Use safe APIs',
37
+ language: 'typescript',
38
+ vulnerable: `exec(\`ls \${userInput}\`);`,
39
+ fixed: `execFile('ls', [userInput], { shell: false });`,
40
+ },
41
+ ],
42
+ effort: {
43
+ time: 'hours',
44
+ complexity: 'simple',
45
+ regressionRisk: 'low',
46
+ },
47
+ references: [
48
+ {
49
+ title: 'OWASP SQL Injection Prevention Cheat Sheet',
50
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html',
51
+ type: 'owasp',
52
+ },
53
+ {
54
+ title: 'CWE-89: SQL Injection',
55
+ url: 'https://cwe.mitre.org/data/definitions/89.html',
56
+ type: 'cwe',
57
+ },
58
+ ],
59
+ },
60
+ 'broken-auth': {
61
+ summary: 'Implement secure authentication with proper session management',
62
+ steps: [
63
+ 'Review authentication flow for weaknesses',
64
+ 'Implement secure password hashing (bcrypt, argon2)',
65
+ 'Use secure session tokens with proper expiration',
66
+ 'Implement rate limiting on authentication endpoints',
67
+ 'Add multi-factor authentication for sensitive operations',
68
+ 'Log authentication events for monitoring',
69
+ ],
70
+ codeExamples: [
71
+ {
72
+ description: 'Secure password hashing',
73
+ language: 'typescript',
74
+ vulnerable: `const hash = md5(password);`,
75
+ fixed: `const hash = await bcrypt.hash(password, 12);`,
76
+ },
77
+ {
78
+ description: 'Secure session configuration',
79
+ language: 'typescript',
80
+ vulnerable: `app.use(session({ secret: 'secret' }));`,
81
+ fixed: `app.use(session({
82
+ secret: process.env.SESSION_SECRET,
83
+ resave: false,
84
+ saveUninitialized: false,
85
+ cookie: {
86
+ secure: true,
87
+ httpOnly: true,
88
+ sameSite: 'strict',
89
+ maxAge: 3600000
90
+ }
91
+ }));`,
92
+ },
93
+ ],
94
+ effort: {
95
+ time: 'days',
96
+ complexity: 'moderate',
97
+ regressionRisk: 'medium',
98
+ },
99
+ references: [
100
+ {
101
+ title: 'OWASP Authentication Cheat Sheet',
102
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html',
103
+ type: 'owasp',
104
+ },
105
+ ],
106
+ },
107
+ 'sensitive-exposure': {
108
+ summary: 'Protect sensitive data with encryption and access controls',
109
+ steps: [
110
+ 'Identify all sensitive data in the affected code path',
111
+ 'Encrypt sensitive data at rest and in transit',
112
+ 'Remove sensitive data from logs and error messages',
113
+ 'Implement proper access controls',
114
+ 'Review data retention policies',
115
+ ],
116
+ codeExamples: [
117
+ {
118
+ description: 'Remove sensitive data from logs',
119
+ language: 'typescript',
120
+ vulnerable: `logger.info('User login', { email, password });`,
121
+ fixed: `logger.info('User login', { email, password: '[REDACTED]' });`,
122
+ },
123
+ {
124
+ description: 'Encrypt sensitive fields',
125
+ language: 'typescript',
126
+ vulnerable: `await db.user.create({ data: { ssn: userSSN } });`,
127
+ fixed: `const encryptedSSN = await encrypt(userSSN);
128
+ await db.user.create({ data: { ssn: encryptedSSN } });`,
129
+ },
130
+ ],
131
+ effort: {
132
+ time: 'days',
133
+ complexity: 'moderate',
134
+ regressionRisk: 'medium',
135
+ },
136
+ references: [
137
+ {
138
+ title: 'OWASP Cryptographic Storage Cheat Sheet',
139
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html',
140
+ type: 'owasp',
141
+ },
142
+ ],
143
+ },
144
+ xxe: {
145
+ summary: 'Disable external entity processing in XML parsers',
146
+ steps: [
147
+ 'Identify all XML parsing in the application',
148
+ 'Disable DTD processing and external entities',
149
+ 'Use JSON instead of XML where possible',
150
+ 'Validate and sanitize XML input',
151
+ ],
152
+ codeExamples: [
153
+ {
154
+ description: 'Disable XXE in XML parser',
155
+ language: 'typescript',
156
+ vulnerable: `const parser = new DOMParser();
157
+ parser.parseFromString(xmlInput, 'text/xml');`,
158
+ fixed: `import { XMLParser } from 'fast-xml-parser';
159
+ const parser = new XMLParser({
160
+ allowBooleanAttributes: true,
161
+ ignoreDeclaration: true,
162
+ processEntities: false
163
+ });
164
+ parser.parse(xmlInput);`,
165
+ },
166
+ ],
167
+ effort: {
168
+ time: 'hours',
169
+ complexity: 'simple',
170
+ regressionRisk: 'low',
171
+ },
172
+ references: [
173
+ {
174
+ title: 'OWASP XXE Prevention Cheat Sheet',
175
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html',
176
+ type: 'owasp',
177
+ },
178
+ {
179
+ title: 'CWE-611: XXE',
180
+ url: 'https://cwe.mitre.org/data/definitions/611.html',
181
+ type: 'cwe',
182
+ },
183
+ ],
184
+ },
185
+ 'broken-access': {
186
+ summary: 'Implement proper authorization checks at every access point',
187
+ steps: [
188
+ 'Map all access control requirements for affected resources',
189
+ 'Implement authorization checks before data access',
190
+ 'Use role-based or attribute-based access control',
191
+ 'Deny by default - require explicit grants',
192
+ 'Log access control decisions for audit',
193
+ ],
194
+ codeExamples: [
195
+ {
196
+ description: 'Add authorization check',
197
+ language: 'typescript',
198
+ vulnerable: `app.get('/users/:id', async (req, res) => {
199
+ const user = await db.user.findUnique({ where: { id: req.params.id } });
200
+ res.json(user);
201
+ });`,
202
+ fixed: `app.get('/users/:id', authorize('users:read'), async (req, res) => {
203
+ if (req.user.id !== req.params.id && !req.user.isAdmin) {
204
+ throw new ForbiddenError('Cannot access other users');
205
+ }
206
+ const user = await db.user.findUnique({ where: { id: req.params.id } });
207
+ res.json(user);
208
+ });`,
209
+ },
210
+ ],
211
+ effort: {
212
+ time: 'days',
213
+ complexity: 'moderate',
214
+ regressionRisk: 'medium',
215
+ },
216
+ references: [
217
+ {
218
+ title: 'OWASP Authorization Cheat Sheet',
219
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html',
220
+ type: 'owasp',
221
+ },
222
+ ],
223
+ },
224
+ misconfig: {
225
+ summary: 'Review and harden security configuration',
226
+ steps: [
227
+ 'Review security headers and CORS configuration',
228
+ 'Disable debug mode and verbose errors in production',
229
+ 'Remove default credentials and unnecessary features',
230
+ 'Implement security hardening checklist',
231
+ 'Set up configuration validation in CI/CD',
232
+ ],
233
+ codeExamples: [
234
+ {
235
+ description: 'Add security headers',
236
+ language: 'typescript',
237
+ vulnerable: `app.use(cors());`,
238
+ fixed: `app.use(helmet());
239
+ app.use(cors({
240
+ origin: process.env.ALLOWED_ORIGINS?.split(','),
241
+ credentials: true
242
+ }));`,
243
+ },
244
+ ],
245
+ effort: {
246
+ time: 'hours',
247
+ complexity: 'simple',
248
+ regressionRisk: 'low',
249
+ },
250
+ references: [
251
+ {
252
+ title: 'OWASP Secure Headers Project',
253
+ url: 'https://owasp.org/www-project-secure-headers/',
254
+ type: 'owasp',
255
+ },
256
+ ],
257
+ },
258
+ xss: {
259
+ summary: 'Sanitize output and use context-aware encoding',
260
+ steps: [
261
+ 'Identify all user input that is rendered in responses',
262
+ 'Apply context-appropriate output encoding',
263
+ 'Use Content Security Policy headers',
264
+ 'Implement input validation as defense in depth',
265
+ 'Use frameworks with automatic XSS protection',
266
+ ],
267
+ codeExamples: [
268
+ {
269
+ description: 'Escape HTML output',
270
+ language: 'typescript',
271
+ vulnerable: `element.innerHTML = userInput;`,
272
+ fixed: `element.textContent = userInput;
273
+ // Or use a sanitization library:
274
+ element.innerHTML = DOMPurify.sanitize(userInput);`,
275
+ },
276
+ {
277
+ description: 'React - avoid dangerouslySetInnerHTML',
278
+ language: 'typescript',
279
+ vulnerable: `<div dangerouslySetInnerHTML={{ __html: userContent }} />`,
280
+ fixed: `<div>{userContent}</div>
281
+ // Or sanitize if HTML is required:
282
+ <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(userContent) }} />`,
283
+ },
284
+ ],
285
+ effort: {
286
+ time: 'hours',
287
+ complexity: 'simple',
288
+ regressionRisk: 'low',
289
+ },
290
+ references: [
291
+ {
292
+ title: 'OWASP XSS Prevention Cheat Sheet',
293
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html',
294
+ type: 'owasp',
295
+ },
296
+ {
297
+ title: 'CWE-79: XSS',
298
+ url: 'https://cwe.mitre.org/data/definitions/79.html',
299
+ type: 'cwe',
300
+ },
301
+ ],
302
+ },
303
+ deserialization: {
304
+ summary: 'Avoid deserializing untrusted data or use safe alternatives',
305
+ steps: [
306
+ 'Identify all deserialization of external data',
307
+ 'Replace unsafe deserialization with JSON parsing',
308
+ 'Implement integrity checks (signatures) if serialization is required',
309
+ 'Use allowlists for permitted classes',
310
+ 'Monitor for deserialization attacks',
311
+ ],
312
+ codeExamples: [
313
+ {
314
+ description: 'Avoid unsafe deserialization',
315
+ language: 'typescript',
316
+ vulnerable: `const obj = eval('(' + userInput + ')');`,
317
+ fixed: `const obj = JSON.parse(userInput);
318
+ // Validate the parsed object against a schema
319
+ const validated = schema.parse(obj);`,
320
+ },
321
+ ],
322
+ effort: {
323
+ time: 'days',
324
+ complexity: 'moderate',
325
+ regressionRisk: 'medium',
326
+ },
327
+ references: [
328
+ {
329
+ title: 'OWASP Deserialization Cheat Sheet',
330
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html',
331
+ type: 'owasp',
332
+ },
333
+ ],
334
+ },
335
+ components: {
336
+ summary: 'Update vulnerable dependencies and implement dependency management',
337
+ steps: [
338
+ 'Update the vulnerable package to a patched version',
339
+ 'Review changelog for breaking changes',
340
+ 'Run tests to verify compatibility',
341
+ 'Set up automated dependency scanning in CI/CD',
342
+ 'Consider using lockfiles and pinned versions',
343
+ ],
344
+ codeExamples: [],
345
+ effort: {
346
+ time: 'hours',
347
+ complexity: 'simple',
348
+ regressionRisk: 'medium',
349
+ },
350
+ references: [
351
+ {
352
+ title: 'OWASP Dependency Check',
353
+ url: 'https://owasp.org/www-project-dependency-check/',
354
+ type: 'owasp',
355
+ },
356
+ ],
357
+ },
358
+ logging: {
359
+ summary: 'Implement comprehensive security logging and monitoring',
360
+ steps: [
361
+ 'Add logging for security-relevant events',
362
+ 'Ensure logs do not contain sensitive data',
363
+ 'Implement log aggregation and alerting',
364
+ 'Set up monitoring for suspicious patterns',
365
+ 'Define incident response procedures',
366
+ ],
367
+ codeExamples: [
368
+ {
369
+ description: 'Add security event logging',
370
+ language: 'typescript',
371
+ vulnerable: `// No logging
372
+ await authenticateUser(email, password);`,
373
+ fixed: `const result = await authenticateUser(email, password);
374
+ if (!result.success) {
375
+ securityLogger.warn('Authentication failed', {
376
+ email,
377
+ ip: req.ip,
378
+ userAgent: req.headers['user-agent'],
379
+ reason: result.reason
380
+ });
381
+ }`,
382
+ },
383
+ ],
384
+ effort: {
385
+ time: 'days',
386
+ complexity: 'moderate',
387
+ regressionRisk: 'low',
388
+ },
389
+ references: [
390
+ {
391
+ title: 'OWASP Logging Cheat Sheet',
392
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html',
393
+ type: 'owasp',
394
+ },
395
+ ],
396
+ },
397
+ ssrf: {
398
+ summary: 'Validate and restrict outbound requests to prevent SSRF',
399
+ steps: [
400
+ 'Validate and sanitize all URLs from user input',
401
+ 'Use allowlists for permitted domains/IPs',
402
+ 'Block requests to internal networks and metadata endpoints',
403
+ 'Disable unnecessary URL schemes',
404
+ 'Implement network segmentation',
405
+ ],
406
+ codeExamples: [
407
+ {
408
+ description: 'Validate URLs before fetching',
409
+ language: 'typescript',
410
+ vulnerable: `const response = await fetch(userProvidedUrl);`,
411
+ fixed: `const url = new URL(userProvidedUrl);
412
+ if (!ALLOWED_HOSTS.includes(url.hostname)) {
413
+ throw new Error('Host not allowed');
414
+ }
415
+ if (url.protocol !== 'https:') {
416
+ throw new Error('Only HTTPS allowed');
417
+ }
418
+ const response = await fetch(url.toString());`,
419
+ },
420
+ ],
421
+ effort: {
422
+ time: 'hours',
423
+ complexity: 'moderate',
424
+ regressionRisk: 'low',
425
+ },
426
+ references: [
427
+ {
428
+ title: 'OWASP SSRF Prevention Cheat Sheet',
429
+ url: 'https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html',
430
+ type: 'owasp',
431
+ },
432
+ ],
433
+ },
434
+ other: {
435
+ summary: 'Review and address the security finding based on its specific context',
436
+ steps: [
437
+ 'Analyze the finding to understand the vulnerability',
438
+ 'Research best practices for this type of issue',
439
+ 'Implement appropriate mitigations',
440
+ 'Add tests to verify the fix',
441
+ 'Document the remediation for future reference',
442
+ ],
443
+ codeExamples: [],
444
+ effort: {
445
+ time: 'hours',
446
+ complexity: 'moderate',
447
+ regressionRisk: 'medium',
448
+ },
449
+ references: [
450
+ {
451
+ title: 'OWASP Cheat Sheet Series',
452
+ url: 'https://cheatsheetseries.owasp.org/',
453
+ type: 'owasp',
454
+ },
455
+ ],
456
+ },
457
+ };
458
+ // ============================================================================
459
+ // Remediation Generator
460
+ // ============================================================================
461
+ /**
462
+ * Generates remediation guidance for security findings
463
+ */
464
+ export class RemediationGenerator {
465
+ /**
466
+ * Generate remediation guidance for a finding
467
+ */
468
+ generate(finding, dataImpact) {
469
+ const template = REMEDIATION_TEMPLATES[finding.category];
470
+ // Build context-aware steps
471
+ const steps = this.buildSteps(finding, dataImpact, template.steps);
472
+ // Filter relevant code examples
473
+ const codeExamples = this.filterCodeExamples(finding, template.codeExamples);
474
+ // Adjust effort based on data impact
475
+ const effort = this.adjustEffort(template.effort, dataImpact);
476
+ // Build references including CWE/OWASP from finding
477
+ const references = this.buildReferences(finding, template.references);
478
+ return {
479
+ summary: this.buildSummary(finding, dataImpact, template.summary),
480
+ steps,
481
+ codeExamples,
482
+ effort,
483
+ references,
484
+ };
485
+ }
486
+ /**
487
+ * Build context-aware summary
488
+ */
489
+ buildSummary(_finding, dataImpact, baseSummary) {
490
+ let summary = baseSummary;
491
+ // Add data impact context
492
+ if (dataImpact.sensitiveFields.length > 0) {
493
+ const fieldTypes = [...new Set(dataImpact.sensitiveFields.map((f) => f.field.sensitivityType))];
494
+ summary += `. This vulnerability can reach ${fieldTypes.join(', ')} data`;
495
+ }
496
+ // Add regulatory context
497
+ if (dataImpact.regulations.length > 0) {
498
+ summary += `. Regulatory implications: ${dataImpact.regulations.join(', ')}`;
499
+ }
500
+ return summary;
501
+ }
502
+ /**
503
+ * Build context-aware remediation steps
504
+ */
505
+ buildSteps(finding, dataImpact, baseSteps) {
506
+ const steps = baseSteps.map((description, index) => ({
507
+ order: index + 1,
508
+ description,
509
+ file: index === 0 ? finding.file : undefined,
510
+ line: index === 0 ? finding.line : undefined,
511
+ }));
512
+ // Add data-specific steps if sensitive data is involved
513
+ if (dataImpact.sensitiveFields.length > 0) {
514
+ steps.push({
515
+ order: steps.length + 1,
516
+ description: `Review access to sensitive fields: ${dataImpact.sensitiveFields
517
+ .slice(0, 3)
518
+ .map((f) => `${f.field.table}.${f.field.field}`)
519
+ .join(', ')}${dataImpact.sensitiveFields.length > 3 ? '...' : ''}`,
520
+ });
521
+ }
522
+ // Add regulatory compliance step if needed
523
+ if (dataImpact.regulations.length > 0) {
524
+ steps.push({
525
+ order: steps.length + 1,
526
+ description: `Verify compliance with ${dataImpact.regulations.join(', ')} requirements after remediation`,
527
+ });
528
+ }
529
+ return steps;
530
+ }
531
+ /**
532
+ * Filter code examples relevant to the finding
533
+ */
534
+ filterCodeExamples(_finding, examples) {
535
+ // For now, return all examples for the category
536
+ // Could be enhanced to filter based on language, framework, etc.
537
+ return examples;
538
+ }
539
+ /**
540
+ * Adjust effort estimate based on data impact
541
+ */
542
+ adjustEffort(baseEffort, dataImpact) {
543
+ let effort = { ...baseEffort };
544
+ // Increase complexity if many sensitive fields are involved
545
+ if (dataImpact.sensitiveFields.length > 5) {
546
+ if (effort.complexity === 'simple')
547
+ effort.complexity = 'moderate';
548
+ else if (effort.complexity === 'moderate')
549
+ effort.complexity = 'complex';
550
+ }
551
+ // Increase regression risk if many tables are affected
552
+ if (dataImpact.tables.length > 3) {
553
+ if (effort.regressionRisk === 'low')
554
+ effort.regressionRisk = 'medium';
555
+ else if (effort.regressionRisk === 'medium')
556
+ effort.regressionRisk = 'high';
557
+ }
558
+ // Increase time if attack surface is large
559
+ if (dataImpact.attackSurfaceSize > 20) {
560
+ if (effort.time === 'minutes')
561
+ effort.time = 'hours';
562
+ else if (effort.time === 'hours')
563
+ effort.time = 'days';
564
+ }
565
+ return effort;
566
+ }
567
+ /**
568
+ * Build comprehensive references
569
+ */
570
+ buildReferences(finding, baseReferences) {
571
+ const references = [...baseReferences];
572
+ // Add CWE references from finding
573
+ if (finding.cwe) {
574
+ for (const cwe of finding.cwe) {
575
+ const cweId = cwe.replace('CWE-', '');
576
+ references.push({
577
+ title: `CWE-${cweId}`,
578
+ url: `https://cwe.mitre.org/data/definitions/${cweId}.html`,
579
+ type: 'cwe',
580
+ });
581
+ }
582
+ }
583
+ // Add OWASP references from finding
584
+ if (finding.owasp) {
585
+ for (const owasp of finding.owasp) {
586
+ references.push({
587
+ title: `OWASP ${owasp}`,
588
+ url: `https://owasp.org/Top10/`,
589
+ type: 'owasp',
590
+ });
591
+ }
592
+ }
593
+ // Deduplicate by URL
594
+ const seen = new Set();
595
+ return references.filter((ref) => {
596
+ if (seen.has(ref.url))
597
+ return false;
598
+ seen.add(ref.url);
599
+ return true;
600
+ });
601
+ }
602
+ }
603
+ /**
604
+ * Create a new remediation generator
605
+ */
606
+ export function createRemediationGenerator() {
607
+ return new RemediationGenerator();
608
+ }
609
+ //# sourceMappingURL=remediation-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remediation-generator.js","sourceRoot":"","sources":["../../../src/call-graph/enrichment/remediation-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;GAEG;AACH,MAAM,qBAAqB,GAAiD;IAC1E,SAAS,EAAE;QACT,OAAO,EAAE,+EAA+E;QACxF,KAAK,EAAE;YACL,kEAAkE;YAClE,yDAAyD;YACzD,mDAAmD;YACnD,gDAAgD;YAChD,uCAAuC;SACxC;QACD,YAAY,EAAE;YACZ;gBACE,WAAW,EAAE,2CAA2C;gBACxD,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE;iBACH;gBACT,KAAK,EAAE;2BACY;aACpB;YACD;gBACE,WAAW,EAAE,yBAAyB;gBACtC,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,8DAA8D;gBAC1E,KAAK,EAAE,qDAAqD;aAC7D;YACD;gBACE,WAAW,EAAE,mCAAmC;gBAChD,QAAQ,EAAE,YAAY;gBACtB,UAAU,EAAE,6BAA6B;gBACzC,KAAK,EAAE,gDAAgD;aACxD;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,UAAU,EA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