Skip to content

Commit 236e45e

Browse files
committed
fix: fix failing controls
1 parent 9111bc7 commit 236e45e

File tree

48 files changed

+443
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+443
-132
lines changed

compliance/controls/aws/aws_cis_v140_1_13.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Query:
2525
u.name,
2626
u.account_id,
2727
u.tags,
28-
u._ctx;
28+
u._ctx,
29+
u.kaytu_account_id,
30+
u.kaytu_resource_id;
2931
PrimaryTable: aws_iam_user
3032
ListOfTables:
3133
- aws_iam_user

compliance/controls/aws/aws_cis_v140_1_17.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Query:
1313
'arn:' || a.partition || ':::' || a.account_id as resource,
1414
count(policy_arn),
1515
a.account_id,
16-
a._ctx
16+
a._ctx,
17+
a.kaytu_account_id,
18+
a.kaytu_resource_id
1719
from
1820
aws_account as a
1921
left join aws_iam_role as r on r.account_id = a.account_id
@@ -24,7 +26,9 @@ Query:
2426
group by
2527
a.account_id,
2628
a.partition,
27-
a._ctx
29+
a._ctx,
30+
a.kaytu_account_id,
31+
a.kaytu_resource_id
2832
)
2933
select
3034
resource,

compliance/controls/aws/aws_cis_v140_1_2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Query:
2121
partition,
2222
title,
2323
account_id,
24-
_ctx
24+
_ctx,
25+
kaytu_account_id as kaytu_account_id,
26+
kaytu_resource_id as kaytu_resource_id
2527
from
2628
aws_account
2729
)

compliance/controls/aws/aws_cis_v140_3_3.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Query:
1616
t.account_id,
1717
t.tags,
1818
t._ctx,
19+
t.kaytu_account_id,
20+
t.kaytu_resource_id,
1921
count(acl_grant) filter (where acl_grant -> 'Grantee' ->> 'URI' like '%acs.amazonaws.com/groups/global/AllUsers') as all_user_grants,
2022
count(acl_grant) filter (where acl_grant -> 'Grantee' ->> 'URI' like '%acs.amazonaws.com/groups/global/AuthenticatedUsers') as auth_user_grants,
2123
count(s) filter (where s ->> 'Effect' = 'Allow' and p = '*' ) as anon_statements
@@ -31,15 +33,17 @@ Query:
3133
t.region,
3234
t.account_id,
3335
t.tags,
34-
t._ctx
36+
t._ctx,
37+
t.kaytu_account_id,
38+
t.kaytu_resource_id
3539
)
3640
select
3741
case
3842
when arn is null then 'arn:aws:s3::' || name
3943
else arn
4044
end as resource,
41-
t.kaytu_account_id as kaytu_account_id,
42-
t.kaytu_resource_id as kaytu_resource_id,
45+
kaytu_account_id as kaytu_account_id,
46+
kaytu_resource_id as kaytu_resource_id,
4347
case
4448
when arn is null then 'skip'
4549
when all_user_grants > 0 then 'alarm'
@@ -54,7 +58,7 @@ Query:
5458
when anon_statements > 0 then name || ' grants access to AWS:*" in bucket policy.'
5559
else name || ' does not grant anonymous access in ACL or bucket policy.'
5660
end as reason
57-
61+
5862
from
5963
public_bucket_data;
6064
PrimaryTable: aws_s3_bucket

compliance/controls/aws/aws_cis_v140_3_9.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Query:
1414
owner_id,
1515
vpc_id,
1616
tags,
17-
_ctx
17+
_ctx,
18+
kaytu_account_id,
19+
kaytu_resource_id
1820
from
1921
aws_vpc
2022
order by

compliance/controls/aws/aws_cis_v150_1_13.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ Query:
2525
u.name,
2626
u.account_id,
2727
u.tags,
28-
u._ctx;
28+
u._ctx,
29+
u.kaytu_account_id,
30+
u.kaytu_resource_id;
2931
PrimaryTable: aws_iam_user
3032
ListOfTables:
3133
- aws_iam_user

compliance/controls/aws/aws_cis_v150_1_17.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Query:
1313
'arn:' || a.partition || ':::' || a.account_id as resource,
1414
count(policy_arn),
1515
a.account_id,
16-
a._ctx
16+
a._ctx,
17+
a.kaytu_account_id,
18+
a.kaytu_resource_id
1719
from
1820
aws_account as a
1921
left join aws_iam_role as r on r.account_id = a.account_id
@@ -24,12 +26,14 @@ Query:
2426
group by
2527
a.account_id,
2628
a.partition,
27-
a._ctx
29+
a._ctx,
30+
a.kaytu_account_id,
31+
a.kaytu_resource_id
2832
)
2933
select
3034
resource,
31-
a.kaytu_account_id as kaytu_account_id,
32-
a.kaytu_resource_id as kaytu_resource_id,
35+
kaytu_account_id as kaytu_account_id,
36+
kaytu_resource_id as kaytu_resource_id,
3337
case
3438
when count > 0 then 'ok'
3539
else 'alarm'

compliance/controls/aws/aws_cis_v150_1_2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Query:
2121
partition,
2222
title,
2323
account_id,
24-
_ctx
24+
_ctx,
25+
kaytu_account_id,
26+
kaytu_resource_id
2527
from
2628
aws_account
2729
)

compliance/controls/aws/aws_cis_v150_3_3.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Query:
1818
t._ctx,
1919
count(acl_grant) filter (where acl_grant -> 'Grantee' ->> 'URI' like '%acs.amazonaws.com/groups/global/AllUsers') as all_user_grants,
2020
count(acl_grant) filter (where acl_grant -> 'Grantee' ->> 'URI' like '%acs.amazonaws.com/groups/global/AuthenticatedUsers') as auth_user_grants,
21-
count(s) filter (where s ->> 'Effect' = 'Allow' and p = '*' ) as anon_statements
21+
count(s) filter (where s ->> 'Effect' = 'Allow' and p = '*' ) as anon_statements,
22+
t.kaytu_account_id as kaytu_account_id,
23+
t.kaytu_resource_id as kaytu_resource_id
2224
from
2325
aws_cloudtrail_trail as t
2426
left join aws_s3_bucket as b on t.s3_bucket_name = b.name
@@ -31,15 +33,17 @@ Query:
3133
t.region,
3234
t.account_id,
3335
t.tags,
34-
t._ctx
36+
t._ctx,
37+
t.kaytu_account_id,
38+
t.kaytu_resource_id
3539
)
3640
select
3741
case
3842
when arn is null then 'arn:aws:s3::' || name
3943
else arn
4044
end as resource,
41-
t.kaytu_account_id as kaytu_account_id,
42-
t.kaytu_resource_id as kaytu_resource_id,
45+
kaytu_account_id as kaytu_account_id,
46+
kaytu_resource_id as kaytu_resource_id,
4347
case
4448
when arn is null then 'skip'
4549
when all_user_grants > 0 then 'alarm'
@@ -54,7 +58,7 @@ Query:
5458
when anon_statements > 0 then name || ' grants access to AWS:*" in bucket policy.'
5559
else name || ' does not grant anonymous access in ACL or bucket policy.'
5660
end as reason
57-
61+
5862
from
5963
public_bucket_data;
6064
PrimaryTable: aws_s3_bucket

compliance/controls/aws/aws_cis_v150_3_9.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Query:
1414
owner_id,
1515
vpc_id,
1616
tags,
17-
_ctx
17+
_ctx,
18+
kaytu_account_id,
19+
kaytu_resource_id
1820
from
1921
aws_vpc
2022
order by

0 commit comments

Comments
 (0)