Skip to content

Commit

Permalink
[CSPM] remove agent-side helpers and upgrade policies version (#9993) (
Browse files Browse the repository at this point in the history
…#10101)

(cherry picked from commit 6ceac2e)
  • Loading branch information
paulcacheux authored Dec 6, 2021
1 parent 8da8dec commit 6f16bfb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 87 deletions.
20 changes: 18 additions & 2 deletions pkg/compliance/checks/rego_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,20 @@ func TestRegoCheck(t *testing.T) {
import data.datadog as dd
process_data(p) = d {
d := {
"process.name": p.name,
"process.exe": p.exe,
"process.cmdLine": p.cmdLine,
}
}
default valid = false
findings[f] {
p := input.processes[_]
p.flags["--path"] == "foo"
f := dd.passed_finding("process", "42", dd.process_data(p))
f := dd.passed_finding("process", "42", process_data(p))
}
`,
findings: "data.test.findings",
Expand Down Expand Up @@ -145,12 +153,20 @@ func TestRegoCheck(t *testing.T) {
import data.datadog as dd
process_data(p) = d {
d := {
"process.name": p.name,
"process.exe": p.exe,
"process.cmdLine": p.cmdLine,
}
}
default valid = false
findings[f] {
p := input.processes[_]
p.flags["--path"] == "foo"
f := dd.failing_finding("process", "42", dd.process_data(p))
f := dd.failing_finding("process", "42", process_data(p))
}
`,
findings: "data.test.findings",
Expand Down
83 changes: 0 additions & 83 deletions pkg/compliance/checks/rego_helpers/datadog.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,6 @@ raw_finding(status, resource_type, resource_id, event_data) = f {
}
}

kubernetes_cluster_resource_id = id {
id := sprintf("%s_kubernetes_cluster", [input.context.kubernetes_cluster])
}

docker_container_resource_id(c) = id {
id := sprintf("%s_%s", [input.context.hostname, cast_string(c.id)])
}

docker_image_resource_id(img) = id {
hash := split(cast_string(img.id), ":")[1]
id := sprintf("%s_%s", [input.context.hostname, hash])
}

docker_daemon_resource_id = id {
id := sprintf("%s_daemon", [input.context.hostname])
}

kubernetes_master_node_resource_id = id {
id := sprintf("%s_kubernetes_master_node", [input.context.hostname])
}

kubernetes_worker_node_resource_id = id {
id := sprintf("%s_kubernetes_worker_node", [input.context.hostname])
}

docker_network_resource_id(n) = id {
id := sprintf("%s_%s", [input.context.hostname, cast_string(n.id)])
}

passed_finding(resource_type, resource_id, event_data) = f {
f := raw_finding("passed", resource_type, resource_id, event_data)
}
Expand All @@ -51,57 +22,3 @@ error_finding(resource_type, resource_id, error_msg) = f {
"error": error_msg
})
}

docker_container_data(c) = d {
d := {
"container.id": c.id,
"container.image": c.image,
"container.name": c.name,
}
}

docker_image_data(img) = d {
d := {
"image.id": img.id,
"image.tags": img.tags,
}
}

docker_network_data(network) = d {
d := {
"network.name": network.name,
}
}

process_data(p) = d {
d := {
"process.name": p.name,
"process.exe": p.exe,
"process.cmdLine": p.cmdLine,
}
}

file_data(file) = d {
d := {
"file.group": file.group,
"file.path": file.path,
"file.permissions": file.permissions,
"file.user": file.user,
}
}

group_data(group) = d {
d := {
"group.id": group.id,
"group.name": group.name,
"group.users": group.users,
}
}

audit_data(audit) = d {
d := {
"audit.enabled": audit.enabled,
"audit.path": audit.path,
"audit.permissions": audit.permissions,
}
}
4 changes: 2 additions & 2 deletions release.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"OMNIBUS_RUBY_VERSION": "7.33.0-rc.3",
"JMXFETCH_VERSION": "0.44.3",
"JMXFETCH_HASH": "50b22c3721419eeb7bb52bb6083641ff93c4fe12ae7a95fefd70892394976981",
"SECURITY_AGENT_POLICIES_VERSION": "v0.18.2",
"SECURITY_AGENT_POLICIES_VERSION": "v0.18.5",
"MACOS_BUILD_VERSION": "6.33.0-rc.1",
"WINDOWS_DDNPM_DRIVER": "release-signed",
"WINDOWS_DDNPM_VERSION": "1.2.1",
Expand All @@ -46,7 +46,7 @@
"OMNIBUS_RUBY_VERSION": "7.33.0-rc.3",
"JMXFETCH_VERSION": "0.44.3",
"JMXFETCH_HASH": "50b22c3721419eeb7bb52bb6083641ff93c4fe12ae7a95fefd70892394976981",
"SECURITY_AGENT_POLICIES_VERSION": "v0.18.2",
"SECURITY_AGENT_POLICIES_VERSION": "v0.18.5",
"MACOS_BUILD_VERSION": "7.33.0-rc.1",
"WINDOWS_DDNPM_DRIVER": "release-signed",
"WINDOWS_DDNPM_VERSION": "1.2.1",
Expand Down

0 comments on commit 6f16bfb

Please sign in to comment.