feat(terraform): add CKV_AWS_394 for public Secrets Manager secret policy#7595
Open
PhinehasNarh wants to merge 1 commit into
Open
Conversation
…licy Checkov detects public/wildcard-principal resource policies for SNS (CKV_AWS_169), SQS (CKV_AWS_171), Glacier (CKV_AWS_167), KMS, S3 and others, but aws_secretsmanager_secret_policy had no equivalent check. A secret policy that allows secretsmanager:GetSecretValue to Principal: "*" without a scoping Condition exposes the secret (DB credentials, API keys, tokens) to any principal, and checkov reported no finding on it. Add CKV_AWS_394 using the same detection path as the existing SNS and Glacier checks (cloudsplaining ResourcePolicyDocument.internet_accessible_actions) so behavior stays consistent. Wildcard-with-Deny and wildcard scoped by a Condition still pass; unconditional wildcard Allow fails. Includes a unit test with 3 passing and 3 failing resources.
PhinehasNarh
requested a deployment
to
scan-security
July 2, 2026 10:10 — with
GitHub Actions
Waiting
5 tasks
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.
PR Information
Adds a new check, CKV_AWS_394, that flags an AWS Secrets Manager secret whose resource policy grants access to any principal (
Principal: "*"/AWS: "*") without aConditionscoping it.Why this matters
Checkov already detects public/wildcard-principal resource policies for a range of services: SNS (
CKV_AWS_169), SQS (CKV_AWS_171), Glacier (CKV_AWS_167), KMS, S3, and others.aws_secretsmanager_secret_policyhad no equivalent coverage, so a secret exposed to the entire internet passed silently.This is arguably the highest-impact resource to leave uncovered: a Secrets Manager secret typically holds database credentials, API keys, and tokens. A resource policy that allows
secretsmanager:GetSecretValuetoPrincipal: "*"makes those readable by any AWS account. Checkov reported no finding on that configuration before this change.The check reuses the same detection path as the existing SNS/Glacier checks (
cloudsplaining'sResourcePolicyDocument.internet_accessible_actions), so behavior and edge-case handling stay consistent with the rest of the codebase.Behavior
Principal: "*",Principal.AWS: "*", or a principal list containing"*"with anAlloweffect and no scopingCondition.Effect: Deny; wildcard scoped by aCondition(e.g.aws:SourceAccount); a specific principal ARN.Template validation
sm_fail_*fixturessm_pass_*fixturesUnit test:
tests/terraform/checks/resource/aws/test_SecretManagerSecretPolicyAnyPrincipal.py(3 passing resources, 3 failing resources).AI disclosure
Portions of this change were drafted with AI assistance; I reviewed, tested, and take ownership of every line.