IAM Overly Permissive Policies
iam-policies-overly-permissive
What this rule checks
Detects IAM policies with overly permissive actions like * wildcards.
How to fix it
- 1Review IAM policies for overly broad permissions
- 2Replace wildcard (*) actions with specific actions
- 3Use IAM Access Analyzer to identify unused permissions
import { aws_iam as iam } from 'aws-cdk-lib';
const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
});
role.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['*'],
resources: ['*'],
}));import { aws_iam as iam } from 'aws-cdk-lib';
const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'),
});
role.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['s3:GetObject', 's3:PutObject'],
resources: ['arn:aws:s3:::my-app-bucket/*'],
}));CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.
Affected resource types
AWS::IAM::PolicyAWS::IAM::RoleIntentional? Suppress this finding
Sometimes a flag is deliberate โ a genuinely public endpoint, say. You can dismiss iam-policies-overly-permissive and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "iam-policies-overly-permissive", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::iam-policies-overly-permissive',
reason: 'Why this is intentional',
});Use the rule ID iam-policies-overly-permissive shown above โ not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs โ
Catch this in your stack
$ npx cdk-insights scanCDK Insights runs this and 118+ other rules locally against your synthesised CDK app โ free, no account, your code never leaves your machine.