Professional Cloud DevOps Engineer
Artifact Analysis is a Google Cloud service that scans container images and other software artifacts for security vulnerabilities. It checks both the operating system packages and the application language packages inside the image. This service is built into products like Artifact Registry and Google Kubernetes Engine (GKE), so scanning starts automatically without extra setup. It uses a central database of known security issues to find problems in your software supply chain.
You integrate vulnerability scanning into your CI/CD pipeline by adding steps to your Cloud Build configuration. A common workflow builds a container image and then runs an on-demand scan using a gcloud command. You can set rules based on vulnerability severity (like CRITICAL or HIGH) to decide whether to allow the image to be pushed to the registry or to fail the build. This practice, called "shift-left security," finds and fixes problems early in development, before the software is deployed.
For real-time notifications, Artifact Analysis sends events to Pub/Sub topics. You can subscribe to these topics to get alerts when a scan finishes or when new vulnerabilities are found in images you've already scanned. These alerts can trigger automated actions, like sending a message to a security team, creating a ticket, or starting a process to rebuild the image with fixed dependencies. This event-driven system helps with fast, automated remediation.
Findings from Artifact Analysis are sent to Security Command Center, which gives you a single dashboard to see all security risks across your projects. You can also export this data to BigQuery for deeper analysis and reporting. To enforce security at deployment, you use Binary Authorization. This service lets you create policies that block an image from being deployed to GKE unless it has passed specific security checks, creating a strong, final security gate.
Artifact Analysis provides two main ways to scan: automatic and on-demand. Automatic scanning happens every time a new image is pushed to Artifact Registry. It scans the image once and then continues to monitor it for new vulnerabilities for 30 days. On-demand scanning lets you manually scan an image, either from your local machine or from the registry, using the gcloud CLI. This is useful for adding security checks at specific points in your pipeline before an image is stored.
The service scans for two broad categories of problems. First, it checks operating system (OS) packages, which are the base layers of a container image (like Debian or Alpine Linux). Second, it scans application language packages, which are the libraries your code uses (like Python's requests or Node.js's express). The results show you which specific layer of the Docker image contains the problem, helping developers find and fix the exact dependency.
To let users see scan results, you need to configure IAM permissions. The minimum role needed is containeranalysis.occurrences.viewer. With the right permissions, you can view findings in the Google Cloud console, or you can use the gcloud command or an API call to list results programmatically. This allows you to automate workflows, like checking scan statuses or feeding data into other security tools.
Binary Authorization is a security service that acts as a mandatory checkpoint for deploying containers to Google Kubernetes Engine (GKE). It blocks deployment unless the container image meets specific policy rules. A key rule type requires a cryptographically signed attestation. An attestation is a verified statement, stored in Artifact Analysis, that proves something about the image—most importantly, that it passed a vulnerability scan.
The security gate works by linking scanning and deployment. After an image is scanned by Artifact Analysis, your CI/CD pipeline (like Cloud Build) can create an attestation if the scan results are acceptable (for example, no critical vulnerabilities). This attestation is signed with a private key from a trusted source like Cloud KMS and attached to the image's unique digest. You then create a Binary Authorization policy with a require-attestation rule. This rule states that an image can only be deployed if it has a valid attestation from your trusted signer.
This creates an automated, enforceable security workflow in your pipeline. First, an image is built and pushed to Artifact Registry, triggering a scan. Second, if the scan passes, the pipeline creates and stores the "scan passed" attestation. Finally, when a deployment to GKE is attempted, Binary Authorization checks for the required attestation. If the attestation is missing or invalid, the deployment is blocked. This ensures that only images which have passed your security checks can run in production.
Gauge your current knowledge
Gauge your current knowledge