Skip to main content
HIGHIAMSecurity

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

  1. 1Review IAM policies for overly broad permissions
  2. 2Replace wildcard (*) actions with specific actions
  3. 3Use IAM Access Analyzer to identify unused permissions
FlaggedGranting actions '*' on resources '*' gives the role unrestricted access to every API on every resource in the account.
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: ['*'],
}));
FixedScoping the statement to specific S3 actions on a single bucket ARN follows least privilege and no longer trips the wildcard check.
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::Role

Compliance frameworks

SOC2HIPAAPCI-DSSCISNIST

AWS documentation

Read the AWS guidance

Intentional? 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 scan

CDK Insights runs this and 118+ other rules locally against your synthesised CDK app โ€” free, no account, your code never leaves your machine.

More IAM rules