@sulthonzh/mcp-audit 1.1.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/README.md +134 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +165 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/config-loader.d.ts +17 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +72 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/reporter/report-generator.d.ts +7 -0
- package/dist/reporter/report-generator.d.ts.map +1 -0
- package/dist/reporter/report-generator.js +240 -0
- package/dist/reporter/report-generator.js.map +1 -0
- package/dist/reporters/sarif-reporter.d.ts +18 -0
- package/dist/reporters/sarif-reporter.d.ts.map +1 -0
- package/dist/reporters/sarif-reporter.js +148 -0
- package/dist/reporters/sarif-reporter.js.map +1 -0
- package/dist/scanners/config-scanner.d.ts +11 -0
- package/dist/scanners/config-scanner.d.ts.map +1 -0
- package/dist/scanners/config-scanner.js +399 -0
- package/dist/scanners/config-scanner.js.map +1 -0
- package/dist/scanners/docker-scanner.d.ts +13 -0
- package/dist/scanners/docker-scanner.d.ts.map +1 -0
- package/dist/scanners/docker-scanner.js +384 -0
- package/dist/scanners/docker-scanner.js.map +1 -0
- package/dist/scanners/helm-scanner.d.ts +16 -0
- package/dist/scanners/helm-scanner.d.ts.map +1 -0
- package/dist/scanners/helm-scanner.js +385 -0
- package/dist/scanners/helm-scanner.js.map +1 -0
- package/dist/scanners/k8s-scanner.d.ts +14 -0
- package/dist/scanners/k8s-scanner.d.ts.map +1 -0
- package/dist/scanners/k8s-scanner.js +315 -0
- package/dist/scanners/k8s-scanner.js.map +1 -0
- package/dist/scanners/server-scanner.d.ts +13 -0
- package/dist/scanners/server-scanner.d.ts.map +1 -0
- package/dist/scanners/server-scanner.js +346 -0
- package/dist/scanners/server-scanner.js.map +1 -0
- package/dist/types/security-result.d.ts +35 -0
- package/dist/types/security-result.d.ts.map +1 -0
- package/dist/types/security-result.js +3 -0
- package/dist/types/security-result.js.map +1 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +71 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateReport = generateReport;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const logger_1 = require("../utils/logger");
|
|
11
|
+
async function generateReport(result, outputPath) {
|
|
12
|
+
logger_1.logger.info('Generating security report...');
|
|
13
|
+
const options = {
|
|
14
|
+
format: determineFormat(outputPath),
|
|
15
|
+
output: outputPath
|
|
16
|
+
};
|
|
17
|
+
switch (options.format) {
|
|
18
|
+
case 'json':
|
|
19
|
+
await generateJsonReport(result, options.output);
|
|
20
|
+
break;
|
|
21
|
+
case 'table':
|
|
22
|
+
await generateTableReport(result, options.output);
|
|
23
|
+
break;
|
|
24
|
+
case 'summary':
|
|
25
|
+
await generateSummaryReport(result, options.output);
|
|
26
|
+
break;
|
|
27
|
+
case 'sarif':
|
|
28
|
+
await (0, sarif_reporter_1.generateSarifReport)(result, options.output);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function determineFormat(outputPath) {
|
|
33
|
+
if (!outputPath)
|
|
34
|
+
return 'table'; // Default to table for console output
|
|
35
|
+
const ext = path_1.default.extname(outputPath).toLowerCase();
|
|
36
|
+
switch (ext) {
|
|
37
|
+
case '.json':
|
|
38
|
+
return 'json';
|
|
39
|
+
case '.sarif':
|
|
40
|
+
return 'sarif';
|
|
41
|
+
case '.txt':
|
|
42
|
+
case '.md':
|
|
43
|
+
return 'summary';
|
|
44
|
+
default:
|
|
45
|
+
return 'table';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function generateJsonReport(result, outputPath) {
|
|
49
|
+
const report = {
|
|
50
|
+
metadata: {
|
|
51
|
+
scannedAt: result.timestamp,
|
|
52
|
+
scanType: result.scanType,
|
|
53
|
+
target: result.target,
|
|
54
|
+
toolVersion: '1.0.0'
|
|
55
|
+
},
|
|
56
|
+
score: result.score,
|
|
57
|
+
summary: result.summary,
|
|
58
|
+
issues: result.issues.map(issue => ({
|
|
59
|
+
...issue,
|
|
60
|
+
severity: issue.type
|
|
61
|
+
})),
|
|
62
|
+
recommendations: generateRecommendations(result)
|
|
63
|
+
};
|
|
64
|
+
const output = JSON.stringify(report, null, 2);
|
|
65
|
+
if (outputPath) {
|
|
66
|
+
await fs_extra_1.default.writeFile(outputPath, output);
|
|
67
|
+
logger_1.logger.success(`JSON report saved to: ${outputPath}`);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
console.log(output);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function generateTableReport(result, outputPath) {
|
|
74
|
+
const report = createTableReport(result);
|
|
75
|
+
const output = report;
|
|
76
|
+
if (outputPath) {
|
|
77
|
+
await fs_extra_1.default.writeFile(outputPath, output);
|
|
78
|
+
logger_1.logger.success(`Table report saved to: ${outputPath}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log(report);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function generateSummaryReport(result, outputPath) {
|
|
85
|
+
const report = createSummaryReport(result);
|
|
86
|
+
const output = report;
|
|
87
|
+
if (outputPath) {
|
|
88
|
+
await fs_extra_1.default.writeFile(outputPath, output);
|
|
89
|
+
logger_1.logger.success(`Summary report saved to: ${outputPath}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log(report);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function createTableReport(result) {
|
|
96
|
+
let output = '';
|
|
97
|
+
// Header
|
|
98
|
+
output += chalk_1.default.bold.blue(`\n🔍 MCP Security Report\n`);
|
|
99
|
+
output += chalk_1.default.gray(`┌${'─'.repeat(70)}┐\n`);
|
|
100
|
+
output += chalk_1.default.gray(`│ Target: ${chalk_1.default.white(result.target.padEnd(56))}│\n`);
|
|
101
|
+
output += chalk_1.default.gray(`│ Scan Type: ${chalk_1.default.white(result.scanType.padEnd(53))}│\n`);
|
|
102
|
+
output += chalk_1.default.gray(`│ Timestamp: ${chalk_1.default.white(result.timestamp.padEnd(51))}│\n`);
|
|
103
|
+
output += chalk_1.default.gray(`└${'─'.repeat(70)}┘\n\n`);
|
|
104
|
+
// Score
|
|
105
|
+
const scoreColor = result.score >= 80 ? chalk_1.default.green :
|
|
106
|
+
result.score >= 50 ? chalk_1.default.yellow : chalk_1.default.red;
|
|
107
|
+
output += scoreColor(`🎯 Security Score: ${result.score}/100\n\n`);
|
|
108
|
+
// Summary
|
|
109
|
+
output += chalk_1.default.bold('📊 Summary:\n');
|
|
110
|
+
output += ` 📁 Config Files Found: ${result.summary.configFilesFound}\n`;
|
|
111
|
+
output += ` 🔴 High Risk Issues: ${result.summary.highRiskIssues}\n`;
|
|
112
|
+
output += ` 🟡 Medium Risk Issues: ${result.summary.mediumRiskIssues}\n`;
|
|
113
|
+
output += ` 🔵 Low Risk Issues: ${result.summary.lowRiskIssues}\n\n`;
|
|
114
|
+
// Issues
|
|
115
|
+
if (result.issues.length > 0) {
|
|
116
|
+
output += chalk_1.default.bold('🚨 Security Issues:\n\n');
|
|
117
|
+
result.issues.forEach((issue, index) => {
|
|
118
|
+
const severityColor = issue.type === 'high' ? chalk_1.default.red :
|
|
119
|
+
issue.type === 'medium' ? chalk_1.default.yellow : chalk_1.default.blue;
|
|
120
|
+
output += `${index + 1}. ${severityColor(issue.title)}\n`;
|
|
121
|
+
output += ` Type: ${issue.category}\n`;
|
|
122
|
+
output += ` Description: ${issue.description}\n`;
|
|
123
|
+
output += ` Recommendation: ${issue.recommendation}\n`;
|
|
124
|
+
if (issue.evidence) {
|
|
125
|
+
output += ` Evidence: ${issue.evidence}\n`;
|
|
126
|
+
}
|
|
127
|
+
output += '\n';
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
output += chalk_1.default.green('✅ No security issues detected!\n\n');
|
|
132
|
+
}
|
|
133
|
+
// Recommendations
|
|
134
|
+
output += chalk_1.default.bold('💡 Recommendations:\n');
|
|
135
|
+
output += generateRecommendations(result).join('\n');
|
|
136
|
+
output += '\n';
|
|
137
|
+
return output;
|
|
138
|
+
}
|
|
139
|
+
function createSummaryReport(result) {
|
|
140
|
+
let output = '';
|
|
141
|
+
// Header
|
|
142
|
+
output += `# MCP Security Report\n\n`;
|
|
143
|
+
output += `**Target:** ${result.target}\n`;
|
|
144
|
+
output += `**Scan Type:** ${result.scanType}\n`;
|
|
145
|
+
output += `**Date:** ${result.timestamp}\n\n`;
|
|
146
|
+
// Score
|
|
147
|
+
output += `## 🎯 Security Score: ${result.score}/100\n\n`;
|
|
148
|
+
const scoreLevel = result.score >= 80 ? 'Good' :
|
|
149
|
+
result.score >= 50 ? 'Medium' : 'Poor';
|
|
150
|
+
output += `**Level:** ${scoreLevel}\n\n`;
|
|
151
|
+
// Summary
|
|
152
|
+
output += `## 📊 Summary\n\n`;
|
|
153
|
+
output += `- **Config Files Found:** ${result.summary.configFilesFound}\n`;
|
|
154
|
+
output += `- **High Risk Issues:** ${result.summary.highRiskIssues}\n`;
|
|
155
|
+
output += `- **Medium Risk Issues:** ${result.summary.mediumRiskIssues}\n`;
|
|
156
|
+
output += `- **Low Risk Issues:** ${result.summary.lowRiskIssues}\n\n`;
|
|
157
|
+
// Issues
|
|
158
|
+
if (result.issues.length > 0) {
|
|
159
|
+
output += `## 🚨 Security Issues\n\n`;
|
|
160
|
+
const issuesByType = result.issues.reduce((acc, issue) => {
|
|
161
|
+
if (!acc[issue.type])
|
|
162
|
+
acc[issue.type] = [];
|
|
163
|
+
acc[issue.type].push(issue);
|
|
164
|
+
return acc;
|
|
165
|
+
}, {});
|
|
166
|
+
Object.entries(issuesByType).forEach(([type, issues]) => {
|
|
167
|
+
const severity = type === 'high' ? 'High' : type === 'medium' ? 'Medium' : 'Low';
|
|
168
|
+
output += `### ${severity} Priority Issues\n\n`;
|
|
169
|
+
issues.forEach((issue, index) => {
|
|
170
|
+
output += `${index + 1}. **${issue.title}**\n`;
|
|
171
|
+
output += ` - **Type:** ${issue.category}\n`;
|
|
172
|
+
output += ` - **Description:** ${issue.description}\n`;
|
|
173
|
+
output += ` - **Recommendation:** ${issue.recommendation}\n`;
|
|
174
|
+
if (issue.evidence) {
|
|
175
|
+
output += ` - **Evidence:** ${issue.evidence}\n`;
|
|
176
|
+
}
|
|
177
|
+
output += '\n';
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
output += `## ✅ No Security Issues\n\n`;
|
|
183
|
+
output += `No security issues were detected during the scan.\n\n`;
|
|
184
|
+
}
|
|
185
|
+
// Recommendations
|
|
186
|
+
output += `## 💡 Recommendations\n\n`;
|
|
187
|
+
generateRecommendations(result).forEach(rec => {
|
|
188
|
+
output += `- ${rec}\n`;
|
|
189
|
+
});
|
|
190
|
+
output += '\n';
|
|
191
|
+
// Next Steps
|
|
192
|
+
output += `## 🚀 Next Steps\n\n`;
|
|
193
|
+
output += `1. **Address High Priority Issues:** Fix all high-risk issues immediately\n`;
|
|
194
|
+
output += `2. **Monitor Medium Priority Issues:** Schedule fixes for medium-risk issues\n`;
|
|
195
|
+
output += `3. **Regular Scans:** Run MCP Audit regularly as part of your development workflow\n`;
|
|
196
|
+
output += `4. **CI Integration:** Add MCP Audit to your CI/CD pipeline\n`;
|
|
197
|
+
output += `5. **Stay Updated:** Keep MCP Audit updated to get the latest vulnerability database\n\n`;
|
|
198
|
+
return output;
|
|
199
|
+
}
|
|
200
|
+
// Import SARIF reporter
|
|
201
|
+
const sarif_reporter_1 = require("../reporters/sarif-reporter");
|
|
202
|
+
function generateRecommendations(result) {
|
|
203
|
+
const recommendations = [];
|
|
204
|
+
// High-level recommendations based on score
|
|
205
|
+
if (result.score < 50) {
|
|
206
|
+
recommendations.push('⚠️ **Critical:** Security score is very low. Review and fix all issues immediately.');
|
|
207
|
+
}
|
|
208
|
+
else if (result.score < 80) {
|
|
209
|
+
recommendations.push('⚠️ **Attention:** Security score needs improvement. Address medium and high-risk issues.');
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
recommendations.push('✅ **Good:** Security score is acceptable. Continue regular monitoring.');
|
|
213
|
+
}
|
|
214
|
+
// Specific recommendations based on issues
|
|
215
|
+
const highRiskIssues = result.issues.filter(issue => issue.type === 'high');
|
|
216
|
+
const mediumRiskIssues = result.issues.filter(issue => issue.type === 'medium');
|
|
217
|
+
const configIssues = result.issues.filter(issue => issue.category === 'config');
|
|
218
|
+
const permissionIssues = result.issues.filter(issue => issue.category === 'permissions');
|
|
219
|
+
if (highRiskIssues.length > 0) {
|
|
220
|
+
recommendations.push(`🔴 **Priority:** Address ${highRiskIssues.length} high-risk issues first.`);
|
|
221
|
+
}
|
|
222
|
+
if (configIssues.length > 0) {
|
|
223
|
+
recommendations.push(`📁 **Configuration:** Review MCP configuration settings for security best practices.`);
|
|
224
|
+
}
|
|
225
|
+
if (permissionIssues.length > 0) {
|
|
226
|
+
recommendations.push(`🔐 **Permissions:** Audit file system and network access permissions.`);
|
|
227
|
+
}
|
|
228
|
+
if (result.scanType === 'config' && result.summary.configFilesFound === 0) {
|
|
229
|
+
recommendations.push('🔍 **Discovery:** No MCP configuration files found. Check alternative locations.');
|
|
230
|
+
}
|
|
231
|
+
if (result.score === 100 && result.issues.length === 0) {
|
|
232
|
+
recommendations.push('🎉 **Excellent:** No security issues detected. Keep up good security practices!');
|
|
233
|
+
}
|
|
234
|
+
// General recommendations
|
|
235
|
+
recommendations.push('🔄 **Regular Scans:** Run MCP Audit regularly to maintain security posture.');
|
|
236
|
+
recommendations.push('🔗 **CI Integration:** Integrate MCP Audit into your CI/CD pipeline for automated scanning.');
|
|
237
|
+
recommendations.push('📚 **Documentation:** Keep your MCP server documentation up to date with security considerations.');
|
|
238
|
+
return recommendations;
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=report-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-generator.js","sourceRoot":"","sources":["../../src/reporter/report-generator.ts"],"names":[],"mappings":";;;;;AAYA,wCAsBC;AAlCD,wDAA0B;AAC1B,gDAAwB;AACxB,kDAA0B;AAG1B,4CAAyC;AAOlC,KAAK,UAAU,cAAc,CAAC,MAAsB,EAAE,UAAmB;IAC9E,eAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAE7C,MAAM,OAAO,GAAkB;QAC7B,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC;QACnC,MAAM,EAAE,UAAU;KACnB,CAAC;IAEF,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;QACvB,KAAK,MAAM;YACT,MAAM,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACjD,MAAM;QACR,KAAK,OAAO;YACV,MAAM,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM;QACR,KAAK,SAAS;YACZ,MAAM,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM;QACR,KAAK,OAAO;YACV,MAAM,IAAA,oCAAmB,EAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM;IACV,CAAC;AACH,CAA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,CAAC,EAAE,CAAC;QAC5B,eAAe,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;IAC/G,CAAC;IAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,eAAe,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;IAChG,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,KAAK,CAAC,EAAE,CAAC;QAC1E,eAAe,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,KAAK,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvD,eAAe,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;IAC1G,CAAC;IAED,0BAA0B;IAC1B,eAAe,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;IACpG,eAAe,CAAC,IAAI,CAAC,6FAA6F,CAAC,CAAC;IACpH,eAAe,CAAC,IAAI,CAAC,mGAAmG,CAAC,CAAC;IAE1H,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SARIF (Static Analysis Results Interchange Format) reporter for mcp-audit.
|
|
3
|
+
*
|
|
4
|
+
* Produces SARIF v2.1.0 output compatible with GitHub Code Scanning,
|
|
5
|
+
* Azure DevOps, and other SARIF-consuming tools.
|
|
6
|
+
*
|
|
7
|
+
* @see https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
|
|
8
|
+
*/
|
|
9
|
+
import { SecurityResult } from '../types/security-result';
|
|
10
|
+
/**
|
|
11
|
+
* Generate a SARIF v2.1.0 report from a SecurityResult.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateSarifOutput(result: SecurityResult): object;
|
|
14
|
+
/**
|
|
15
|
+
* Write SARIF report to file or stdout.
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateSarifReport(result: SecurityResult, outputPath?: string): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=sarif-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sarif-reporter.d.ts","sourceRoot":"","sources":["../../src/reporters/sarif-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAgIzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAqClE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,cAAc,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SARIF (Static Analysis Results Interchange Format) reporter for mcp-audit.
|
|
4
|
+
*
|
|
5
|
+
* Produces SARIF v2.1.0 output compatible with GitHub Code Scanning,
|
|
6
|
+
* Azure DevOps, and other SARIF-consuming tools.
|
|
7
|
+
*
|
|
8
|
+
* @see https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.generateSarifOutput = generateSarifOutput;
|
|
15
|
+
exports.generateSarifReport = generateSarifReport;
|
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
+
const logger_1 = require("../utils/logger");
|
|
18
|
+
const TOOL_NAME = 'mcp-audit';
|
|
19
|
+
const TOOL_VERSION = '1.0.0';
|
|
20
|
+
const TOOL_INFO_URI = 'https://github.com/sulthonzh/mcp-audit';
|
|
21
|
+
function severityToLevel(type) {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'high': return 'error';
|
|
24
|
+
case 'medium': return 'warning';
|
|
25
|
+
default: return 'note';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function categoryToRuleId(category, title) {
|
|
29
|
+
const prefix = `MA${category.charAt(0).toUpperCase()}`;
|
|
30
|
+
// Create a short hash from the title for uniqueness
|
|
31
|
+
const hash = title
|
|
32
|
+
.toLowerCase()
|
|
33
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
34
|
+
.replace(/^-|-$/g, '')
|
|
35
|
+
.split('-')
|
|
36
|
+
.slice(0, 4)
|
|
37
|
+
.join('-');
|
|
38
|
+
return `${prefix}/${hash}`;
|
|
39
|
+
}
|
|
40
|
+
function buildRules(issues) {
|
|
41
|
+
const rules = [];
|
|
42
|
+
const ruleMap = new Map();
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
for (const issue of issues) {
|
|
45
|
+
const ruleId = categoryToRuleId(issue.category, issue.title);
|
|
46
|
+
if (seen.has(ruleId))
|
|
47
|
+
continue;
|
|
48
|
+
seen.add(ruleId);
|
|
49
|
+
ruleMap.set(`${issue.category}:${issue.title}`, rules.length);
|
|
50
|
+
rules.push({
|
|
51
|
+
id: ruleId,
|
|
52
|
+
name: issue.title.replace(/[^a-zA-Z0-9]/g, ''),
|
|
53
|
+
shortDescription: { text: issue.title },
|
|
54
|
+
fullDescription: { text: issue.description },
|
|
55
|
+
helpUri: `${TOOL_INFO_URI}#rules`,
|
|
56
|
+
properties: {
|
|
57
|
+
tags: ['security', issue.category],
|
|
58
|
+
precision: 'medium',
|
|
59
|
+
},
|
|
60
|
+
defaultConfiguration: {
|
|
61
|
+
level: severityToLevel(issue.type),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return { rules, ruleMap };
|
|
66
|
+
}
|
|
67
|
+
function buildResults(issues, ruleMap, targetUri) {
|
|
68
|
+
return issues.map((issue) => {
|
|
69
|
+
const key = `${issue.category}:${issue.title}`;
|
|
70
|
+
const ruleIndex = ruleMap.get(key) ?? 0;
|
|
71
|
+
const ruleId = categoryToRuleId(issue.category, issue.title);
|
|
72
|
+
const result = {
|
|
73
|
+
ruleId,
|
|
74
|
+
ruleIndex,
|
|
75
|
+
level: severityToLevel(issue.type),
|
|
76
|
+
message: { text: issue.description },
|
|
77
|
+
locations: [
|
|
78
|
+
{
|
|
79
|
+
physicalLocation: {
|
|
80
|
+
artifactLocation: { uri: targetUri },
|
|
81
|
+
region: { startLine: 1, startColumn: 1 },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
properties: {
|
|
86
|
+
category: issue.category,
|
|
87
|
+
recommendation: issue.recommendation,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
if (issue.evidence) {
|
|
91
|
+
result.properties.evidence = issue.evidence;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Generate a SARIF v2.1.0 report from a SecurityResult.
|
|
98
|
+
*/
|
|
99
|
+
function generateSarifOutput(result) {
|
|
100
|
+
const targetUri = result.target.startsWith('/')
|
|
101
|
+
? `file://${result.target}`
|
|
102
|
+
: result.target;
|
|
103
|
+
const { rules, ruleMap } = buildRules(result.issues);
|
|
104
|
+
const results = buildResults(result.issues, ruleMap, targetUri);
|
|
105
|
+
return {
|
|
106
|
+
$schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json',
|
|
107
|
+
version: '2.1.0',
|
|
108
|
+
runs: [
|
|
109
|
+
{
|
|
110
|
+
tool: {
|
|
111
|
+
driver: {
|
|
112
|
+
name: TOOL_NAME,
|
|
113
|
+
version: TOOL_VERSION,
|
|
114
|
+
informationUri: TOOL_INFO_URI,
|
|
115
|
+
rules,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
results,
|
|
119
|
+
invocations: [
|
|
120
|
+
{
|
|
121
|
+
executionSuccessful: true,
|
|
122
|
+
startTimeUtc: result.timestamp,
|
|
123
|
+
endTimeUtc: new Date().toISOString(),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
properties: {
|
|
127
|
+
scanType: result.scanType,
|
|
128
|
+
securityScore: result.score,
|
|
129
|
+
summary: result.summary,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Write SARIF report to file or stdout.
|
|
137
|
+
*/
|
|
138
|
+
async function generateSarifReport(result, outputPath) {
|
|
139
|
+
const sarif = generateSarifOutput(result);
|
|
140
|
+
if (outputPath) {
|
|
141
|
+
await fs_extra_1.default.writeFile(outputPath, JSON.stringify(sarif, null, 2));
|
|
142
|
+
logger_1.logger.success(`SARIF report saved to: ${outputPath}`);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
console.log(JSON.stringify(sarif, null, 2));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=sarif-reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sarif-reporter.js","sourceRoot":"","sources":["../../src/reporters/sarif-reporter.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;AAsIH,kDAqCC;AAKD,kDAYC;AA1LD,wDAA0B;AAE1B,4CAAyC;AAEzC,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAmC/D,SAAS,eAAe,CAAC,IAAY;IACnC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC;QAC5B,KAAK,QAAQ,CAAC,CAAC,OAAO,SAAS,CAAC;QAChC,OAAO,CAAC,CAAC,OA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MAAM,CAAC,CAAC;IAE1C,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,kBAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/D,eAAM,CAAC,OAAO,CAAC,0BAA0B,UAAU,EAAE,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SecurityResult } from '../types/security-result';
|
|
2
|
+
export interface SecurityIssue {
|
|
3
|
+
type: 'high' | 'medium' | 'low';
|
|
4
|
+
category: 'permissions' | 'config' | 'filesystem' | 'network' | 'injection' | 'supply-chain' | 'transport';
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
recommendation: string;
|
|
8
|
+
evidence?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function scanConfig(config: any, verbose?: boolean): Promise<SecurityResult>;
|
|
11
|
+
//# sourceMappingURL=config-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-scanner.d.ts","sourceRoot":"","sources":["../../src/scanners/config-scanner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAe1D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IAChC,QAAQ,EAAE,aAAa,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,CAAC;IAC3G,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA8CD,wBAAsB,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CA8CtF"}
|