sonarjs/aws-iam-all-resources-accessible
eslint-plugin-sonarjs
No autofix
eslint.config.js
export default [
{
rules: {
"sonarjs/aws-iam-all-resources-accessible": "error",
},
},
];IAM policies should not grant access to all account resources
import { aws_iam as iam } from 'aws-cdk-lib'
new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["iam:CreatePolicyVersion"],
resources: ["*"] // Sensitive
})
]
})import { aws_iam as iam } from 'aws-cdk-lib'
new iam.PolicyDocument({
statements: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ["iam:CreatePolicyVersion"],
resources: ["arn:aws:iam:::policy/team1/*"]
})
]
})Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/aws-iam-all-resources-accessible
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/aws-iam-all-resources-accessible": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Braces and parentheses should be used consistently with arrow functions
Optional boolean parameters should have default value
Class methods should be used instead of "prototype" assignments