Skip to content

Commit f51089e

Browse files
committed
feat: update queries
1 parent 2aa0f25 commit f51089e

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

compliance/controls/aws/aws_cis_v300_1_17.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Query:
1313
'arn:' || a.partition || ':::' || a.account_id as resource,
1414
count(policy_arn),
1515
a.account_id,
16+
a.kaytu_account_id as kaytu_account_id,
17+
a.kaytu_resource_id as kaytu_resource_id,
1618
a._ctx
1719
from
1820
aws_account as a
@@ -24,12 +26,14 @@ Query:
2426
group by
2527
a.account_id,
2628
a.partition,
29+
a.kaytu_account_id,
30+
a.kaytu_resource_id,
2731
a._ctx
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_v300_1_2.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Query:
2121
partition,
2222
title,
2323
account_id,
24+
kaytu_account_id as kaytu_account_id,
25+
kaytu_resource_id as kaytu_resource_id,
2426
_ctx
2527
from
2628
aws_account

compliance/controls/aws/aws_cis_v300_3_8.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Query:
1111
select
1212
name as trail_name,
1313
is_multi_region_trail,
14-
bucket_selector
14+
bucket_selector,
15+
kaytu_account_id,
16+
kaytu_resource_id
1517
from
1618
aws_cloudtrail_trail,
1719
jsonb_array_elements(event_selectors) as event_selector,
@@ -47,7 +49,7 @@ Query:
4749
on bucket_selector like (b.arn || '%')
4850
or bucket_selector = 'arn:aws:s3'
4951
group by
50-
b.account_id, b.region, b.arn, b.name, b.tags, b._ctx;
52+
b.account_id, b.kaytu_account_id, b.kaytu_resource_id, b.region, b.arn, b.name, b.tags, b._ctx;
5153
PrimaryTable: aws_s3_bucket
5254
ListOfTables:
5355
- aws_cloudtrail_trail

compliance/controls/aws/aws_cis_v300_3_9.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Query:
1111
select
1212
name as trail_name,
1313
is_multi_region_trail,
14-
bucket_selector
14+
bucket_selector,
15+
kaytu_account_id,
16+
kaytu_resource_id
1517
from
1618
aws_cloudtrail_trail,
1719
jsonb_array_elements(event_selectors) as event_selector,
@@ -28,8 +30,8 @@ Query:
2830
)
2931
select
3032
b.arn as resource,
31-
t.kaytu_account_id as kaytu_account_id,
32-
t.kaytu_resource_id as kaytu_resource_id,
33+
b.kaytu_account_id as kaytu_account_id,
34+
b.kaytu_resource_id as kaytu_resource_id,
3335
case
3436
when count(bucket_selector) > 0 then 'ok'
3537
else 'alarm'
@@ -45,7 +47,7 @@ Query:
4547
on bucket_selector like (b.arn || '%')
4648
or bucket_selector = 'arn:aws:s3'
4749
group by
48-
b.account_id, b.region, b.arn, b.name, b.tags, b._ctx;
50+
b.account_id, b.kaytu_account_id, b.kaytu_resource_id, b.region, b.arn, b.name, b.tags, b._ctx;
4951
PrimaryTable: aws_s3_bucket
5052
ListOfTables:
5153
- aws_cloudtrail_trail

compliance/controls/aws/aws_cis_v300_5_2.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Query:
4141
region,
4242
account_id,
4343
group_id,
44+
kaytu_account_id as kaytu_account_id,
45+
kaytu_resource_id as kaytu_resource_id,
4446
_ctx
4547
from
4648
aws_vpc_security_group

compliance/controls/aws/aws_dms_replication_task_source_database_logging_enabled.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ Query:
99
with replication_task_logging as (
1010
select
1111
arn,
12+
kaytu_account_id,
13+
kaytu_resource_id,
1214
bool_or(o ->> 'Id' = 'SOURCE_CAPTURE' and o ->> 'Severity' in ('LOGGER_SEVERITY_DEFAULT', 'LOGGER_SEVERITY_DEBUG', 'LOGGER_SEVERITY_DETAILED_DEBUG')) as capture_logging_enabled,
1315
bool_or(o ->> 'Id' = 'SOURCE_UNLOAD' and o ->> 'Severity' in ('LOGGER_SEVERITY_DEFAULT', 'LOGGER_SEVERITY_DEBUG', 'LOGGER_SEVERITY_DETAILED_DEBUG')) as unload_logging_enabled
1416
from
1517
aws_dms_replication_task,
1618
jsonb_array_elements(replication_task_settings -> 'Logging' -> 'LogComponents') as o
1719
group by
18-
arn
20+
arn,
21+
kaytu_account_id,
22+
kaytu_resource_id
1923
)
2024
select
2125
t.arn as resource,

0 commit comments

Comments
 (0)