Skip to content

Professional Cloud DevOps Engineer · Domain 2: Building, implementing, and maintaining CI/CD pipelines, including continuous testing, for application, infrastructure, and ML workloads · 30% of the exam

Task 2.4: Securing the deployment pipeline.

Artifact Analysis and vulnerability scanning, supply chain security with Binary Authorization and SLSA, and IAM policies per environment.

Study it

  • Securing the pipeline: Artifact Analysis, Binary Authorization, SLSA and per-environment IAM

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Google Cloud documentation page that proves it.

Question 1 · choose 1

In a project with the Artifact Analysis API enabled, container images pushed to Artifact Registry Docker repositories show vulnerability findings. Python and npm packages that the same pipelines publish to Artifact Registry standard repositories show none, although some depend on libraries with known vulnerabilities. What should the DevOps engineer do?

  1. ARun an On-Demand Scanning step against each package version in the build before it is published
  2. BAdd a new tag to each package version so it counts as a new upload
  3. CTurn on vulnerability scanning in the scanning settings of each package repository
  4. DEnable the Container Scanning API in the project, then push every package version again
Show the answer and why
  • ARun an On-Demand Scanning step against each package version in the build before it is published

    Incorrect

    On-Demand Scanning in Cloud Build scans a built container image before it is pushed; it is not how published language packages get scanned.

  • BAdd a new tag to each package version so it counts as a new upload

    Incorrect

    Scans are tied to the digest, and adding or changing tags does not start a new scan.

  • CTurn on vulnerability scanning in the scanning settings of each package repository

    Correct

    Artifact Analysis scans new images automatically, but scanning is disabled by default for packages and must be enabled per repository.

  • DEnable the Container Scanning API in the project, then push every package version again

    Incorrect

    Image scanning already works in this project; the packages are skipped because of the repositories' own scanning setting, which a push alone does not change.

When the Artifact Analysis API is enabled, Artifact Analysis scans each new image pushed to Artifact Registry, but packages pushed to Artifact Registry repositories are not scanned until scanning is enabled for that repository.

Question 2 · choose 1

A team wants SLSA build provenance for every image it ships, and wants a build to fail if provenance is missing. Builds with this cloudbuild.yaml push the image to Artifact Registry and then fail, because no provenance is generated: steps: - name: 'gcr.io/cloud-builders/docker' args: ['build', '-t', 'us-docker.pkg.dev/shop-ci/apps/cart:$SHORT_SHA', '.'] - name: 'gcr.io/cloud-builders/docker' args: ['push', 'us-docker.pkg.dev/shop-ci/apps/cart:$SHORT_SHA'] options: requestedVerifyOption: VERIFIED What should the team change?

  1. ASet requestedVerifyOption to NOT_VERIFIED so the push step can attach provenance on its own
  2. BPush the image to a gcr.io path instead, so that Cloud Build stores the provenance with it
  3. CAdd a step after the push that runs the SLSA verifier against the image in Artifact Registry
  4. DRemove the docker push step and list the image in the build's images field
Show the answer and why
  • ASet requestedVerifyOption to NOT_VERIFIED so the push step can attach provenance on its own

    Incorrect

    Lowering the option only drops the check the team asked for; a push step never attaches provenance, whatever the build options say.

  • BPush the image to a gcr.io path instead, so that Cloud Build stores the provenance with it

    Incorrect

    Cloud Build generates build provenance only for artifacts stored in Artifact Registry.

  • CAdd a step after the push that runs the SLSA verifier against the image in Artifact Registry

    Incorrect

    The SLSA verifier validates provenance that already exists; it does not generate any.

  • DRemove the docker push step and list the image in the build's images field

    Correct

    Cloud Build can't generate provenance for an image pushed with an explicit docker push step; images listed in the images field are stored by Cloud Build, which then records their provenance.

Cloud Build generates provenance for a container image only when it stores the image itself, through the build's images field. An image pushed by a docker step gets none, so the build keeps failing until the push moves to the images field.

Question 3 · choose 1

A Cloud Deploy pipeline promotes releases from a staging GKE cluster to a production GKE cluster in another project. Both targets run their jobs as the execution environment's default service account, which holds deploy rights on both clusters. After a review, a compromised staging rollout must have no way to change production, releases must keep flowing through the same pipeline, and production changes must still be possible. What should the DevOps engineer change?

  1. ASet a custom execution service account on the production target for the DEPLOY usage, and leave the staging target on the default one
  2. BSet a different custom execution service account on each target, each allowed to deploy only into that target's own runtime
  3. CAdd a deploy policy on the production target that allows rollouts only during the change window the review board approves
  4. DRequire approval on the production target, with Cloud Deploy Approver granted only to the team leads
Show the answer and why
  • ASet a custom execution service account on the production target for the DEPLOY usage, and leave the staging target on the default one

    Incorrect

    Production jobs get their own identity, but staging jobs still run as the default service account, which keeps its deploy rights on the production cluster.

  • BSet a different custom execution service account on each target, each allowed to deploy only into that target's own runtime

    Correct

    Each target's executionConfigs can name its own service account, so staging jobs run with an identity that has no rights on the production cluster.

  • CAdd a deploy policy on the production target that allows rollouts only during the change window the review board approves

    Incorrect

    A deploy policy restricts when deploy actions may happen; the staging jobs' identity still has rights on the production cluster at all times.

  • DRequire approval on the production target, with Cloud Deploy Approver granted only to the team leads

    Incorrect

    Approval gates promotions into production but leaves the staging jobs running as an identity that can write to the production cluster.

By default Cloud Deploy runs render and deploy jobs as the default Compute Engine service account. Setting a custom execution service account per target, with access only to that target's runtime, gives each environment its own IAM boundary. Approvals and deploy policies control promotion and timing, not the identity jobs run as.

Question 4 · choose 1

In a Cloud Deploy project, the service account prod-operator must be able to promote releases into the prod target and into no other target, while the existing roles of other teams stay as they are. The team already binds roles/clouddeploy.operator to prod-operator. What should it add to that binding?

  1. AApply the binding with gcloud deploy targets set-iam-policy on the prod target instead of on the project
  2. BSet requireApproval: true on the prod target and grant prod-operator the Cloud Deploy Approver role
  3. CA condition with the expression api.getAttribute( "clouddeploy.googleapis.com/rolloutTarget", "") == "prod"
  4. DA condition with resource.name.endsWith("/targets/prod"), so that the role applies only to the prod target resource
Show the answer and why
  • AApply the binding with gcloud deploy targets set-iam-policy on the prod target instead of on the project

    Incorrect

    Granting operator on a specific target controls who can update and delete that target's configuration; it is not how promotion to a target is restricted.

  • BSet requireApproval: true on the prod target and grant prod-operator the Cloud Deploy Approver role

    Incorrect

    Approval adds a gate after promotion; it does not limit which targets prod-operator itself can promote releases into.

  • CA condition with the expression api.getAttribute( "clouddeploy.googleapis.com/rolloutTarget", "") == "prod"

    Correct

    The rolloutTarget API attribute holds the target a principal is promoting to, so the condition lets the role apply only for promotions to prod.

  • DA condition with resource.name.endsWith("/targets/prod"), so that the role applies only to the prod target resource

    Incorrect

    Promotion creates a rollout under the release; Cloud Deploy exposes the promotion target through the rolloutTarget API attribute, which is what the documented condition checks.

Cloud Deploy supports IAM conditions that use API attributes to restrict actions at runtime. Binding a role with the condition api.getAttribute("clouddeploy.googleapis.com/rolloutTarget", "") == "prod" allows promotion only into the prod target; similar conditions can add time windows for promotion or approval.

Question 5 · choose 1

A security team wants a Cloud Run function to open a ticket each time Artifact Analysis automated scanning records a vulnerability in one of the company's container images, so that the owning team is told about that image right away. To which Pub/Sub topic should the function's subscription be attached?

  1. Acontainer-analysis-notes-v1, which receives a message for every vulnerability that Artifact Analysis knows about
  2. Bgcr, which Artifact Registry uses to publish image push, tag and delete events
  3. CA log sink topic fed by Data Access audit logs for Artifact Registry image reads
  4. Dcontainer-analysis-occurrences-v1, which receives a message when an occurrence is created or updated
