Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计通过

iac-security安全中心

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

449

周安装

18

GitHub Stars

29

下载量

145
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:iac-security(安全中心)
来源仓库:https://github.com/snyk/studio-recipes
仓库路径:skills/iac-security
安装命令:
npx skills add https://github.com/snyk/studio-recipes --skill iac-security
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/snyk/studio-recipes --skill iac-security

简介

iac-security 用于辅助安全审计、权限检查和漏洞排查,适合梳理敏感配置和分析鉴权逻辑。

  • 适用于 IaC 配置的安全复核、依赖风险检查和认证流程审查场景。
  • Agent 可返回安全建议和复核清单,但不能将工具输出直接作为最终结论。
  • 涉及密钥或生产系统时,应先确认最小权限和操作边界,避免泄露敏感信息。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Infrastructure as Code Security

Comprehensive security scanning for Infrastructure as Code to catch misconfigurations before they become production vulnerabilities.

Core Principle: Security issues are cheaper to fix in code than in production.


Quick Start

1. Identify IaC files (Terraform, K8s, CloudFormation, ARM)
2. Run snyk_iac_scan on the directory
3. Analyze misconfigurations by severity
4. Provide secure configuration alternatives

Supported IaC Formats

PlatformFile Types
Terraform.tf, .tf.json, .tfvars
Terraform PlanJSON plan output (terraform show -json)
Kubernetes.yaml / .yml with apiVersion + kind
HelmChart templates (requires Chart.yaml)
AWS CloudFormation.json / .yaml with AWSTemplateFormatVersion
Azure ARM.json with $schema ARM URL
Serverless Frameworkserverless.yml

Phase 1: Discovery

Goal: Identify all IaC files that need scanning.

Check for these indicators to confirm IaC type:

  • Terraform: .tf files, terraform.tfstate, provider blocks
  • Kubernetes: YAML with apiVersion/kind, directories named k8s, manifests
  • CloudFormation: AWSTemplateFormatVersion key, Resources section with AWS types
  • Azure ARM: $schema containing deploymentTemplate

Then determine scan scope: single file, directory, or recursive.


Phase 2: Execute Scan

Goal: Run appropriate IaC security scan.

Basic Scan

Run snyk_iac_scan with:
- path: <directory or file path>

Terraform with Variables

Run snyk_iac_scan with:
- path: <terraform directory>
- var_file: <path to .tfvars if using variables>

Terraform Plan (more accurate)

terraform plan -out=tfplan
terraform show -json tfplan > tfplan.json
Run snyk_iac_scan with:
- path: tfplan.json
- scan: "planned-values"  # or "resource-changes"

Custom Rules

Run snyk_iac_scan with:
- path: <directory>
- rules: <path to custom rules bundle>

Phase 3: Analyze Results

Goal: Understand and categorize misconfigurations.

Severity Assessment

SeverityRisk LevelExamples
CriticalImmediate riskPublic S3, open security groups
HighSignificant riskMissing encryption, excessive perms
MediumModerate riskMissing logging, broad IAM
LowBest practiceMissing tags, suboptimal config

Generate Summary

## IaC Security Scan Results

### Overview
| Severity | Count | Status |
|----------|-------|--------|
| Critical | X | 🔴 Block |
| High | Y | 🟠 Fix Required |
| Medium | Z | 🟡 Recommended |
| Low | W | 🔵 Optional |

### Critical Issues
| Resource | Issue | Location |
|----------|-------|----------|
| aws_s3_bucket.data | Public access enabled | main.tf:45 |
| aws_security_group.web | Open to 0.0.0.0/0 on port 22 | network.tf:23 |

### High Issues
| Resource | Issue | Location |
|----------|-------|----------|
| aws_rds_instance.db | Encryption not enabled | database.tf:12 |

Categorize by Domain

Group issues for easier remediation:

  • Network Security: Security groups, Network ACLs, Load balancer config, VPC settings
  • Data Protection: Encryption at rest/in transit, Backup configuration, Key management
  • Access Control: IAM policies, Service accounts, RBAC settings, API permissions
  • Logging & Monitoring: CloudTrail/audit logs, Access logging, Alerting config

