{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-binary-authorization/json-schema/google-cloud-binary-authorization-platform-policy-schema.json",
  "title": "PlatformPolicy",
  "description": "A Binary Authorization platform policy for deployments on various platforms.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-binary-authorization-projects-api-openapi.yml#/components/schemas/PlatformPolicy",
  "properties": {
    "gkePolicy": {
      "$ref": "#/$defs/GkePolicy",
      "description": "Optional. GKE platform-specific policy."
    },
    "etag": {
      "type": "string",
      "description": "Optional. Used to prevent updating the policy when another request has updated it since it was retrieved."
    },
    "updateTime": {
      "format": "google-datetime",
      "readOnly": true,
      "type": "string",
      "description": "Output only. Time when the policy was last updated."
    },
    "description": {
      "description": "Optional. A description comment about the policy.",
      "type": "string"
    },
    "name": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The relative resource name of the Binary Authorization platform policy, in the form of `projects/*/platforms/*/policies/*`."
    }
  },
  "type": "object",
  "$defs": {
    "AttestationAuthenticator": {
      "type": "object",
      "properties": {
        "displayName": {
          "type": "string",
          "description": "Optional. A user-provided name for this `AttestationAuthenticator`. This field has no effect on the policy evaluation behavior except to improve readability of messages in evaluation results."
        },
        "pkixPublicKeySet": {
          "$ref": "#/$defs/PkixPublicKeySet",
          "description": "Optional. A set of raw PKIX SubjectPublicKeyInfo format public keys. If any public key in the set validates the attestation signature, then the signature is considered authenticated (i.e. any one key is sufficient to authenticate)."
        }
      },
      "description": "An attestation authenticator that will be used to verify attestations. Typically this is just a set of public keys. Conceptually, an authenticator can be treated as always returning either \"authenticated\" or \"not authenticated\" when presented with a signed attestation (almost always assumed to be a [DSSE](https://github.com/secure-systems-lab/dsse) attestation). The details of how an authenticator makes this decision are specific to the type of 'authenticator' that this message wraps."
    },
    "AttestationSource": {
      "type": "object",
      "properties": {
        "containerAnalysisAttestationProjects": {
          "type": "array",
          "description": "The IDs of the Google Cloud projects that store the SLSA attestations as Container Analysis Occurrences, in the format `projects/[PROJECT_ID]`. Maximum number of `container_analysis_attestation_projects` allowed in each `AttestationSource` is 10.",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "Specifies the locations for fetching the provenance attestations."
    },
    "Check": {
      "description": "A single check to perform against a Pod. Checks are grouped into `CheckSet` objects, which are defined by the top-level policy.",
      "type": "object",
      "properties": {
        "trustedDirectoryCheck": {
          "$ref": "#/$defs/TrustedDirectoryCheck",
          "description": "Optional. Require that an image lives in a trusted directory."
        },
        "slsaCheck": {
          "$ref": "#/$defs/SlsaCheck",
          "description": "Optional. Require that an image was built by a trusted builder (such as Google Cloud Build), meets requirements for Supply chain Levels for Software Artifacts (SLSA), and was built from a trusted source code repostitory."
        },
        "displayName": {
          "description": "Optional. A user-provided name for this check. This field has no effect on the policy evaluation behavior except to improve readability of messages in evaluation results.",
          "type": "string"
        },
        "imageAllowlist": {
          "$ref": "#/$defs/ImageAllowlist",
          "description": "Optional. Images exempted from this check. If any of the patterns match the image url, the check will not be evaluated."
        },
        "alwaysDeny": {
          "type": "boolean",
          "description": "Optional. A special-case check that always denies. Note that this still only applies when the scope of the `CheckSet` applies and the image isn't exempted by an image allowlist. This check is primarily useful for testing, or to set the default behavior for all unmatched scopes to \"deny\"."
        },
        "vulnerabilityCheck": {
          "$ref": "#/$defs/VulnerabilityCheck",
          "description": "Optional. Require that an image does not contain vulnerabilities that violate the configured rules, such as based on severity levels."
        },
        "sigstoreSignatureCheck": {
          "$ref": "#/$defs/SigstoreSignatureCheck",
          "description": "Optional. Require that an image was signed by Cosign with a trusted key. This check requires that both the image and signature are stored in Artifact Registry."
        },
        "imageFreshnessCheck": {
          "$ref": "#/$defs/ImageFreshnessCheck",
          "description": "Optional. Require that an image is no older than a configured expiration time. Image age is determined by its upload time."
        },
        "simpleSigningAttestationCheck": {
          "$ref": "#/$defs/SimpleSigningAttestationCheck",
          "description": "Optional. Require a SimpleSigning-type attestation for every image in the deployment."
        }
      }
    },
    "CheckSet": {
      "type": "object",
      "properties": {
        "imageAllowlist": {
          "$ref": "#/$defs/ImageAllowlist",
          "description": "Optional. Images exempted from this `CheckSet`. If any of the patterns match the image being evaluated, no checks in the `CheckSet` will be evaluated."
        },
        "checks": {
          "type": "array",
          "description": "Optional. The checks to apply. The ultimate result of evaluating the check set will be \"allow\" if and only if every check in `checks` evaluates to \"allow\". If `checks` is empty, the default behavior is \"always allow\".",
          "items": {
            "$ref": "#/$defs/Check"
          }
        },
        "displayName": {
          "description": "Optional. A user-provided name for this `CheckSet`. This field has no effect on the policy evaluation behavior except to improve readability of messages in evaluation results.",
          "type": "string"
        },
        "scope": {
          "$ref": "#/$defs/Scope",
          "description": "Optional. The scope to which this `CheckSet` applies. If unset or an empty string (the default), applies to all namespaces and service accounts. See the `Scope` message documentation for details on scoping rules."
        }
      },
      "description": "A conjunction of policy checks, scoped to a particular namespace or Kubernetes service account. In order for evaluation of a `CheckSet` to return \"allowed\" for a given image in a given Pod, one of the following conditions must be satisfied: * The image is explicitly exempted by an entry in `image_allowlist`, OR * ALL of the `checks` evaluate to \"allowed\"."
    },
    "GkePolicy": {
      "properties": {
        "checkSets": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CheckSet"
          },
          "description": "Optional. The `CheckSet` objects to apply, scoped by namespace or namespace and service account. Exactly one `CheckSet` will be evaluated for a given Pod (unless the list is empty, in which case the behavior is \"always allow\"). If multiple `CheckSet` objects have scopes that match the namespace and service account of the Pod being evaluated, only the `CheckSet` with the MOST SPECIFIC scope will match. `CheckSet` objects must be listed in order of decreasing specificity, i.e. if a scope matches a given service account (which must include the namespace), it must come before a `CheckSet` with a scope matching just that namespace. This property is enforced by server-side validation. The purpose of this restriction is to ensure that if more than one `CheckSet` matches a given Pod, the `CheckSet` that will be evaluated will always be the first in the list to match (because if any other matches, it must be less specific). If `check_sets` is empty, the default behavior is to allow all images. If `check_sets` is non-empty, the last `check_sets` entry must always be a `CheckSet` with no scope set, i.e. a catchall to handle any situation not caught by the preceding `CheckSet` objects."
        },
        "imageAllowlist": {
          "$ref": "#/$defs/ImageAllowlist",
          "description": "Optional. Images exempted from this policy. If any of the patterns match the image being evaluated, the rest of the policy will not be evaluated."
        }
      },
      "description": "A Binary Authorization policy for a GKE cluster. This is one type of policy that can occur as a `PlatformPolicy`.",
      "type": "object"
    },
    "ImageAllowlist": {
      "description": "Images that are exempted from normal checks based on name pattern only.",
      "properties": {
        "allowPattern": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Required. A disjunction of image patterns to allow. If any of these patterns match, then the image is considered exempted by this allowlist."
        }
      },
      "type": "object"
    },
    "ImageFreshnessCheck": {
      "type": "object",
      "description": "An image freshness check, which rejects images that were uploaded before the set number of days ago to the supported repositories.",
      "properties": {
        "maxUploadAgeDays": {
          "description": "Required. The max number of days that is allowed since the image was uploaded. Must be greater than zero.",
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "PkixPublicKey": {
      "description": "A public key in the PkixPublicKey [format](https://tools.ietf.org/html/rfc5280#section-4.1.2.7). Public keys of this type are typically textually encoded using the PEM format.",
      "properties": {
        "keyId": {
          "description": "Optional. The ID of this public key. Signatures verified by Binary Authorization must include the ID of the public key that can be used to verify them. The ID must match exactly contents of the `key_id` field exactly. The ID may be explicitly provided by the caller, but it MUST be a valid RFC3986 URI. If `key_id` is left blank and this `PkixPublicKey` is not used in the context of a wrapper (see next paragraph), a default key ID will be computed based on the digest of the DER encoding of the public key. If this `PkixPublicKey` is used in the context of a wrapper that has its own notion of key ID (e.g. `AttestorPublicKey`), then this field can either match that value exactly, or be left blank, in which case it behaves exactly as though it is equal to that wrapper value.",
          "type": "string"
        },
        "signatureAlgorithm": {
          "type": "string",
          "enum": [
            "SIGNATURE_ALGORITHM_UNSPECIFIED",
            "RSA_PSS_2048_SHA256",
            "RSA_SIGN_PSS_2048_SHA256",
            "RSA_PSS_3072_SHA256",
            "RSA_SIGN_PSS_3072_SHA256",
            "RSA_PSS_4096_SHA256",
            "RSA_SIGN_PSS_4096_SHA256",
            "RSA_PSS_4096_SHA512",
            "RSA_SIGN_PSS_4096_SHA512",
            "RSA_SIGN_PKCS1_2048_SHA256",
            "RSA_SIGN_PKCS1_3072_SHA256",
            "RSA_SIGN_PKCS1_4096_SHA256",
            "RSA_SIGN_PKCS1_4096_SHA512",
            "ECDSA_P256_SHA256",
            "EC_SIGN_P256_SHA256",
            "ECDSA_P384_SHA384",
            "EC_SIGN_P384_SHA384",
            "ECDSA_P521_SHA512",
            "EC_SIGN_P521_SHA512",
            "ML_DSA_65"
          ],
          "description": "The signature algorithm used to verify a message against a signature using this key. These signature algorithm must match the structure and any object identifiers encoded in `public_key_pem` (i.e. this algorithm must match that of the public key)."
        },
        "publicKeyPem": {
          "type": "string",
          "description": "A PEM-encoded public key, as described in https://tools.ietf.org/html/rfc7468#section-13"
        }
      },
      "type": "object"
    },
    "PkixPublicKeySet": {
      "type": "object",
      "description": "A bundle of PKIX public keys, used to authenticate attestation signatures. Generally, a signature is considered to be authenticated by a `PkixPublicKeySet` if any of the public keys verify it (i.e. it is an \"OR\" of the keys).",
      "properties": {
        "pkixPublicKeys": {
          "items": {
            "$ref": "#/$defs/PkixPublicKey"
          },
          "description": "Required. `pkix_public_keys` must have at least one entry.",
          "type": "array"
        }
      }
    },
    "Scope": {
      "properties": {
        "kubernetesNamespace": {
          "description": "Optional. Matches all Kubernetes service accounts in the provided namespace, unless a more specific `kubernetes_service_account` scope already matched.",
          "type": "string"
        },
        "kubernetesServiceAccount": {
          "type": "string",
          "description": "Optional. Matches a single Kubernetes service account, e.g. `my-namespace:my-service-account`. `kubernetes_service_account` scope is always more specific than `kubernetes_namespace` scope for the same namespace."
        }
      },
      "type": "object",
      "description": "A scope specifier for `CheckSet` objects."
    },
    "SigstoreAuthority": {
      "type": "object",
      "description": "A Sigstore authority, used to verify signatures that are created by Sigstore. An authority is analogous to an attestation authenticator, verifying that a signature is valid or invalid.",
      "properties": {
        "displayName": {
          "type": "string",
          "description": "Optional. A user-provided name for this `SigstoreAuthority`. This field has no effect on the policy evaluation behavior except to improve readability of messages in evaluation results."
        },
        "publicKeySet": {
          "$ref": "#/$defs/SigstorePublicKeySet",
          "description": "Required. A simple set of public keys. A signature is considered valid if any keys in the set validate the signature."
        }
      }
    },
    "SigstorePublicKey": {
      "description": "A Sigstore public key. `SigstorePublicKey` is the public key material used to authenticate Sigstore signatures.",
      "type": "object",
      "properties": {
        "publicKeyPem": {
          "description": "The public key material in PEM format.",
          "type": "string"
        }
      }
    },
    "SigstorePublicKeySet": {
      "type": "object",
      "properties": {
        "publicKeys": {
          "description": "Required. `public_keys` must have at least one entry.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SigstorePublicKey"
          }
        }
      },
      "description": "A bundle of Sigstore public keys, used to verify Sigstore signatures. A signature is authenticated by a `SigstorePublicKeySet` if any of the keys verify it."
    },
    "SigstoreSignatureCheck": {
      "description": "A Sigstore signature check, which verifies the Sigstore signature associated with an image.",
      "properties": {
        "sigstoreAuthorities": {
          "description": "Required. The authorities required by this check to verify the signature. A signature only needs to be verified by one authority to pass the check.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SigstoreAuthority"
          }
        }
      },
      "type": "object"
    },
    "SimpleSigningAttestationCheck": {
      "description": "Require a signed [DSSE](https://github.com/secure-systems-lab/dsse) attestation with type SimpleSigning.",
      "type": "object",
      "properties": {
        "attestationAuthenticators": {
          "items": {
            "$ref": "#/$defs/AttestationAuthenticator"
          },
          "type": "array",
          "description": "Required. The authenticators required by this check to verify an attestation. Typically this is one or more PKIX public keys for signature verification. Only one authenticator needs to consider an attestation verified in order for an attestation to be considered fully authenticated. In otherwords, this list of authenticators is an \"OR\" of the authenticator results. At least one authenticator is required."
        },
        "containerAnalysisAttestationProjects": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Optional. The projects where attestations are stored as Container Analysis Occurrences, in the format `projects/[PROJECT_ID]`. Only one attestation needs to successfully verify an image for this check to pass, so a single verified attestation found in any of `container_analysis_attestation_projects` is sufficient for the check to pass. A project ID must be used, not a project number. When fetching Occurrences from Container Analysis, only `AttestationOccurrence` kinds are considered. In the future, additional Occurrence kinds may be added to the query. Maximum number of `container_analysis_attestation_projects` allowed in each `SimpleSigningAttestationCheck` is 10."
        }
      }
    },
    "SlsaCheck": {
      "type": "object",
      "properties": {
        "rules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/VerificationRule"
          },
          "description": "Specifies a list of verification rules for the SLSA attestations. An image is considered compliant with the SlsaCheck if any of the rules are satisfied."
        }
      },
      "description": "A SLSA provenance attestation check, which ensures that images are built by a trusted builder using source code from its trusted repositories only."
    },
    "TrustedDirectoryCheck": {
      "properties": {
        "trustedDirPatterns": {
          "description": "Required. List of trusted directory patterns. A pattern is in the form \"registry/path/to/directory\". The registry domain part is defined as two or more dot-separated words, e.g., `us.pkg.dev`, or `gcr.io`. Additionally, `*` can be used in three ways as wildcards: 1. leading `*` to match varying prefixes in registry subdomain (useful for location prefixes); 2. trailing `*` after registry/ to match varying endings; 3. trailing `**` after registry/ to match \"/\" as well. For example: -- `gcr.io/my-project/my-repo` is valid to match a single directory -- `*-docker.pkg.dev/my-project/my-repo` or `*.gcr.io/my-project` are valid to match varying prefixes -- `gcr.io/my-project/*` will match all direct directories in `my-project` -- `gcr.io/my-project/**` would match all directories in `my-project` -- `gcr.i*` is not allowed since the registry is not completely specified -- `sub*domain.gcr.io/nginx` is not valid because only leading `*` or trailing `*` are allowed. -- `*pkg.dev/my-project/my-repo` is not valid because leading `*` can only match subdomain -- `**-docker.pkg.dev` is not valid because one leading `*` is allowed, and that it cannot match `/`",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "type": "object",
      "description": "A trusted directory check, which rejects images that do not come from the set of user-configured trusted directories."
    },
    "VerificationRule": {
      "description": "Specifies verification rules for evaluating the SLSA attestations including: which builders to trust, where to fetch the SLSA attestations generated by those builders, and other builder-specific evaluation rules such as which source repositories are trusted. An image is considered verified by the rule if any of the fetched SLSA attestations is verified.",
      "properties": {
        "attestationSource": {
          "$ref": "#/$defs/AttestationSource",
          "description": "Specifies where to fetch the provenances attestations generated by the builder (group)."
        },
        "trustedSourceRepoPatterns": {
          "type": "array",
          "description": "List of trusted source code repository URL patterns. These patterns match the full repository URL without its scheme (e.g. `https://`). The patterns must not include schemes. For example, the pattern `source.cloud.google.com/my-project/my-repo-name` matches the following URLs: - `source.cloud.google.com/my-project/my-repo-name` - `git+ssh://source.cloud.google.com/my-project/my-repo-name` - `https://source.cloud.google.com/my-project/my-repo-name` A pattern matches a URL either exactly or with `*` wildcards. `*` can be used in only two ways: 1. trailing `*` after hosturi/ to match varying endings; 2. trailing `**` after hosturi/ to match `/` as well. `*` and `**` can only be used as wildcards and can only occur at the end of the pattern after a `/`. (So it's not possible to match a URL that contains literal `*`.) For example: - `github.com/my-project/my-repo` is valid to match a single repo - `github.com/my-project/*` will match all direct repos in `my-project` - `github.com/**` matches all repos in GitHub",
          "items": {
            "type": "string"
          }
        },
        "trustedBuilder": {
          "type": "string",
          "enum": [
            "BUILDER_UNSPECIFIED",
            "GOOGLE_CLOUD_BUILD"
          ],
          "description": "Each verification rule is used for evaluation against provenances generated by a specific builder (group). For some of the builders, such as the Google Cloud Build, users don't need to explicitly specify their roots of trust in the policy since the evaluation service can automatically fetch them based on the builder (group)."
        },
        "configBasedBuildRequired": {
          "description": "If true, require the image to be built from a top-level configuration. `trusted_source_repo_patterns` specifies the repositories containing this configuration.",
          "type": "boolean"
        },
        "customConstraints": {
          "type": "string",
          "description": "Optional. A CEL expression for specifying custom constraints on the provenance payload. This can be used when users want to specify expectations on provenance fields that are not covered by the general check. For example, users can use this field to require that certain parameters should never be used during the build process."
        }
      },
      "type": "object"
    },
    "VulnerabilityCheck": {
      "type": "object",
      "properties": {
        "allowedCves": {
          "description": "Optional. A list of specific CVEs to ignore even if the vulnerability level violates `maximumUnfixableSeverity` or `maximumFixableSeverity`. CVEs are listed in the format of Container Analysis note id. For example: - CVE-2021-20305 - CVE-2020-10543 The CVEs are applicable regardless of note provider project, e.g., an entry of `CVE-2021-20305` will allow vulnerabilities with a note name of either `projects/goog-vulnz/notes/CVE-2021-20305` or `projects/CUSTOM-PROJECT/notes/CVE-2021-20305`.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "blockedCves": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Optional. A list of specific CVEs to always raise warnings about even if the vulnerability level meets `maximumUnfixableSeverity` or `maximumFixableSeverity`. CVEs are listed in the format of Container Analysis note id. For example: - CVE-2021-20305 - CVE-2020-10543 The CVEs are applicable regardless of note provider project, e.g., an entry of `CVE-2021-20305` will block vulnerabilities with a note name of either `projects/goog-vulnz/notes/CVE-2021-20305` or `projects/CUSTOM-PROJECT/notes/CVE-2021-20305`."
        },
        "maximumUnfixableSeverity": {
          "type": "string",
          "enum": [
            "MAXIMUM_ALLOWED_SEVERITY_UNSPECIFIED",
            "BLOCK_ALL",
            "MINIMAL",
            "LOW",
            "MEDIUM",
            "HIGH",
            "CRITICAL",
            "ALLOW_ALL"
          ],
          "description": "Required. The threshold for severity for which a fix isn't currently available. This field is required and must be set."
        },
        "maximumFixableSeverity": {
          "type": "string",
          "enum": [
            "MAXIMUM_ALLOWED_SEVERITY_UNSPECIFIED",
            "BLOCK_ALL",
            "MINIMAL",
            "LOW",
            "MEDIUM",
            "HIGH",
            "CRITICAL",
            "ALLOW_ALL"
          ],
          "description": "Required. The threshold for severity for which a fix is currently available. This field is required and must be set."
        },
        "containerAnalysisVulnerabilityProjects": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "Optional. The projects where vulnerabilities are stored as Container Analysis Occurrences. Each project is expressed in the resource format of `projects/[PROJECT_ID]`, e.g., `projects/my-gcp-project`. An attempt will be made for each project to fetch vulnerabilities, and all valid vulnerabilities will be used to check against the vulnerability policy. If no valid scan is found in all projects configured here, an error will be returned for the check. Maximum number of `container_analysis_vulnerability_projects` allowed in each `VulnerabilityCheck` is 10."
        }
      },
      "description": "An image vulnerability check, which rejects images that violate the configured vulnerability rules."
    }
  }
}