aws-security-mcp 0.5.0 → 0.5.1
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/dist/bin/aws-security-mcp.js +176 -1
- package/dist/bin/aws-security-mcp.js.map +1 -1
- package/dist/src/index.js +176 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -237,7 +237,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
237
237
|
import { z } from "zod";
|
|
238
238
|
|
|
239
239
|
// src/version.ts
|
|
240
|
-
var VERSION = "0.5.
|
|
240
|
+
var VERSION = "0.5.1";
|
|
241
241
|
|
|
242
242
|
// src/utils/aws-client.ts
|
|
243
243
|
import { STSClient, GetCallerIdentityCommand } from "@aws-sdk/client-sts";
|
|
@@ -4584,6 +4584,92 @@ function scoreColor(score) {
|
|
|
4584
4584
|
if (score >= 50) return "#eab308";
|
|
4585
4585
|
return "#ef4444";
|
|
4586
4586
|
}
|
|
4587
|
+
var SERVICE_RECOMMENDATIONS = {
|
|
4588
|
+
security_hub_findings: {
|
|
4589
|
+
icon: "\u{1F534}",
|
|
4590
|
+
service: "Security Hub",
|
|
4591
|
+
impact: "\u65E0\u6CD5\u83B7\u53D6 300+ \u9879\u81EA\u52A8\u5316\u5B89\u5168\u68C0\u67E5\uFF08FSBP/CIS/PCI DSS \u6807\u51C6\uFF09",
|
|
4592
|
+
action: "\u542F\u7528 Security Hub \u83B7\u5F97\u6700\u5168\u9762\u7684\u5B89\u5168\u6001\u52BF\u8BC4\u4F30"
|
|
4593
|
+
},
|
|
4594
|
+
guardduty_findings: {
|
|
4595
|
+
icon: "\u{1F534}",
|
|
4596
|
+
service: "GuardDuty",
|
|
4597
|
+
impact: "\u65E0\u6CD5\u68C0\u6D4B\u5A01\u80C1\u6D3B\u52A8\uFF08\u6076\u610F IP\u3001\u5F02\u5E38 API \u8C03\u7528\u3001\u52A0\u5BC6\u8D27\u5E01\u6316\u77FF\u7B49\uFF09",
|
|
4598
|
+
action: "\u542F\u7528 GuardDuty \u83B7\u5F97\u6301\u7EED\u5A01\u80C1\u68C0\u6D4B\u80FD\u529B"
|
|
4599
|
+
},
|
|
4600
|
+
inspector_findings: {
|
|
4601
|
+
icon: "\u{1F7E1}",
|
|
4602
|
+
service: "Inspector",
|
|
4603
|
+
impact: "\u65E0\u6CD5\u626B\u63CF EC2/Lambda/\u5BB9\u5668\u7684\u8F6F\u4EF6\u6F0F\u6D1E\uFF08CVE\uFF09",
|
|
4604
|
+
action: "\u542F\u7528 Inspector \u53D1\u73B0\u5DF2\u77E5\u5B89\u5168\u6F0F\u6D1E"
|
|
4605
|
+
},
|
|
4606
|
+
trusted_advisor_findings: {
|
|
4607
|
+
icon: "\u{1F7E1}",
|
|
4608
|
+
service: "Trusted Advisor",
|
|
4609
|
+
impact: "\u65E0\u6CD5\u83B7\u53D6 AWS \u6700\u4F73\u5B9E\u8DF5\u5B89\u5168\u68C0\u67E5",
|
|
4610
|
+
action: "\u5347\u7EA7\u81F3 Business/Enterprise Support \u8BA1\u5212\u4EE5\u4F7F\u7528 Trusted Advisor \u5B89\u5168\u68C0\u67E5"
|
|
4611
|
+
},
|
|
4612
|
+
config_rules_findings: {
|
|
4613
|
+
icon: "\u{1F7E1}",
|
|
4614
|
+
service: "AWS Config",
|
|
4615
|
+
impact: "\u65E0\u6CD5\u68C0\u67E5\u8D44\u6E90\u914D\u7F6E\u5408\u89C4\u72B6\u6001",
|
|
4616
|
+
action: "\u542F\u7528 AWS Config \u5E76\u914D\u7F6E Config Rules"
|
|
4617
|
+
},
|
|
4618
|
+
access_analyzer_findings: {
|
|
4619
|
+
icon: "\u{1F7E1}",
|
|
4620
|
+
service: "IAM Access Analyzer",
|
|
4621
|
+
impact: "\u65E0\u6CD5\u68C0\u6D4B\u8D44\u6E90\u662F\u5426\u88AB\u5916\u90E8\u8D26\u53F7\u6216\u516C\u7F51\u8BBF\u95EE",
|
|
4622
|
+
action: "\u521B\u5EFA IAM Access Analyzer\uFF08\u8D26\u6237\u7EA7\u6216\u7EC4\u7EC7\u7EA7\uFF09"
|
|
4623
|
+
},
|
|
4624
|
+
patch_compliance_findings: {
|
|
4625
|
+
icon: "\u{1F7E1}",
|
|
4626
|
+
service: "SSM Patch Manager",
|
|
4627
|
+
impact: "\u65E0\u6CD5\u68C0\u67E5\u5B9E\u4F8B\u8865\u4E01\u5408\u89C4\u72B6\u6001",
|
|
4628
|
+
action: "\u5B89\u88C5 SSM Agent \u5E76\u914D\u7F6E Patch Manager"
|
|
4629
|
+
}
|
|
4630
|
+
};
|
|
4631
|
+
var SERVICE_NOT_ENABLED_PATTERNS = [
|
|
4632
|
+
"not enabled",
|
|
4633
|
+
"not found",
|
|
4634
|
+
"No IAM Access Analyzer",
|
|
4635
|
+
"No SSM-managed instances",
|
|
4636
|
+
"requires AWS Business or Enterprise Support",
|
|
4637
|
+
"not available",
|
|
4638
|
+
"is not enabled"
|
|
4639
|
+
];
|
|
4640
|
+
function getDisabledServices(modules) {
|
|
4641
|
+
const disabled = [];
|
|
4642
|
+
for (const mod of modules) {
|
|
4643
|
+
const rec = SERVICE_RECOMMENDATIONS[mod.module];
|
|
4644
|
+
if (!rec) continue;
|
|
4645
|
+
if (!mod.warnings?.length) continue;
|
|
4646
|
+
const hasNotEnabled = mod.warnings.some(
|
|
4647
|
+
(w) => SERVICE_NOT_ENABLED_PATTERNS.some((p) => w.includes(p))
|
|
4648
|
+
);
|
|
4649
|
+
if (hasNotEnabled) {
|
|
4650
|
+
disabled.push(rec);
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
return disabled;
|
|
4654
|
+
}
|
|
4655
|
+
function buildServiceReminderHtml(modules) {
|
|
4656
|
+
const disabled = getDisabledServices(modules);
|
|
4657
|
+
if (disabled.length === 0) return "";
|
|
4658
|
+
const items = disabled.map((svc) => `
|
|
4659
|
+
<div style="margin-bottom:12px">
|
|
4660
|
+
<div style="font-weight:600;font-size:15px">${esc(svc.icon)} ${esc(svc.service)} \u672A\u542F\u7528</div>
|
|
4661
|
+
<div style="margin-left:28px;color:#cbd5e1;font-size:13px">\u5F71\u54CD\uFF1A${esc(svc.impact)}</div>
|
|
4662
|
+
<div style="margin-left:28px;color:#cbd5e1;font-size:13px">\u5EFA\u8BAE\uFF1A${esc(svc.action)}</div>
|
|
4663
|
+
</div>`).join("\n");
|
|
4664
|
+
return `
|
|
4665
|
+
<section>
|
|
4666
|
+
<div style="background:#2d1f00;border:1px solid #b45309;border-radius:8px;padding:20px;margin-bottom:32px">
|
|
4667
|
+
<div style="font-size:17px;font-weight:700;margin-bottom:12px">⚡ \u4EE5\u4E0B\u5B89\u5168\u670D\u52A1\u672A\u542F\u7528\uFF0C\u90E8\u5206\u68C0\u67E5\u65E0\u6CD5\u6267\u884C\uFF1A</div>
|
|
4668
|
+
${items}
|
|
4669
|
+
<div style="margin-top:12px;font-size:13px;color:#fbbf24;font-weight:500">\u542F\u7528\u4EE5\u4E0A\u670D\u52A1\u540E\u91CD\u65B0\u626B\u63CF\u53EF\u83B7\u5F97\u66F4\u5B8C\u6574\u7684\u5B89\u5168\u8BC4\u4F30\u3002</div>
|
|
4670
|
+
</div>
|
|
4671
|
+
</section>`;
|
|
4672
|
+
}
|
|
4587
4673
|
function sharedCss() {
|
|
4588
4674
|
return `
|
|
4589
4675
|
*{margin:0;padding:0;box-sizing:border-box}
|
|
@@ -5109,6 +5195,8 @@ ${trendHtml}
|
|
|
5109
5195
|
|
|
5110
5196
|
${top5Html}
|
|
5111
5197
|
|
|
5198
|
+
${buildServiceReminderHtml(modules)}
|
|
5199
|
+
|
|
5112
5200
|
<section>
|
|
5113
5201
|
<h2>Scan Statistics</h2>
|
|
5114
5202
|
<table>
|
|
@@ -5305,6 +5393,8 @@ ${unknownNote}
|
|
|
5305
5393
|
|
|
5306
5394
|
${trendHtml}
|
|
5307
5395
|
|
|
5396
|
+
${buildServiceReminderHtml(scanResults.modules)}
|
|
5397
|
+
|
|
5308
5398
|
${categorySections}
|
|
5309
5399
|
|
|
5310
5400
|
${remediationHtml}
|
|
@@ -5730,6 +5820,87 @@ var HW_DEFENSE_CHECKLIST = `
|
|
|
5730
5820
|
|
|
5731
5821
|
\u53C2\u8003\uFF1AAWS \u62A4\u7F51\u884C\u52A8 Standard Operation Procedure (Compliance IEM)
|
|
5732
5822
|
`;
|
|
5823
|
+
var SERVICE_RECOMMENDATIONS2 = {
|
|
5824
|
+
security_hub_findings: {
|
|
5825
|
+
icon: "\u{1F534}",
|
|
5826
|
+
service: "Security Hub",
|
|
5827
|
+
impact: "\u65E0\u6CD5\u83B7\u53D6 300+ \u9879\u81EA\u52A8\u5316\u5B89\u5168\u68C0\u67E5\uFF08FSBP/CIS/PCI DSS \u6807\u51C6\uFF09",
|
|
5828
|
+
action: "\u542F\u7528 Security Hub \u83B7\u5F97\u6700\u5168\u9762\u7684\u5B89\u5168\u6001\u52BF\u8BC4\u4F30"
|
|
5829
|
+
},
|
|
5830
|
+
guardduty_findings: {
|
|
5831
|
+
icon: "\u{1F534}",
|
|
5832
|
+
service: "GuardDuty",
|
|
5833
|
+
impact: "\u65E0\u6CD5\u68C0\u6D4B\u5A01\u80C1\u6D3B\u52A8\uFF08\u6076\u610F IP\u3001\u5F02\u5E38 API \u8C03\u7528\u3001\u52A0\u5BC6\u8D27\u5E01\u6316\u77FF\u7B49\uFF09",
|
|
5834
|
+
action: "\u542F\u7528 GuardDuty \u83B7\u5F97\u6301\u7EED\u5A01\u80C1\u68C0\u6D4B\u80FD\u529B"
|
|
5835
|
+
},
|
|
5836
|
+
inspector_findings: {
|
|
5837
|
+
icon: "\u{1F7E1}",
|
|
5838
|
+
service: "Inspector",
|
|
5839
|
+
impact: "\u65E0\u6CD5\u626B\u63CF EC2/Lambda/\u5BB9\u5668\u7684\u8F6F\u4EF6\u6F0F\u6D1E\uFF08CVE\uFF09",
|
|
5840
|
+
action: "\u542F\u7528 Inspector \u53D1\u73B0\u5DF2\u77E5\u5B89\u5168\u6F0F\u6D1E"
|
|
5841
|
+
},
|
|
5842
|
+
trusted_advisor_findings: {
|
|
5843
|
+
icon: "\u{1F7E1}",
|
|
5844
|
+
service: "Trusted Advisor",
|
|
5845
|
+
impact: "\u65E0\u6CD5\u83B7\u53D6 AWS \u6700\u4F73\u5B9E\u8DF5\u5B89\u5168\u68C0\u67E5",
|
|
5846
|
+
action: "\u5347\u7EA7\u81F3 Business/Enterprise Support \u8BA1\u5212\u4EE5\u4F7F\u7528 Trusted Advisor \u5B89\u5168\u68C0\u67E5"
|
|
5847
|
+
},
|
|
5848
|
+
config_rules_findings: {
|
|
5849
|
+
icon: "\u{1F7E1}",
|
|
5850
|
+
service: "AWS Config",
|
|
5851
|
+
impact: "\u65E0\u6CD5\u68C0\u67E5\u8D44\u6E90\u914D\u7F6E\u5408\u89C4\u72B6\u6001",
|
|
5852
|
+
action: "\u542F\u7528 AWS Config \u5E76\u914D\u7F6E Config Rules"
|
|
5853
|
+
},
|
|
5854
|
+
access_analyzer_findings: {
|
|
5855
|
+
icon: "\u{1F7E1}",
|
|
5856
|
+
service: "IAM Access Analyzer",
|
|
5857
|
+
impact: "\u65E0\u6CD5\u68C0\u6D4B\u8D44\u6E90\u662F\u5426\u88AB\u5916\u90E8\u8D26\u53F7\u6216\u516C\u7F51\u8BBF\u95EE",
|
|
5858
|
+
action: "\u521B\u5EFA IAM Access Analyzer\uFF08\u8D26\u6237\u7EA7\u6216\u7EC4\u7EC7\u7EA7\uFF09"
|
|
5859
|
+
},
|
|
5860
|
+
patch_compliance_findings: {
|
|
5861
|
+
icon: "\u{1F7E1}",
|
|
5862
|
+
service: "SSM Patch Manager",
|
|
5863
|
+
impact: "\u65E0\u6CD5\u68C0\u67E5\u5B9E\u4F8B\u8865\u4E01\u5408\u89C4\u72B6\u6001",
|
|
5864
|
+
action: "\u5B89\u88C5 SSM Agent \u5E76\u914D\u7F6E Patch Manager"
|
|
5865
|
+
}
|
|
5866
|
+
};
|
|
5867
|
+
var SERVICE_NOT_ENABLED_PATTERNS2 = [
|
|
5868
|
+
"not enabled",
|
|
5869
|
+
"not found",
|
|
5870
|
+
"No IAM Access Analyzer",
|
|
5871
|
+
"No SSM-managed instances",
|
|
5872
|
+
"requires AWS Business or Enterprise Support",
|
|
5873
|
+
"not available",
|
|
5874
|
+
"is not enabled"
|
|
5875
|
+
];
|
|
5876
|
+
function buildServiceReminder(modules) {
|
|
5877
|
+
const disabledServices = [];
|
|
5878
|
+
for (const mod of modules) {
|
|
5879
|
+
const rec = SERVICE_RECOMMENDATIONS2[mod.module];
|
|
5880
|
+
if (!rec) continue;
|
|
5881
|
+
if (!mod.warnings?.length) continue;
|
|
5882
|
+
const hasNotEnabled = mod.warnings.some(
|
|
5883
|
+
(w) => SERVICE_NOT_ENABLED_PATTERNS2.some((p) => w.includes(p))
|
|
5884
|
+
);
|
|
5885
|
+
if (hasNotEnabled) {
|
|
5886
|
+
disabledServices.push(rec);
|
|
5887
|
+
}
|
|
5888
|
+
}
|
|
5889
|
+
if (disabledServices.length === 0) return "";
|
|
5890
|
+
const lines = [
|
|
5891
|
+
"",
|
|
5892
|
+
"\u26A1 \u4EE5\u4E0B\u5B89\u5168\u670D\u52A1\u672A\u542F\u7528\uFF0C\u90E8\u5206\u68C0\u67E5\u65E0\u6CD5\u6267\u884C\uFF1A",
|
|
5893
|
+
""
|
|
5894
|
+
];
|
|
5895
|
+
for (const svc of disabledServices) {
|
|
5896
|
+
lines.push(`${svc.icon} ${svc.service} \u672A\u542F\u7528`);
|
|
5897
|
+
lines.push(` \u5F71\u54CD\uFF1A${svc.impact}`);
|
|
5898
|
+
lines.push(` \u5EFA\u8BAE\uFF1A${svc.action}`);
|
|
5899
|
+
lines.push("");
|
|
5900
|
+
}
|
|
5901
|
+
lines.push("\u542F\u7528\u4EE5\u4E0A\u670D\u52A1\u540E\u91CD\u65B0\u626B\u63CF\u53EF\u83B7\u5F97\u66F4\u5B8C\u6574\u7684\u5B89\u5168\u8BC4\u4F30\u3002");
|
|
5902
|
+
return lines.join("\n");
|
|
5903
|
+
}
|
|
5733
5904
|
function summarizeResult(result) {
|
|
5734
5905
|
const { summary } = result;
|
|
5735
5906
|
const lines = [
|
|
@@ -5737,6 +5908,10 @@ function summarizeResult(result) {
|
|
|
5737
5908
|
`Total findings: ${summary.totalFindings} (${summary.critical} Critical, ${summary.high} High, ${summary.medium} Medium, ${summary.low} Low)`,
|
|
5738
5909
|
`Modules: ${summary.modulesSuccess} succeeded, ${summary.modulesError} errored`
|
|
5739
5910
|
];
|
|
5911
|
+
const reminder = buildServiceReminder(result.modules);
|
|
5912
|
+
if (reminder) {
|
|
5913
|
+
lines.push(reminder);
|
|
5914
|
+
}
|
|
5740
5915
|
return lines.join("\n");
|
|
5741
5916
|
}
|
|
5742
5917
|
function summarizeScanResult(result) {
|