Phase 4: Remediation

Goal: Provide secure configuration fixes. Apply the pattern below to each finding; representative examples follow.

Terraform Fixes

S3 Bucket — Block Public Access

# Insecure
resource "aws_s3_bucket" "data" {
  bucket = "my-bucket"
}

# Secure
resource "aws_s3_bucket" "data" {
  bucket = "my-bucket"
}

resource "aws_s3_bucket_public_access_block" "data" {
  bucket = aws_s3_bucket.data.id

  block_public_acls       = true
  block_public_policy     = true
  ignore_public_acls      = true
  restrict_public_buckets = true
}

Security Group — Restrict Access

# Insecure - open to world
resource "aws_security_group" "web" {
  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]  # BAD
  }
}

# Secure - restricted to VPN/internal range
resource "aws_security_group" "web" {
  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["10.0.0.0/8"]
  }
}

RDS — Enable Encryption

# Secure
resource "aws_db_instance" "main" {
  engine              = "postgres"
  instance_class      = "db.t3.micro"
  storage_encrypted   = true
  kms_key_id          = aws_kms_key.rds.arn
  deletion_protection = true
}

Kubernetes Fixes

Pod Security — Non-Root User & Resource Limits

apiVersion: v1
kind: Pod
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
  containers:
  - name: app
    image: myapp
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities:
        drop:
          - ALL
    resources:
      limits:
        cpu: "500m"
        memory: "512Mi"
      requests:
        cpu: "200m"
        memory: "256Mi"

Network Policy — Restrict Traffic

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: app-network-policy
spec:
  podSelector:
    matchLabels:
      app: myapp
  policyTypes:
  - Ingress
  - Egress
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: allowed-namespace

CloudFormation Fixes

S3 Bucket — Encryption & Public Access Block

Resources:
  DataBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: aws:kms
              KMSMasterKeyID: !Ref DataBucketKey
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true

Phase 5: Verification

Goal: Confirm fixes are effective.

Re-scan After Changes

Run snyk_iac_scan with:
- path: <same directory>

For Terraform, regenerate and scan the plan:

terraform plan -out=tfplan.new
terraform show -json tfplan.new > tfplan.new.json

Report Improvements

## Fix Verification

| Severity | Before | After | Change |
|----------|--------|-------|--------|
| Critical | 2 | 0 | -2 ✅ |
| High | 5 | 1 | -4 ✅ |
| Medium | 8 | 6 | -2 ✅ |

### Remaining Issues
- 1 High: Third-party module - opened issue
- 6 Medium: Accepted risk (documented)

Best Practices

Prevention

  1. Scan in CI/CD: Fail builds with critical issues
  2. Pre-commit hooks: Catch issues before commit
  3. Module security: Scan reusable modules
  4. Policy as code: Define custom rules for org standards

Policy File Usage

Create .snyk to manage exceptions:

ignore:
  SNYK-CC-TF-123:
    - '*':
        reason: 'Accepted risk - internal development environment'
        expires: 2025-06-01
        created: 2024-01-15

Custom Rules

For organization-specific requirements:

  1. Write rules in Rego (OPA) format
  2. Bundle as .tar.gz
  3. Pass to scan with --rules option

Error Handling

ErrorSolutions
Could not read Terraform stateRun terraform init; check state backend; scan .tf files directly
Invalid HCL syntaxRun terraform validate; check syntax; ensure all variables are defined
Could not parse plan fileRegenerate with terraform show -json; check Terraform version compatibility; verify JSON validity

Constraints

  1. Scan before apply: Never apply unscanned IaC
  2. Block on critical: Critical issues must be fixed
  3. Document exceptions: Use .snyk policy for accepted risks
  4. Validate plans: Prefer plan scanning over file scanning for Terraform
  5. Continuous monitoring: Re-scan when dependencies update

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.24%
按下载量换算54

Claude

29.31%
按下载量换算42

Cursor

17.26%
按下载量换算25

Gemini CLI

9.11%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills