Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
aed3edb
feat(query): add IAM Role Without Permission Boundary query metadata
balaakasam Mar 29, 2026
fef914a
feat(query): add IAM Role Without Permission Boundary query logic
balaakasam Mar 29, 2026
fda2bb1
feat(query): add IAM Role Without Permission Boundary positive test case
balaakasam Mar 29, 2026
a430b8f
feat(query): add IAM Role Without Permission Boundary negative test case
balaakasam Mar 29, 2026
85f898b
feat(query): add IAM Role Without Permission Boundary expected test r…
balaakasam Mar 29, 2026
0a98e03
add missing riskScore field to IAM Role Without Permission Boundary m…
balaakasam Apr 6, 2026
f565633
Merge branch 'master' into feat/iam-role-without-permission-boundary
cx-artur-ribeiro Apr 7, 2026
d240796
fix(query): update category to Access Control and fix riskScore format
balaakasam Apr 11, 2026
cb50fbc
fix(query): fix negative test case to include permissions_boundary at…
balaakasam Apr 11, 2026
f8b523f
fix(query): update positive expected result to include fileName
balaakasam Apr 11, 2026
66e2b2b
Merge branch 'master' into feat/iam-role-without-permission-boundary
balaakasam Apr 11, 2026
11693cc
Merge branch 'master' into feat/iam-role-without-permission-boundary
cx-artur-ribeiro Apr 14, 2026
b77ace3
Merge branch 'master' into feat/iam-role-without-permission-boundary
balaakasam Apr 25, 2026
a02d802
Update assets/queries/terraform/aws/iam_role_without_permission_bound…
balaakasam May 26, 2026
0104610
Merge branch 'master' into feat/iam-role-without-permission-boundary
balaakasam May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"id": "a4d32b6e-9c7f-4b2a-8e5d-1f3c9a0e7b42",
"queryName": "IAM Role Without Permission Boundary",
"severity": "MEDIUM",
"category": "Access Control",
"descriptionText": "IAM roles should have a permissions boundary defined to limit the maximum permissions that can be granted. Without a permission boundary, IAM roles can potentially be exploited to escalate privileges beyond intended scope.",
"descriptionUrl": "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role#permissions_boundary",
"platform": "Terraform",
"descriptionID": "a4d32b6e",
"cloudProvider": "aws",
"cwe": "269",
"riskScore": 3.0
}
Comment thread
balaakasam marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package Cx

import data.generic.common as common_lib
import data.generic.terraform as tf_lib

CxPolicy[result] {
resource := input.document[i].resource.aws_iam_role[name]
not common_lib.valid_key(resource, "permissions_boundary")

result := {
"documentId": input.document[i].id,
"resourceType": "aws_iam_role",
"resourceName": tf_lib.get_resource_name(resource, name),
"searchKey": sprintf("resource.aws_iam_role[%s]", [name]),
"issueType": "MissingAttribute",
"keyExpectedValue": sprintf("aws_iam_role[%s].permissions_boundary is defined", [name]),
"keyActualValue": sprintf("aws_iam_role[%s].permissions_boundary is undefined", [name]),
"searchLine": common_lib.build_search_line(["resource", "aws_iam_role", name], []),
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This should NOT trigger the query - permissions_boundary is defined
resource "aws_iam_role" "negative1" {
name = "negative_role"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
Service = "ec2.amazonaws.com"
}
}
]
})

permissions_boundary = "arn:aws:iam::123456789012:policy/BoundaryPolicy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This should trigger the query - no permissions_boundary defined
resource "aws_iam_role" "positive1" {
name = "positive_role"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = "sts:AssumeRole"
Effect = "Allow"
Principal = {
Service = "ec2.amazonaws.com"
}
}
]
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"queryName": "IAM Role Without Permission Boundary",
"severity": "MEDIUM",
"line": 2,
"fileName": "positive1.tf"
}
]
Loading