Datasets:
AutoOntologyBench / source_data /pinned /gatekeeper-library /commit-a8d4799d8daf /src /general /disallowinteractive /src.rego
Download source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/disallowinteractive/src.rego from Vinyeh/AutoOntologyBench: direct link, hf CLI and curl.
- Browser
- Download file 828 Bytes
-
https://huggingface.co/datasets/Vinyeh/AutoOntologyBench/resolve/main/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/disallowinteractive/src.rego
- Command line
-
hf download hf://datasets/Vinyeh/AutoOntologyBench/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/disallowinteractive/src.rego
-
curl -L -o src.rego https://huggingface.co/datasets/Vinyeh/AutoOntologyBench/resolve/main/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/disallowinteractive/src.rego
828 Bytes
| package k8sdisallowinteractivetty | |
| import data.lib.exempt_container.is_exempt | |
| violation[{"msg": msg, "details": {}}] { | |
| c := input_containers[_] | |
| not is_exempt(c) | |
| input_allow_interactive_fields(c) | |
| msg := sprintf("Containers using tty or stdin (%v) are not allowed running image: %v", [c.name, c.image]) | |
| } | |
| input_allow_interactive_fields(c) { | |
| has_field(c, "stdin") | |
| not c.stdin == false | |
| } | |
| input_allow_interactive_fields(c) { | |
| has_field(c, "tty") | |
| not c.tty == false | |
| } | |
| input_containers[c] { | |
| c := input.review.object.spec.containers[_] | |
| } | |
| input_containers[c] { | |
| c := input.review.object.spec.ephemeralContainers[_] | |
| } | |
| input_containers[c] { | |
| c := input.review.object.spec.initContainers[_] | |
| } | |
| # has_field returns whether an object has a field | |
| has_field(object, field) = true { | |
| object[field] | |
| } | |