Skip to content

Commit

Permalink
fix: do not use deny in rule name
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Pivkin <[email protected]>
  • Loading branch information
nikpivkin authored and simar7 committed Oct 30, 2024
1 parent b9b4090 commit 1ec0a73
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions checks/docker/leaked_secrets.rego
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ use_command_to_setup_credentials(instruction) if {
}

is_secret_key(s) if {
regex.match(deny_secrets_pattern, s)
not regex.match(allow_secrets_pattern, s)
regex.match(forbidden_secrets_pattern, s)
not regex.match(allowed_secrets_pattern, s)
}

# adopt https://github.com/moby/buildkit/blob/62bda5c1caae9935a2051e96443d554f7ab7ef2d/frontend/dockerfile/dockerfile2llb/convert.go#L2469
Expand All @@ -218,15 +218,15 @@ build_secrets_pattern(tokens) := sprintf(secrets_regex_pattern, [concat("|", tok

# these tokens cover the following keywords
# https://github.com/danielmiessler/SecLists/blob/master/Discovery/Variables/secret-keywords.txt
deny_secrets_tokens := {
forbidden_secret_tokens := {
"apikey", "auth", "credential",
"credentials", "key", "password",
"pword", "passwd", "secret", "token",
"usr", "psw",
}

deny_secrets_pattern := build_secrets_pattern(deny_secrets_tokens)
forbidden_secrets_pattern := build_secrets_pattern(forbidden_secret_tokens)

allow_secrets_tokens := {"public"}
allowed_secret_tokens := {"public"}

allow_secrets_pattern := build_secrets_pattern(allow_secrets_tokens)
allowed_secrets_pattern := build_secrets_pattern(allowed_secret_tokens)

0 comments on commit 1ec0a73

Please sign in to comment.