-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add policy AC-K8-NS-SE-M-0188 for CVE-2020-8554
- Loading branch information
Gaurav Gogia
committed
Dec 10, 2020
1 parent
929e377
commit 185f8c6
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
pkg/policies/opa/rego/k8s/kubernetes_service/cve_2020_8554/AC-K8-NS-SE-M-0188.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "ensurePrivateIP", | ||
"file": "ensurePrivateIP.rego", | ||
"template_args": { | ||
"name": "ensurePrivateIP", | ||
"prefix": "", | ||
"resource_type": "kubernetes_service", | ||
"suffix": "" | ||
}, | ||
"severity": "MEDIUM", | ||
"description": "Vulnerable to CVE-2020-8554", | ||
"reference_id": "AC-K8-NS-SE-M-0188", | ||
"category": "Network Security", | ||
"version": 1 | ||
} |
16 changes: 16 additions & 0 deletions
16
pkg/policies/opa/rego/k8s/kubernetes_service/cve_2020_8554/ensurePrivateIP.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package accurics | ||
|
||
{{.prefix}}{{.name}}{{.suffix}}[service.id] { | ||
service := input.{{.resource_type}}[_] | ||
service.config.kind == "Service" | ||
type_check(service.config.spec) | ||
object.get(service.config.spec, "externalIPs", "undefined") != "undefined" | ||
} | ||
|
||
type_check(spec) { | ||
spec.type == "ClusterIP" | ||
} | ||
|
||
type_check(spec) { | ||
object.get(spec, "type", "undefined") == "undefined" | ||
} |