-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.pp
61 lines (56 loc) · 2.46 KB
/
locals.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Benchmarks and controls for specific services should override the "service" tag
locals {
github_audit_log_detections_common_tags = {
category = "Detections"
plugin = "github"
service = "GitHub/Organization"
}
}
locals {
# Local internal variables to build the SQL select clause for common
# dimensions. Do not edit directly.
# TODO: Add another local to split repo vs. org column set
detection_sql_columns = <<-EOQ
tp_timestamp as timestamp,
action as operation,
__RESOURCE_SQL__ as resource,
actor,
tp_source_ip as source_ip,
tp_index as organization,
split_part(repo, '/', 2) as repository,
tp_id as source_id,
*
exclude (actor, timestamp)
EOQ
detection_display_columns_organization = [
"timestamp",
"operation",
"resource",
"actor",
"source_ip",
"organization",
"source_id"
]
detection_display_columns_repository = [
"timestamp",
"operation",
"resource",
"actor",
"source_ip",
"organization",
"repository",
"source_id"
]
}
locals {
# Local internal variables to build the SQL select clause for common
# dimensions. Do not edit directly.
detection_sql_resource_column_integration = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "additional_fields ->> 'integration'")
detection_sql_resource_column_organization = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', org)")
detection_sql_resource_column_personal_access_token_name = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "additional_fields ->> 'user_programmatic_access_name'")
detection_sql_resource_column_repository = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', repo)")
detection_sql_resource_column_repository_branch_name = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', repo, '/tree/', additional_fields ->> 'name')")
detection_sql_resource_column_repository_commit_id = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', repo, '/commit/', additional_fields ->> 'after')")
detection_sql_resource_column_repository_vulnerability_alert_number = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', repo, '/security/dependabot/', additional_fields ->> 'alert_number')")
detection_sql_resource_column_user = replace(local.detection_sql_columns, "__RESOURCE_SQL__", "concat('https://github.com/', user)")
}