Skip to content

Instantly share code, notes, and snippets.

@Sedward
Created May 17, 2022 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sedward/3e5c9324e75bb853267ef715d13ee278 to your computer and use it in GitHub Desktop.
Save Sedward/3e5c9324e75bb853267ef715d13ee278 to your computer and use it in GitHub Desktop.
[
{
"constraint": "GCPEnforceLabelConstraintV1.require_labels",
"constraint_config": {
"api_version": "constraints.gatekeeper.sh/v1alpha1",
"kind": "GCPEnforceLabelConstraintV1",
"metadata": {
"annotations": {
"description": "Checks that labels are set for all resources (or a subset of resources) and that they match a certain regular expression pattern.",
"validation.gcp.forsetisecurity.org/originalName": "require_labels",
"validation.gcp.forsetisecurity.org/yamlpath": "policies/constraints/enforce_label.yaml"
},
"name": "require-labels"
},
"spec": {
"match": {
"target": [
"organizations/**"
]
},
"parameters": {
"mandatory_labels": [
{
"billing-code": "^sch-[a-z]*"
}
],
"resource_types_to_scan": [
"cloudresourcemanager.googleapis.com/Project",
"storage.googleapis.com/Bucket"
]
},
"severity": "high"
}
},
"message": "//storage.googleapis.com/example-bucket-poc's label 'billing-code' is in violation.",
"metadata": {
"ancestry_path": "organizations/401745472997/folders/552324617166/folders/747046138637/projects/vitoria-347113",
"constraint": {
"annotations": {
"description": "Checks that labels are set for all resources (or a subset of resources) and that they match a certain regular expression pattern.",
"validation.gcp.forsetisecurity.org/originalName": "require_labels",
"validation.gcp.forsetisecurity.org/yamlpath": "policies/constraints/enforce_label.yaml"
},
"labels": {},
"parameters": {
"mandatory_labels": [
{
"billing-code": "^sch-[a-z]*"
}
],
"resource_types_to_scan": [
"cloudresourcemanager.googleapis.com/Project",
"storage.googleapis.com/Bucket"
]
}
},
"details": {
"label_in_violation": "billing-code",
"resource": "//storage.googleapis.com/example-bucket-poc"
}
},
"resource": "//storage.googleapis.com/example-bucket-poc",
"severity": "high"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment