Datasets:
AutoOntologyBench / source_data /pinned /gatekeeper-library /commit-a8d4799d8daf /src /general /httpsonly /src.rego
Download source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/httpsonly/src.rego from Vinyeh/AutoOntologyBench: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/datasets/Vinyeh/AutoOntologyBench/resolve/refs%2Fpr%2F2/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/httpsonly/src.rego
- Command line
-
hf download hf://datasets/Vinyeh/AutoOntologyBench@refs/pr/2/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/httpsonly/src.rego
-
curl -L -o src.rego https://huggingface.co/datasets/Vinyeh/AutoOntologyBench/resolve/refs%2Fpr%2F2/source_data/pinned/gatekeeper-library/commit-a8d4799d8daf/src/general/httpsonly/src.rego
1.17 kB
| package k8shttpsonly | |
| violation[{"msg": msg}] { | |
| input.review.object.kind == "Ingress" | |
| regex.match("^(extensions|networking.k8s.io)/", input.review.object.apiVersion) | |
| ingress := input.review.object | |
| not https_complete(ingress) | |
| not tls_is_optional | |
| msg := sprintf("Ingress should be https. tls configuration and allow-http=false annotation are required for %v", [ingress.metadata.name]) | |
| } | |
| violation[{"msg": msg}] { | |
| input.review.object.kind == "Ingress" | |
| regex.match("^(extensions|networking.k8s.io)/", input.review.object.apiVersion) | |
| ingress := input.review.object | |
| not annotation_complete(ingress) | |
| tls_is_optional | |
| msg := sprintf("Ingress should be https. The allow-http=false annotation is required for %v", [ingress.metadata.name]) | |
| } | |
| https_complete(ingress) = true { | |
| ingress.spec["tls"] | |
| count(ingress.spec.tls) > 0 | |
| ingress.metadata.annotations["kubernetes.io/ingress.allow-http"] == "false" | |
| } | |
| annotation_complete(ingress) = true { | |
| ingress.metadata.annotations["kubernetes.io/ingress.allow-http"] == "false" | |
| } | |
| tls_is_optional { | |
| parameters := object.get(input, "parameters", {}) | |
| object.get(parameters, "tlsOptional", false) == true | |
| } | |