mcpField
I
infra-security-review

infra-security-review

github.com/majesticlabs-dev安全5062 次安装7 周前更新
代码仓库

关于 infra-security-review

infra-security-review 是用于审查 IaC 代码的基础设施安全检查清单与搜索模式,面向基础设施安全审查人员。它按严重程度覆盖状态存储、密钥、网络、计算、数据库和存储风险,并提供报告模板。

主要功能

  1. 01检查状态后端配置风险
  2. 02查找硬编码密钥和凭据
  3. 03审查网络与计算安全设置
  4. 04检查数据库和存储暴露风险
  5. 05提供严重程度指南与报告模板

适用场景

  1. 01审查 IaC 中的状态存储安全
  2. 02查找代码中的凭据暴露
  3. 03检查基础设施网络访问配置
  4. 04整理安全审查发现与整改建议

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill infra-security-review

安装后在 Claude Code 中输入/infra-security-review确认已加载。

详细介绍

基础设施安全审查模式

用于审查 IaC 代码的安全检查清单和 grep 模式。验证基础设施安全时,请使用这些模式。

安全检查清单

状态后端安全
检查项严重性模式
S3 存储桶未加密严重encrypt = false 或缺失
未启用状态锁定高未配置 DynamoDB 表
存储桶策略允许公开访问严重block_public_* 并非全部为 true
未启用版本控制中未启用 versioning
密钥泄露
检查项严重性模式
硬编码的 AWS 密钥严重AKIA[0-9A-Z]{16}
硬编码的密码严重password\s*=\s*"[^"]+[^}]"
代码中包含数据库凭据严重DATABASE_URL 中包含密码
变量中包含 API 密钥高api_key、secret_key 默认值
网络安全
检查项严重性模式
SSH 对所有来源开放严重端口 22 上的 0.0.0.0/0
数据库可公开访问严重缺少 private_network_uuid
CIDR 范围过宽中公共资源使用 /8、/16
未配置防火墙高Droplet 没有关联防火墙资源
计算安全
检查项严重性模式
已启用 root 登录高cloud-init 中的 PermitRootLogin yes
已启用密码身份验证中PasswordAuthentication yes
未加固 SSH低未配置 ClientAliveInterval
未启用监控低monitoring = false
数据库安全
检查项严重性模式
数据库允许公开访问严重未配置数据库防火墙规则
未连接 VPC高缺少 private_network_uuid
版本较旧中旧版数据库引擎
生产环境仅有单个节点低生产环境中 node_count = 1
存储安全
检查项严重性模式
S3 存储桶允许公开访问严重acl = "public-read"
未启用加密高未配置 SSE
未启用访问日志中缺少访问日志存储桶

Grep 模式

# Hardcoded secrets
grep -rE 'AKIA[0-9A-Z]{16}' *.tf
grep -rE 'password\s*=\s*"[^$\{][^"]*"' *.tf
grep -rE 'secret.*=\s*"[^$\{][^"]*"' *.tf
grep -rE 'api_key\s*=\s*"' *.tf

# Network exposure
grep -rE '0\.0\.0\.0/0.*22' *.tf
grep -rE 'cidr_blocks.*0\.0\.0\.0/0' *.tf
grep -rE 'publicly_accessible\s*=\s*true' *.tf

# State security
grep -rE 'encrypt\s*=\s*false' *.tf
grep -rE 'block_public_acls\s*=\s*false' *.tf

# Cloud-init issues
grep -rE 'PermitRootLogin\s+yes' *.tf *.yaml
grep -rE 'PasswordAuthentication\s+yes' *.tf *.yaml

报告模板

# Infrastructure Security Review

**Repository:** [name]
**Date:** [date]
**Files Reviewed:** [count]

## Summary

| Severity | Count |
|----------|-------|
| Critical | X |
| High | X |
| Medium | X |
| Low | X |

## Findings

### [SEVERITY-001] Title

**File:** `path/to/file.tf:line`
**Resource:** `resource_type.name`

**Issue:**
Description of the security issue.

**Current:**
```hcl
[current code]

修复措施:

[fixed code]

合规说明

  • 已启用状态加密(SOC 2)
  • 未硬编码凭据(PCI-DSS)
  • 已实施网络分段(HIPAA)
  • 已启用访问日志(所有框架)

## Severity Guide

| Severity | Definition | Action |
|----------|------------|--------|
| Critical | Direct security exposure, data breach risk | Block deployment |
| High | Significant risk, exploitable weakness | Fix before production |
| Medium | Best practice violation, indirect risk | Fix within 30 days |
| Low | Minor hardening opportunity | Address when convenient |

评论

支持 Markdown