Skip to content

Instantly share code, notes, and snippets.

@RickCraig
Last active May 9, 2023 16:46
Show Gist options
  • Save RickCraig/59fb14f2d60ddb80fdc1bd0b30137103 to your computer and use it in GitHub Desktop.
Save RickCraig/59fb14f2d60ddb80fdc1bd0b30137103 to your computer and use it in GitHub Desktop.
Options for blocking connectors that aren't artifactory
package connector
# Block saves on any connector but Artifactory
deny[msg] {
# Check that the type is artifactory
input.entity.type != "Artifactory"
# Show a human-friendly error message
msg := sprintf("Artifactory is the only connector allowed, you have tried to create %s", [input.entity.type])
}
package connector
# Deny any connectors that fall into the list of not_allowed
deny[msg] {
# If the connector type matches anything in our list... deny
contains(not_allowed, input.entity.type)
# Show a human-friendly error message
msg := sprintf("%s is not allowed, please use Artifactory only", [input.entity.type])
}
# All of the blocked connector types
not_allowed = ["Jenkins", "DockerRegistry", "HttpHelmRepo", "Nexus", "OciHelmRepo"]
contains(arr, elem) {
arr[_] = elem
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment