Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing paths #528

Merged
merged 5 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rules/exec-into-container/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can exec into containers", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -95,6 +96,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can exec into containers", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down
3 changes: 3 additions & 0 deletions rules/image-pull-policy-is-not-set-to-always/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ deny[msga] {
"alertMessage": sprintf("container: %v in pod: %v has 'latest' tag on image but imagePullPolicy is not set to 'Always'", [container.name, pod.metadata.name]),
"packagename": "armo_builtins",
"alertScore": 2,
"reviewPaths": paths,
"failedPaths": paths,
"fixPaths":[],
"alertObject": {
Expand All @@ -30,6 +31,7 @@ deny[msga] {
"alertMessage": sprintf("container: %v in %v: %v has 'latest' tag on image but imagePullPolicy is not set to 'Always'", [container.name, wl.kind, wl.metadata.name]),
"packagename": "armo_builtins",
"alertScore": 2,
"reviewPaths": paths,
"failedPaths": paths,
"fixPaths":[],
"alertObject": {
Expand All @@ -48,6 +50,7 @@ deny[msga] {
"alertMessage": sprintf("container: %v in cronjob: %v has 'latest' tag on image but imagePullPolicy is not set to 'Always'", [container.name, wl.metadata.name]),
"packagename": "armo_builtins",
"alertScore": 2,
"reviewPaths": paths,
"failedPaths": paths,
"fixPaths":[],
"alertObject": {
Expand Down
4 changes: 2 additions & 2 deletions rules/immutable-container-filesystem/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ deny[msga] {
# Default of readOnlyRootFilesystem is false. This field is only in container spec and not pod spec
is_mutable_filesystem(container, start_of_path, i) = [failed_path, fixPath] {
container.securityContext.readOnlyRootFilesystem == false
failed_path = sprintf("%vcontainers[%v].securityContext.readOnlyRootFilesystem", [start_of_path, format_int(i, 10)])
fixPath = ""
fixPath = {"path": sprintf("%vcontainers[%v].securityContext.readOnlyRootFilesystem", [start_of_path, format_int(i, 10)]), "value": "true"}
failed_path = ""
}

is_mutable_filesystem(container, start_of_path, i) = [failed_path, fixPath] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[{
"alertMessage": "container :mysql in Deployment: my-deployment has mutable filesystem",
"failedPaths": ["spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem"],
"fixPaths": [],
"failedPaths": [],
"fixPaths": [{
"path": "spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem",
"value": "true"
}],
"ruleStatus": "",
"packagename": "armo_builtins",
"alertScore": 7,
Expand Down
2 changes: 2 additions & 0 deletions rules/rule-can-impersonate-users-groups/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can impersonate users", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -85,6 +86,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can impersonate users", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down
2 changes: 2 additions & 0 deletions rules/rule-can-list-get-secrets/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ deny[msga] {
"alertMessage": sprintf("The following %v: %v can read secrets", [subject.kind, subject.name]),
"alertScore": 9,
"packagename": "armo_builtins",
"deletePaths": [path],
"failedPaths": [path],
"alertObject": {
"k8sApiObjects": [role,rolebinding],
Expand Down Expand Up @@ -91,6 +92,7 @@ deny[msga] {
"alertMessage": sprintf("The following %v: %v can read secrets", [subject.kind, subject.name]),
"alertScore": 9,
"packagename": "armo_builtins",
"deletePaths": [path],
"failedPaths": [path],
"alertObject": {
"k8sApiObjects": [role,clusterrolebinding],
Expand Down
2 changes: 2 additions & 0 deletions rules/rule-can-portforward/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can do port forwarding", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -85,6 +86,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("the following %v: %v, can do port forwarding", [subject.kind, subject.name]),
"alertScore": 9,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down
2 changes: 2 additions & 0 deletions rules/rule-can-ssh-to-pod/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ deny[msga] {
"alertMessage": sprintf("%v: %v is exposed by SSH services: %v", [wl.kind, wl.metadata.name, service]),
"packagename": "armo_builtins",
"alertScore": 7,
"deletePaths": [path],
"failedPaths": [path],
"alertObject": {
"k8sApiObjects": [wl,service]
Expand All @@ -72,6 +73,7 @@ deny[msga] {
"alertMessage": sprintf("%v: %v is exposed by SSH services: %v", [wl.kind, wl.metadata.name, service]),
"packagename": "armo_builtins",
"alertScore": 7,
"deletePaths": [path],
"failedPaths": [path],
"alertObject": {
"k8sApiObjects": [wl,service]
Expand Down
2 changes: 2 additions & 0 deletions rules/rule-can-update-configmap/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("The following %v: %v can modify 'coredns' configmap", [subject.kind, subject.name]),
"alertScore": 6,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -112,6 +113,7 @@ deny[msga] {
msga := {
"alertMessage": sprintf("The following %v: %v can modify 'coredns' configmap", [subject.kind, subject.name]),
"alertScore": 6,
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down
5 changes: 5 additions & 0 deletions rules/rule-credentials-in-env-var/raw.rego
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"alertMessage": sprintf("%v: %v has sensitive information in environment variables", [wl.kind, wl.metadata.name]),
"alertScore": 9,
"fixPaths": [],
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -86,6 +87,7 @@
"alertMessage": sprintf("Cronjob: %v has sensitive information in environment variables", [wl.metadata.name]),
"alertScore": 9,
"fixPaths": [],
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -116,6 +118,7 @@ deny[msga] {
"alertMessage": sprintf("Pod: %v has sensitive information in environment variables", [pod.metadata.name]),
"alertScore": 9,
"fixPaths": [],
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -147,6 +150,7 @@ deny[msga] {
"alertMessage": sprintf("%v: %v has sensitive information in environment variables", [wl.kind, wl.metadata.name]),
"alertScore": 9,
"fixPaths": [],
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down Expand Up @@ -176,6 +180,7 @@ deny[msga] {
"alertMessage": sprintf("Cronjob: %v has sensitive information in environment variables", [wl.metadata.name]),
"alertScore": 9,
"fixPaths": [],
"deletePaths": [path],
"failedPaths": [path],
"packagename": "armo_builtins",
"alertObject": {
Expand Down
Loading