Skip to content

Instantly share code, notes, and snippets.

@lucperkins
Created June 6, 2019 18:10
Show Gist options
  • Save lucperkins/21b610a5f5a973ea63b4a3b6d5002a34 to your computer and use it in GitHub Desktop.
Save lucperkins/21b610a5f5a973ea63b4a3b6d5002a34 to your computer and use it in GitHub Desktop.
Open Policy Agent CI example
package ci
# The package.json is presumed faulty
default allow = false
# Packages that aren't allowed
blacklist = {
"event-stream",
"left-pad"
}
# Records dependencies that are on the blacklist
violations[pkg] {
input.dependencies[pkg]
blacklist[pkg]
}
# Returns true only if there are no violations
allow {
count(violations) == 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment