Skip to content
Merged
Changes from all commits
Commits
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
Expand Up @@ -25,10 +25,12 @@ rule NO_ROOT_PRINCIPALS_EXCEPT_KMS_SECRETS when %resources_no_root_principals !e
when Principal.AWS is_string {
Principal.AWS != /(?i):root$/
}
# Check if AWS is an array - only check string items
# Check if AWS is an array - only check string items, skip intrinsic functions
when Principal.AWS is_list {
when Principal.AWS[*] is_string {
Principal.AWS[*] != /(?i):root$/
Principal.AWS[*] {
when this is_string {
this != /(?i):root$/
}
}
}
}
Expand All @@ -45,7 +47,11 @@ rule NO_ROOT_PRINCIPALS_EXCEPT_KMS_SECRETS when %resources_no_root_principals !e
Principal.AWS != /(?i):root$/
}
when Principal.AWS is_list {
Principal.AWS[*] != /(?i):root$/
Principal.AWS[*] {
when this is_string {
this != /(?i):root$/
}
}
}
}
}
Expand All @@ -61,7 +67,11 @@ rule NO_ROOT_PRINCIPALS_EXCEPT_KMS_SECRETS when %resources_no_root_principals !e
Principal.AWS != /(?i):root$/
}
when Principal.AWS is_list {
Principal.AWS[*] != /(?i):root$/
Principal.AWS[*] {
when this is_string {
this != /(?i):root$/
}
}
}
}
}
Expand All @@ -77,11 +87,15 @@ rule NO_ROOT_PRINCIPALS_EXCEPT_KMS_SECRETS when %resources_no_root_principals !e
Principal.AWS != /(?i):root$/
}
when Principal.AWS is_list {
Principal.AWS[*] != /(?i):root$/
Principal.AWS[*] {
when this is_string {
this != /(?i):root$/
}
}
}
}
}
}
}
}
}
}
Loading