-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pavniii/pavni_docker_policies
new docker policies added for expose and workdir
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
pkg/policies/opa/rego/docker/docker_expose/AC_DOCKER_0011.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,17 @@ | ||
{ | ||
"name": "UNIXPortsOutOfRange", | ||
"file": "UNIXPortsOutOfRange.rego", | ||
"policy_type": "docker", | ||
"resource_type": "expose", | ||
"template_args": { | ||
"prefix": "", | ||
"suffix": "", | ||
"name": "UNIXPortsOutOfRange" | ||
}, | ||
"severity": "HIGH", | ||
"description": "Ensure range of ports is from 0 to 65535", | ||
"reference_id": "AC_DOCKER_0011", | ||
"category": "Infrastructure Security", | ||
"id": "AC_DOCKER_0011", | ||
"version": 1 | ||
} |
13 changes: 13 additions & 0 deletions
13
pkg/policies/opa/rego/docker/docker_expose/UNIXPortsOutOfRange.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,13 @@ | ||
package accurics | ||
|
||
{{.prefix}}{{.name}}{{.suffix}}[apt.id]{ | ||
apt := input.expose[_] | ||
conval := apt.config | ||
port := split(conval, "/") | ||
containsPortOutOfRange(port) | ||
} | ||
containsPortOutOfRange(ports) { | ||
some i | ||
port := ports[i] | ||
to_number(port) > 65535 | ||
} |
17 changes: 17 additions & 0 deletions
17
pkg/policies/opa/rego/docker/docker_workdir/AC_DOCKER_0013.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,17 @@ | ||
{ | ||
"name": "workdir", | ||
"file": "workdir.rego", | ||
"policy_type": "docker", | ||
"resource_type": "workdir", | ||
"template_args": { | ||
"prefix": "", | ||
"suffix": "", | ||
"name": "workdir" | ||
}, | ||
"severity": "HIGH", | ||
"description": "Ensure the use absolute paths for your WORKDIR.", | ||
"reference_id": "AC_DOCKER_0014", | ||
"category": "Infrastructure Security", | ||
"id": "AC_DOCKER_0014", | ||
"version": 1 | ||
} |
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,9 @@ | ||
package accurics | ||
|
||
{{.prefix}}{{.name}}{{.suffix}}[apt]{ | ||
apt := input.workdir[_] | ||
conval := apt.config | ||
|
||
not regex.match("(^/[A-z0-9-_+]*)|(^[A-z0-9-_+]:\\\\.*)|(^\\$[{}A-z0-9-_+].*)", conval) | ||
|
||
} |