Skip to content

kerberosmansour/hulumi / skills/hulumi-threat-model

hulumi-threat-model

Flagged

Run an AWS or GitHub cloud / platform threat model for a specific Hulumi scenario. Produces a structured markdown threat-model document at docs/threat-model-<scenario>-<date>.md in the user's working directory, citing CSA CCM v4.1, NIST SP 800-53 Rev 5, NIST SP 800-218A, MITRE ATLAS v5.1, CIS AWS Foundations v5.0.0, CIS GitHub Benchmark v1.2.0, NIST SSDF v1.1, OpenSSF Scorecard, MITRE ATT&CK T1195, and GitHub Well-Architected SSDF by framework ID only (no verbatim control text). Use when the user asks for a threat model for an AWS or GitHub scenario, wants to ground IaC design decisions in standard controls, or wants to see which @hulumi/baseline components apply.

scenarios/lambda-secrets-access.json

View on GitHub
{
  "id": "lambda-secrets-access",
  "title": "Lambda Function Secrets Access — execution role scoping, Secrets Manager, KMS",
  "description": "An engineer is writing a Lambda function that needs read access to a database password in Secrets Manager, encrypted by the `AccountFoundation.kmsRing.secrets` CMK. Target end state: the Lambda execution role has the narrowest possible grant (`secretsmanager:GetSecretValue` on exactly one ARN), KMS key policy grants `kms:Decrypt` to that role only, environment variables do not leak sensitive config, VPC execution is used when the Lambda needs to reach private resources, and dead-letter queues + X-Ray tracing are on for observability.",
  "requiredFrameworks": ["CCM", "NIST-800-53-r5", "ATLAS", "CIS-AWS-v5.0.0"],
  "actors": [
    "Platform Engineer (trusted)",
    "Lambda execution role (trusted within its narrow scope)",
    "External Attacker (via RCE in the Lambda code or via Lambda URL)",
    "Compromised upstream dependency (via supply-chain)"
  ],
  "assets": [
    "The database password stored in Secrets Manager",
    "The KMS CMK that encrypts the secret",
    "Lambda function code and layer contents",
    "Lambda execution logs in CloudWatch"
  ],
  "stride": [
    {
      "type": "E",
      "name": "Over-scoped execution role",
      "description": "An LLM-authored Lambda policy grants `secretsmanager:GetSecretValue` with `Resource: '*'` or `kms:Decrypt` on all keys. Any post-deployment compromise of the Lambda exposes every secret in the account. Mitigation: exact-ARN policy; HardeningPack rejects wildcard `Resource` outside narrow read namespaces.",
      "controls": [
        "CCM:IAM-07",
        "CIS-AWS-v5.0.0:1.22",
        "NIST-800-53-r5:AC-3",
        "NIST-800-53-r5:AC-6"
      ]
    },
    {
      "type": "I",
      "name": "Secret leakage via environment variable",
      "description": "Developers pass the raw secret into the Lambda's `environment.variables` instead of fetching it at invocation. The secret ends up in CloudFormation state, CloudTrail `UpdateFunctionConfiguration`, and Lambda console display. Mitigation: runtime fetch via SDK; CrossGuard rule rejecting env vars matching password/secret/key patterns.",
      "controls": ["CCM:DSP-01", "NIST-800-53-r5:SC-28", "NIST-800-53-r5:IA-5"]
    },
    {
      "type": "T",
      "name": "Supply-chain dependency tampering",
      "description": "A Node / Python dependency in the Lambda's `node_modules` / `site-packages` becomes malicious (Shai-Hulud-style npm account takeover). Mitigation: exact-version pinning + integrity hashes in `package-lock.json` / `poetry.lock`; SLSA provenance verification in the Lambda packaging pipeline.",
      "controls": ["CCM:STA-07", "CCM:TVM-02", "NIST-800-53-r5:SI-7", "NIST-800-218:PS.2.1"]
    },
    {
      "type": "T",
      "name": "Prompt-injection-driven secret exfiltration",
      "description": "If the Lambda handles user prompts for an LLM-backed workflow, a malicious user can craft a prompt that coerces the LLM to produce code that fetches and emits the Secret Manager secret — a direct exfil channel. Mitigation: strict output parsing, no `eval` of LLM output, deny-list on sensitive secret names.",
      "controls": ["ATLAS:AML.T0051", "ATLAS:AML.T0080", "ATLAS:AML.T0099", "ATLAS:AML.T0102"]
    },
    {
      "type": "R",
      "name": "Repudiation via non-existent Lambda invocation logs",
      "description": "Lambda is invoked from Lambda URL or API Gateway; without CloudWatch Logs + X-Ray, invocation-level attribution is impossible. Mitigation: CloudWatch Logs on, retention ≥ 90d, X-Ray tracing on.",
      "controls": ["CCM:LOG-01", "NIST-800-53-r5:AU-2", "NIST-800-53-r5:AU-12"]
    },
    {
      "type": "D",
      "name": "Lambda cost-DoS via unthrottled concurrency",
      "description": "An attacker with the Lambda URL triggers millions of invocations, exhausting Lambda concurrency and driving cost. Mitigation: reserved concurrency cap, API Gateway rate-limits, AWS WAF in front.",
      "controls": ["CCM:LOG-04", "NIST-800-53-r5:SI-4"]
    }
  ],
  "recommendedComponents": [
    {
      "name": "hulumi.baseline.aws.SecureLambda",
      "availability": "Planned for v1.1+ (post-v1.0.0; not yet shipped)",
      "rationale": "Planned ComponentResource wrapping AWS Lambda with least-privilege execution role, VPC default, DLQ wiring, X-Ray tracing, reserved concurrency, and env-var secret-name denylist."
    },
    {
      "name": "hulumi.baseline.aws.AccountFoundation.secretsManager + kmsRing.secrets",
      "availability": "Shipped in M3 (v0.3)",
      "rationale": "Hulumi's AccountFoundation scaffolds a Secrets Manager namespace + a `secrets` CMK with rotation. The Lambda's execution role policy references the specific secret ARN and the specific key ARN, not wildcards."
    },
    {
      "name": "hulumi.policies.aws.HulumiHardeningPack",
      "availability": "Shipped in M2 (v0.2)",
      "rationale": "Blocks wildcard IAM and env-var secret exposure; rejects raw `aws.lambda.Function` without a supplied `role` that the pack can inspect."
    }
  ]
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall