Skip to content

Commit

Permalink
use included_envs from data
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Pivkin <[email protected]>
  • Loading branch information
nikpivkin committed Oct 9, 2024
1 parent 9fc294b commit 6d50121
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion checks/docker/leaked_secrets.rego
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package builtin.dockerfile.DS031

import rego.v1

import data.ds031
import data.lib.docker
import data.lib.path

Expand Down Expand Up @@ -99,7 +100,10 @@ default_envs := {

excluded_envs := set()

included_envs := set()
included_envs := included if {
is_array(ds031.included_envs)
included := {e | some e in ds031.included_envs}
} else := set()

envs := (default_envs - excluded_envs) | included_envs

Expand Down
2 changes: 1 addition & 1 deletion checks/docker/leaked_secrets_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_allow_secret_github_env_but_this_env_excluded if {

test_deny_custom_secret_env if {
inp := build_simple_input("env", ["MY_SECRET"])
res := check.deny with input as inp with check.included_envs as {"MY_SECRET"}
res := check.deny with input as inp with data.ds031.included_envs as {"MY_SECRET"}
count(res) = 1
}

Expand Down

0 comments on commit 6d50121

Please sign in to comment.