[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-28。"],[],[],null,["# Safeguard deployments\n\nThis document describes best practices for protecting your deployments.\n\nCreate and enforce deployment policies\n--------------------------------------\n\nTo protect your runtime environments, define policies with criteria for\ndeployment and validate policy compliance before and after deployment. Defining\na policy that only allows code signed by predefined attestors helps in gating deployments and deploying only code from trusted origins.\n\nExamples of deployment criteria include:\n\n- No known vulnerabilities with a severity above Medium\n- Source code is from a trusted source repository\n- A trusted build service ran the build\n- Build artifacts you are deploying are from a trusted artifact repository\n\n### Generate metadata\n\nTo validate these requirements, your need to provide metadata about your build\nartifacts.\n\nBuild origins\n\n: *Build provenance* is a collection of verifiable data about a build such as\n the digests of built images, the input source locations, the build toolchain,\n and the build duration. [SLSA](https://slsa.dev), a framework for assessing security\n posture, provides a [model for provenance](https://slsa.dev/provenance/) and\n [requirements for provenance](https://slsa.dev/spec/v0.1/requirements#provenance-requirements). Provenance is one requirement\n category in the framework, and each requirement is associated with SLSA\n levels so that you can incrementally implement mitigations.\n\n - For SLSA level 1 assurance, provenance must be available.\n - For SLSA level 2 assurance, provenance must be generated and consumers must be able to verify its authenticity and integrity.\n - SLSA Levels 3 and 4 have stricter requirements for provenance signing and depth of provenance data detail.\n\n: Some build services generate build provenance metadata.\n\n - In Google Cloud, Cloud Build [generates and signs build provenance](/build/docs/securing-builds/view-build-provenance) for container images supporting SLSA level 3 builds.\n - The SLSA framework provides [GitHub provenance tools](https://github.com/slsa-framework/slsa-github-generator). The tools generate non-forgeable SLSA provenance on GitHub that meet requirements in the [build](https://slsa.dev/spec/v0.1/requirements#build-requirements) and [provenance](https://slsa.dev/spec/v0.1/requirements#provenance-requirements) categories for SLSA level 3.\n - The open source [sigstore](https://www.sigstore.dev) project includes the [cosign](https://github.com/sigstore/cosign) tool for signing containers.\n\nVulnerabilies\n\n: Vulnerability scanning software checks your source code and build artifacts\n for known vulerabilties. Artifact Analysis can\n [automatically scan](/container-analysis/docs/automated-scanning-howto) container images pushed to Artifact Registry\n for vulnerabiilities. To check artifacts for vulnerabilities before you store\n them, you can use the [On-Demand Scanning API](/container-analysis/docs/on-demand-scanning-howto) in a local development environment or\n in a CI/CD pipeline, such as a [Cloud Build build step](/container-analysis/docs/ods-cloudbuild).\n\n### Set up policy enforcement\n\nOnce you have metadata about your deployable artifacts, you need tools to\nenforce your policies.\n\nIn Google Cloud, you can configure a policy in\n[Binary Authorization](/binary-authorization/docs/overview) for your deployments. Binary Authorization\nenforces policy for attempted deployments to supported container-based\nplatforms. It can also perform continuous validation of policy for workloads\nrunning on GKE, Cloud Run, and GKE Enterprise.\n\nPre-deployment checks can block all images that are not in the exempt image\nlist, so that only trusted images are deployed from trusted registries.\nYour policy can also require [attestations](/binary-authorization/docs/key-concepts#attestations), digital documents\nthat signify that the image was built successfully with a specific, required\nprocess. For example an attestion can indicate that an image is:\n\n- [Built by Cloud Build](/binary-authorization/docs/deploy-cloud-build).\n- [Does not contain vulnerabilities above a specified severity](/binary-authorization/docs/creating-attestations-kritis). If there are specitic vulnerabilities that do not apply to your applications, you can add them to an allowlist.\n\n[Continuous validation](/binary-authorization/docs/overview-cv) extends policy validation to the post-deploy\nenvironment. When enabled, Binary Authorization provides validation throughout\nthe Pod lifecycle by regularly logging policy conformance in\n[Cloud Logging](/logging/docs/audit). This is useful in a variety of situations.\nFor example, if you change your policy after deploying a container, continuous\nvalidation logs Pods that violate te updated policy. It also logs policy\nviolations for Pods deployed with [dry run](/binary-authorization/docs/enabling-dry-run) or\n[breakglass](/binary-authorization/docs/using-breakglass).\n\nUse gated deployment services\n-----------------------------\n\nDeployment gating lets you approve or deny deployments at specific points in the\ndeployment process using a standalone CI/CD service or a CI/CD service\nintegrated with a process automation system. Gated deployments prevent\nunauthorized users from making changes to application environments. They provide\nadditional oversight to the deployment process and greater visibility of\napprovals.\n\nIn Google Cloud, [Cloud Deploy](/deploy/docs/overview) offers a fully-managed\nservice for deploying workloads to Google Kubernetes Engine. The\n[gated deployment](/deploy/docs/overview#approvals) feature lets users specify if an approval is\nneeded for promotion to a target.\n\nMonitor your workloads\n----------------------\n\n*Workloads* are applications running on container-based platforms such as\nGKE and Cloud Run. The workloads that you deploy\nshould ideally have a [hardened configuration](/kubernetes-engine/docs/how-to/hardening-your-cluster) that\nlimits their attack surface.\n\nChecking workloads across clusters for configuration issues can be difficult to\ndo manually at scale. Google Cloud provides dashboards in Cloud Run and\nGKE to view security insights for workloads.\n\nThe\n[GKE security posture dashboard](/kubernetes-engine/docs/concepts/about-security-posture-dashboard)\nprovides you with guidance to strengthen the security posture of your clusters\nbased on Google's recommendations. It includes automatic\n[workload configuration scanning](/kubernetes-engine/docs/how-to/protect-workload-configuration), which checks for\nknown configuration concerns across all workloads. GKE checks\neach deployed workload against relevant industry best practices, such as\npolicies in the [Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/).\nGKE rates the severity of discovered issues and returns\nactionable recommendations and logs. You can use [Cloud Logging](/logging/docs/audit) to get\nan auditable trail of concerns for better reporting and observability. For\ninstructions on viewing security insights in the GKE security\nposture dashboard, see\n[Deploy on GKE and view security insights](/software-supply-chain-security/docs/sds/deploy-gke-view-security-insights).\n\nCloud Run contains a security panel that displays software supply\nchain security insights such as the SLSA build level compliance info, build\nprovenance, and vulnerabilities found in running services. For instructions on\nviewing security insights in the Cloud Run security insights panel,\nsee\n[Deploy on Cloud Run and view security insights](/software-supply-chain-security/docs/sds/deploy-run-view-security-insights).\n\nGoogle Cloud also provides other services and features to improve your\nsecurity posture across the software development lifecycle. For more\ninformation, see the\n[software supply chain overview](/software-supply-chain-security/docs/overview).\n\nWhat's next\n-----------\n\n- Learn the [best practices to safeguard source code](/software-supply-chain-security/docs/safeguard-source).\n- Learn the [best practices to safeguard dependencies](/software-supply-chain-security/docs/dependencies).\n- Learn the [best practices to safeguard builds](/software-supply-chain-security/docs/safeguard-builds)."]]