Add AWS CloudFormation misconfiguration rule pack#241
Open
seonghobae wants to merge 1 commit into
Open
Conversation
Six high-precision pattern-regex rules in scanner/rules/cloudformation.yml
covering raw CFN templates (YAML/JSON/.template), a gap next to the existing
Terraform-AWS coverage:
- cfn-iam-policy-star-star (CRITICAL): Action:* with Resource:* in one
statement, with statement-boundary tempering to avoid cross-statement FPs
- cfn-s3-bucket-public-acl (HIGH): AccessControl PublicRead/PublicReadWrite
windowed on Type: AWS::S3::Bucket
- cfn-security-group-open-world (HIGH): ingress open to 0.0.0.0/0 or ::/0;
default open egress does not fire
- cfn-rds-publicly-accessible (HIGH): PubliclyAccessible: true (CFN casing)
- cfn-storage-unencrypted (HIGH): StorageEncrypted: false or EBS volume
Encrypted: false
- cfn-secret-parameter-default (HIGH): secret-named Parameter with a literal
Default; {{resolve:...}} dynamic references pass
Every pattern is anchored on CFN-specific context (AWS:: type names,
PascalCase property names), and tests assert zero findings on Kubernetes
manifests, docker-compose files, and GitHub Actions workflows. 29 new tests
(positives, negatives, severities, e2e scans); repo self-scan stays clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EywwS2Du8pimW7xqRP3An3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
scanner/rules/cloudformation.yml— six high-precisionpattern-regexrules for raw AWS CloudFormation templates (.yaml/.yml/.json/.template). Terraform-AWS misconfigurations are already covered by external engines; raw CFN templates were a gap.cfn-iam-policy-star-starAction: *withResource: *in one IAM statement (full account admin)cfn-s3-bucket-public-aclAWS::S3::BucketwithAccessControl: PublicRead(Write)cfn-security-group-open-world0.0.0.0/0/::/0cfn-rds-publicly-accessiblePubliclyAccessible: true(CFN casing)cfn-storage-unencryptedStorageEncrypted: false/ EBS volumeEncrypted: falsecfn-secret-parameter-defaultDefaultvaluePrecision
AWS::resource type names, PascalCase property names) — the pack does not blanket-match all YAML.{{resolve:secretsmanager:...}}/ SSM dynamic references pass the secret-default rule; CDK camelCase (publiclyAccessible) and lowercase GitHub Actionsdefault:keys do not match.Testing
tests/test_cloudformation_rules.py: 29 tests — positives/negatives per rule, severity checks, e2e scans (misconfigured template fires all six; secure template, k8s, compose, and workflow fixtures stay clean). Secret-shaped fixtures are assembled at runtime.cfn-*findings; the new rule file and test file trigger no rules at all.🤖 Generated with Claude Code
https://claude.ai/code/session_01EywwS2Du8pimW7xqRP3An3