Show the answer and why
  • Acontainer-analysis-notes-v1, which receives a message for every vulnerability that Artifact Analysis knows about

    Incorrect

    Notes describe vulnerabilities and other metadata in general; the finding for a specific image is an occurrence.

  • Bgcr, which Artifact Registry uses to publish image push, tag and delete events

    Incorrect

    The gcr topic reports changes to images in repositories, not scanning results for them.

  • CA log sink topic fed by Data Access audit logs for Artifact Registry image reads

    Incorrect

    Audit logs of image reads say who pulled an image, not which vulnerabilities scanning found in it.

  • Dcontainer-analysis-occurrences-v1, which receives a message when an occurrence is created or updated

    Correct

    Scanning records each vulnerability found in an image as an occurrence, and Artifact Analysis publishes created and updated occurrences to this topic.

Artifact Analysis publishes Pub/Sub messages when notes or occurrences are created or updated, on the topics container-analysis-notes-v1 and container-analysis-occurrences-v1. Topics that are missing can be created by hand; to receive the messages, create a subscription on the topic.

Question 6 · choose 1

To keep production changes to weekdays, a team binds roles/clouddeploy.operator to the service account release-bot on its delivery pipeline with this condition: request.time.getDayOfWeek("America/Los_Angeles") > 0 && request.time.getDayOfWeek("America/Los_Angeles") < 6 On a Saturday, release-bot still promotes a release. What is the most likely cause?

  1. ACloud Deploy evaluates request.time in UTC, so a Saturday in Los Angeles can still count as a Friday
  2. BAnother binding without the condition, such as a group or project role, also lets release-bot promote
  3. CCloud Deploy accepts only its own API attributes in conditions, so the request.time expression is ignored
  4. DThe condition on a Cloud Deploy role is evaluated when the release is created, not when it is promoted
Show the answer and why
  • ACloud Deploy evaluates request.time in UTC, so a Saturday in Los Angeles can still count as a Friday

    Incorrect

    The expression names the America/Los_Angeles time zone, so the day of the week is computed in that zone.

  • BAnother binding without the condition, such as a group or project role, also lets release-bot promote

    Correct

    A time-window binding only limits the access it grants; it does not revoke access that the principal has from other bindings outside the window.

  • CCloud Deploy accepts only its own API attributes in conditions, so the request.time expression is ignored

    Incorrect

    request.time conditions are a documented way to restrict promotion or approval in Cloud Deploy to a time window.

  • DThe condition on a Cloud Deploy role is evaluated when the release is created, not when it is promoted

    Incorrect

    The condition is evaluated when the principal tries to promote the release, so a Saturday promotion is checked on Saturday.

Cloud Deploy access can be limited with IAM conditions, for example with request.time to allow promotion or approval only in a time window. A conditional binding does not take away access the principal holds through other bindings, so the window works only if no unconditional binding grants the same permission.

Question 7 · choose 1

A project holds a staging GKE cluster and a production GKE cluster, and both must stay in that project. Binary Authorization must require an attestation from the release pipeline for images deployed to production, while staging keeps accepting any image so that developers can test quickly. How should the policy be set up?

  1. AA default rule that allows all images, plus a cluster-specific rule for production that requires the attestation
  2. BTwo policies in the project, one for staging and one for production, each with its own default rule
  3. COne policy whose default rule requires the attestation, with the staging registry path added to the exempt images
  4. DOne policy whose default rule requires attestations from two attestors, one created for each cluster
Show the answer and why
  • AA default rule that allows all images, plus a cluster-specific rule for production that requires the attestation

    Correct

    A policy has one default rule for requests that match no specific rule, and on GKE specific rules can target clusters, so production gets its own stricter rule.

  • BTwo policies in the project, one for staging and one for production, each with its own default rule

    Incorrect

    Each Google Cloud project can have exactly one Binary Authorization policy.

  • COne policy whose default rule requires the attestation, with the staging registry path added to the exempt images

    Incorrect

    Exempt images are allowed on every cluster in the project, so the same images would also pass in production.

  • DOne policy whose default rule requires attestations from two attestors, one created for each cluster

    Incorrect

    The default rule applies to both clusters, so staging deployments would still be blocked without attestations.

A project has exactly one Binary Authorization policy. Its default rule covers every deployment that no specific rule matches; on GKE, specific rules can target clusters, Kubernetes namespaces or Kubernetes service accounts. A cluster-specific rule (clusterAdmissionRule) lets one cluster enforce stricter requirements than the rest.

Practice domain 2 →Practice all domains →