Prepare and test your skills
Prepare and test your skills
Build integrity and provenance tracking is the practice of proving that a software artifact was produced by a trusted build system from trusted source code without tampering. On Google Cloud, Cloud Build (opens in a new tab) provides the isolated, automated build service, while build provenance (opens in a new tab) provides the verifiable record that links each artifact to its source, toolchain, and build parameters. Together they support high Supply-chain Levels for Software Artifacts (SLSA) assurance from source code to production deployment.
Cloud Build is the managed build service that runs builds from a build config file instead of from developer workstations. Running builds on a build service instead of in developer environments is a requirement for SLSA level 2 because it removes direct user influence over the build machine. A build config defines ordered build steps that fetch dependencies, run unit tests, static analysis, and integration tests, and create artifacts with tools such as Docker, Gradle, Maven, Go, and Python.
Source code flows from source systems such as GitHub and Bitbucket into Cloud Build, and built artifacts flow from Cloud Build into Artifact Registry for storage and then onward through Cloud Deploy to runtimes such as Google Kubernetes Engine (GKE) and Cloud Run. This chain makes the build the single trusted point where source becomes an artifact, which makes tampering easier to detect and policy enforcement easier to apply.
Source code from GitHub flows into Cloud Build, which runs ephemeral builds and generates SLSA level 3 signed provenance. Built images are stored in Artifact Registry, scanned by Artifact Analysis, then gated by Binary Authorization attestations before Cloud Deploy releases them to GKE and Cloud Run.
Build provenance is a collection of verifiable data about a build that shows where an artifact came from and how it was built. Provenance metadata describes the link between inputs, the build system, and outputs, and it enables verification that an artifact was created from a trusted source location by a trusted build system. Provenance data supports alerting and policy enforcement, such as policies that allow deployment only for code built from verified sources.
Provenance metadata for a build includes details such as:
Cloud Build can generate build provenance for container images that provides SLSA level 3 build assurance. The SLSA levels differ in how provenance is produced and what it must contain:
| SLSA level | How provenance is provided | What provenance must contain |
|---|---|---|
| Level 1 | Available to consumers of the built artifacts | Basic build details |
| Level 2 | Generated by the build service and verifiable for authenticity and integrity with a digital signature from the service that creates it | Same as Level 1, with service-generated verifiable authenticity |
| Level 3 | Same verifiable, service-generated model as Level 2 | Same as Level 2, plus the entry point of the build definition and all build parameters under a user's control |
Provenance at higher levels therefore carries stronger proof because the build service itself signs the record and captures the exact build definition that was used.
An ephemeral build environment is a temporary build worker, such as a container or virtual machine (VM), that is provisioned for a single build invocation and then wiped or deleted. Cloud Build sets up a new VM environment for every build and destroys it after the build process is complete. Ephemeral workers ensure clean builds because no residual files or environment settings carry over from one build to interfere with the next build.
The ephemeral build lifecycle runs in a fixed order:
A non-ephemeral environment gives an attacker a place to persist malicious files between builds, while an ephemeral environment removes that persistence path. Ephemeral builds also reduce maintenance overhead and reduce inconsistencies in the build environment.
Restricting access to the build service means granting only the minimum permissions needed for builds to run and interact with other services. The build runs under a non-human identity, so the service account acting on behalf of Cloud Build must follow the principle of least privilege. This limits what a compromised build or stolen credential can reach.
Controls for Cloud Build include:
Exam tip: Cloud Build supports VPC Service Controls only for builds run in a private pool, not for default public pools.
Deployment policy and attestation enforcement is the control that permits only signed, verified container images to run in production. On Google Cloud, Binary Authorization (opens in a new tab) provides this control by checking every deployment request against a policy before the image is allowed to deploy. If the image has the required attestations, deployment proceeds to Google Kubernetes Engine (GKE) or Cloud Run; if it does not, deployment is blocked.
Binary Authorization is a deploy-time gate that enforces signature-based constraints on container images in a GKE environment. The policy defines which images conform to organizational security criteria, and only those conforming images are allowed to deploy while all other images are disallowed. This enforcement protects the supply chain from pipeline poisoning and compromised inputs by stopping unverified images at the boundary between Artifact Registry and the runtime. The service is enabled with a default configuration that can be inspected by exporting the policy YAML file and then customized to organizational standards.
The same underlying policy object is managed through consistent interfaces:
google_binary_authorization_policy Terraform resource for managing the policy as codeAn attestor is the Binary Authorization resource that verifies that an image meets a specific security criterion, such as passing vulnerability scanning or approved build checks. Each attestor holds one or more public keys from a public key infrastructure (PKI), and verification succeeds only when an attestation signature on the image can be validated with one of those trusted public keys. The private key signs the attestation during the trusted build or security review step, and the public key stored in the attestor proves the signature at deploy time.
Because the policy depends on the attestors and the attestors depend on the public keys, losing control of the private signing key or using the wrong public key causes legitimate deployments to fail verification. To embed this check into Cloud Build pipelines, the build creates the attestation after security checks pass and Binary Authorization enforces a policy that allows deployment to Cloud Run and GKE only if that attestation is present and valid. This sequence runs first with image build and scanning, then with signed attestation creation, and only after successful verification with deployment to the runtime.
Attestor management supports the following interfaces:
google_binary_authorization_attestor Terraform resource for managing attestors as codeCross-organization attestation verification allows Binary Authorization to trust attestations signed by an external participant, such as another organization in a federated workflow. The local policy still applies to the local GKE environment, but the trust anchor shifts to public keys received from the third-party signer. This model lets each organization keep its own signing keys while still enforcing a shared standard for which images are permitted to execute.
To verify attestations that a third party created, complete the steps in order:
Exam tip: Binary Authorization blocks by default — an image deploys only when its required attestations verify against the policy; any image without valid signatures is disallowed.
Artifact management and vulnerability analysis is the practice of storing all container images and language packages in one controlled place and continuously checking them for known security flaws before deployment. On Google Cloud, Artifact Registry (opens in a new tab) provides the central storage and access control for artifacts, while Artifact Analysis (opens in a new tab) provides the scanning, Software Bill of Materials (SBOM) generation, and vulnerability metadata for those artifacts. Together they create visibility from source code to production, so teams can detect flaws early, limit who can change artifacts, and block vulnerable images from reaching runtimes such as Google Kubernetes Engine and Cloud Run.
Artifact Registry is a universal package manager that stores an organization's container images and language packages in private repositories. By centralizing artifacts and dependencies in Artifact Registry, teams gain visibility into what code is in the software supply chain and control over where that code comes from and who can use it. Requests for external packages flow from developers and builds to Artifact Registry first, and Artifact Registry fetches from the external source only when needed, which keeps the private repository as the trust boundary between internal builds and public registries.
Artifact Registry uses different repository types to control that flow and reduce supply-chain risk:
| Repository type | What it stores | Why to use it |
|---|---|---|
| Remote repositories | Cached artifacts from preset external sources such as Docker Hub, Maven Central, Python Package Index (PyPI), Debian, or CentOS, plus user-defined sources for supported formats | Reduce download time, improve package availability, and include vulnerability scanning if scanning is enabled |
| Virtual repositories | Single endpoint that consolidates repositories of the same format and controls search order across upstream repositories | Prioritize private packages over public registries to reduce the risk of dependency confusion attacks |
Artifact Analysis is the Google Cloud service that proactively detects vulnerabilities in artifacts stored in Artifact Registry. Artifact Analysis provides integrated on-demand or automated scanning for base container images and language packages in containers, and it can generate an SBOM and store Vulnerability Exploitability eXchange (VEX) statements for images in Artifact Registry. The scan depends on Artifact Registry as its source, because Artifact Analysis scans new images when they are uploaded to Artifact Registry and extracts information about the system packages inside the container.
After the initial scan, Artifact Analysis continuously monitors scanned images for new threats in an ordered lifecycle:
This lifecycle means an image that was clean at build time can later show new findings without being re-uploaded, so teams must review current scan results and SBOM data before promotion to production.
Controlling access and preserving integrity in Artifact Registry means allowing only authorized identities and networks to read or write artifacts and preventing silent replacement of trusted images. Artifact Registry protects artifacts with granular Identity and Access Management (IAM) policies, Virtual Private Cloud (VPC) Service Controls service perimeters, and organization policies that constrain how repositories can be configured. These controls place the repository inside an access boundary where IAM decides who can act, VPC Service Controls limits where requests can come from, and organization policies set guardrails for the whole environment.
Teams preserve integrity by removing stale artifacts and making deployments tamper-evident:
sha256:...), which prevents tag-mutation attacks where a trusted tag is repointed to malicious contentExam tip: Deploy by digest (sha256:...) rather than by mutable tag when you must guarantee the exact image, because a tag can be reassigned while a digest is immutable.
Securing the software supply chain connects builds, artifacts, and deployments into one trusted chain. Source code flows into Cloud Build for isolated, ephemeral builds with signed provenance, built artifacts flow into Artifact Registry where Artifact Analysis scans and tracks vulnerabilities, and deployment requests flow into Binary Authorization where policy and attestors allow only verified images to reach GKE or Cloud Run.
Level 2 provenance is generated by the build service and is verifiable for authenticity and integrity with a digital signature from the service that creates it, while level 3 uses the same verifiable service-generated model and must also contain the entry point of the build definition and all build parameters under a user's control. Cloud Build can generate build provenance for container images that provides SLSA level 3 build assurance.
Binary Authorization is a deploy-time gate that allows deployment only when an image's required attestations verify against the policy, while all other images are disallowed. An attestor holds one or more public keys and verification succeeds only when the attestation signature made by the private key validates with a trusted public key stored in the attestor.
An ephemeral build environment is a temporary worker such as a container or virtual machine that is provisioned for a single build invocation and then wiped or deleted after the build finishes. Cloud Build sets up a new virtual machine environment for every build and destroys it afterward to ensure clean builds with no residual files carrying over, which removes a place for an attacker to persist malicious files between builds and reduces maintenance overhead and inconsistencies.
Remote repositories should be used to store cached artifacts from preset external sources such as Docker Hub, Maven Central, and Python Package Index and from user-defined sources, which reduces download time, improves availability, and can include vulnerability scanning if scanning is enabled. Virtual repositories should be used to provide a single endpoint that consolidates repositories of the same format and prioritizes private packages over public registries to reduce the risk of dependency confusion attacks.
An enterprise runs containerized workloads across Google Kubernetes Engine (GKE) and Cloud Run. The security compliance team establishes a mandatory software supply chain policy:
Which solution should you implement to enforce this deployment control?
Configure a Binary Authorization policy rule with evaluationMode set to REQUIRE_ATTESTATION and enforcementMode set to DRYRUN_AUDIT_LOG_ONLY, binding attestors to Cloud KMS asymmetric signing keys.
Configure a Binary Authorization policy rule with evaluationMode set to ALWAYS_DENY and define admissionWhitelistPatterns matching the container image repository URLs in Artifact Registry.
Configure IAM conditions on Artifact Registry to restrict roles/artifactregistry.reader permissions to service accounts that present valid X.509 client certificates during image pulls.
Configure a Binary Authorization policy rule with evaluationMode set to REQUIRE_ATTESTATION and enforcementMode set to ENFORCED_BLOCK_AND_AUDIT_LOG, specifying attestors configured with the corresponding public keys and Artifact Analysis notes.
Last updated