This domain (about 19%) joins two ideas: prevent problems in the pipeline and the platform (scanning, signing, hardening, patching, policy) and see and respond to problems at run time (logs, network telemetry, Security Command Center). Questions typically ask which log, sink or SCC service to use, or where to put a security gate in the delivery pipeline.
Automating infrastructure and application security
Vulnerability scanning in CI/CD
Artifact Analysis (formerly Container Analysis) scans images and packages in Artifact Registry and produces vulnerability occurrences (CVE, severity, fix available).
- Automatic scanning runs when an image is pushed, and continuous analysis re-checks stored images for newly published CVEs for a period afterwards (images not pulled for a long time stop being updated).
- On-demand scanning (
gcloud artifacts docker images scan) scans a local image or one in a registry before pushing, so a pipeline can fail early. - Supports OS packages and language packages (Java, Go, Node, Python and others). It can also generate SBOMs.
- In Cloud Build, run a scan step and check results with
--formatto fail the build above a chosen severity. Cloud Build also creates SLSA build provenance attestations (verifiable record of what built the image from which source), and can run in private pools inside your VPC and perimeter. - Shift left: also scan Infrastructure as Code (Terraform plans) with policy checks, scan source dependencies, and use Assured Open Source Software or an internal remote repository for dependencies.
Binary Authorization
Binary Authorization is a deploy-time control for GKE and Cloud Run (and GKE on-premises/attached clusters). It admits only images that satisfy a policy.
| Concept | Detail |
|---|---|
| Policy | One per project. A default rule (allow all, deny all, require attestations) plus per-cluster, per-namespace or service-account rules |
| Attestor | Verifies signatures. Holds public keys (PKIX, usually Cloud KMS asymmetric keys) and a Container Analysis note |
| Attestation | A signed statement that an image digest passed a step (build, vulnerability scan, QA). Created by Cloud Build or a pipeline step |
| Images by digest | Attestations refer to digests, so tags like latest aren’t trusted |
| Exempt images | Allowlist patterns for system images, or Google-managed ones |
| Dry-run | Logs would-be denials without blocking |
| Break-glass | Annotation on a Pod to bypass in an emergency, which is audit logged |
| Continuous validation | Re-checks running Pods against policy and logs violations |
Two-person flow: the build pipeline signs after tests; a separate security process signs after vulnerability review. The policy requires both attestors, which enforces separation of duties. The signing keys live in Cloud KMS with IAM limited to the pipeline identity. Binary Authorization needs images in a registry the cluster can reach, and it doesn’t stop an already running workload unless continuous validation is on.
Hardened images and patching
- Build golden images with an automated pipeline (Packer or EC-style image builders on Cloud Build), applying CIS-style hardening and baking in agents. Publish in an image family and deprecate older ones. Restrict use to your projects with
compute.trustedImageProjects. - Prefer Shielded VM images (secure boot, vTPM, integrity monitoring) and enforce with
compute.requireShieldedVm. - For containers: minimal or distroless base images, no root user, rebuild regularly, scan in the registry, and sign. On GKE use Container-Optimized OS, Autopilot or node auto-upgrade, private nodes, Pod Security Standards, network policy and Workload Identity Federation.
- VM Manager OS Patch Management (OS Config agent) runs patch jobs (on demand), patch deployments (scheduled, recurring, with rollout in zones), reports OS inventory and vulnerability reports for installed packages. Use maintenance windows and rollout budgets, and combine with managed instance group rolling replacement for immutable updates.
- Prefer replacing instances with a new image over patching in place when workloads are in managed instance groups.
Policy and drift detection at scale
Cloud security posture management (CSPM) keeps the estate in line with your standard.
| Layer | Tool |
|---|---|
| Prevent at create time | Organization policies, custom constraints, Policy Controller (OPA Gatekeeper) in GKE, Config Connector |
| Validate before deploy | terraform validate with the policy library (Terraform validator / gcloud beta terraform vet), CI checks of plans |
| Detect after create | Security Health Analytics (SHA) detectors and custom modules, Cloud Asset Inventory feeds with Pub/Sub |
| Define as code | SCC Posture Management: a posture (policy sets of org policies and SHA detectors) deployed to an organisation, with drift detection and compliance mapping |
| Reconcile | Config Sync (GitOps) for Kubernetes, Terraform pipelines (Infrastructure Manager) |
Custom modules for Security Health Analytics let you write a detector in CEL over a resource’s properties (for instance “any Compute instance whose label data is pci has an external IP”), with severity, recommendation and scope. They are available in SCC Premium and Enterprise. Custom organization policy constraints block it at creation. Detection finds what already exists, prevention covers what’s new. Use both.
Logging, monitoring and detection
Designing the logging strategy
- Central security logging project receives an aggregated sink at the organisation (with
includeChildren) so no project can opt out. Keep application logs and security logs separate. - Decide retention by regulation, put it on a locked bucket (retention that cannot be shortened) or an exported Cloud Storage bucket with Bucket Lock.
- Use CMEK for log buckets and restrict who can read. Separate admin roles from viewers.
- Define log-based metrics and alerts for the sensitive operations (IAM policy changes, custom role changes, firewall and VPC changes, audit configuration changes, key destruction) like the CIS benchmark recommends.
Cloud Audit Logs
| Log | Records | Default | Notes |
|---|---|---|---|
| Admin Activity | Config and metadata changes (create, setIamPolicy) |
Always on, free, cannot be disabled | 400 days in the _Required bucket |
| System Event | Google-initiated changes (live migration) | Always on | 400 days in _Required |
| Data Access | Reads of config (ADMIN_READ), reads of data (DATA_READ), writes of data (DATA_WRITE) |
Off for most services (BigQuery data access is on) | Billable. Enable at org, folder, project or service level. 30 days in _Default unless changed |
| Policy Denied | Requests denied for security-policy reasons (VPC-SC, org policy) | On, can be excluded | Goes to _Default |
| Access Transparency | Actions by Google staff on your content | With eligible support plan or Assured Workloads | Separate log, see compliance notes |
You can exempt principals from Data Access logs (for noisy service accounts), but don’t exempt humans. Log entries show the caller, method, resource and request/response. Data Access logs are the answer to “who read this table or secret”, and you must have enabled them before the event.
Reading them: roles/logging.viewer sees Admin Activity and not Data Access. roles/logging.privateLogViewer sees both. In buckets, use log views to give narrower access.
Log Router, buckets and sinks
The Log Router processes every log entry through sinks. Each sink has a destination, an inclusion filter and optional exclusion filters.
| Destination | Best for |
|---|---|
| Cloud Logging bucket (same or another project) | Central, searchable, Log Analytics |
| BigQuery | SQL analysis, dashboards, joins |
| Cloud Storage | Long, cheap retention and evidence, with Bucket Lock |
| Pub/Sub | Streaming to external SIEM (Splunk, QRadar) or automation |
Facts:
- A sink has a writer identity (service account) that you must grant on the destination (
bigquery.dataEditor,storage.objectCreator,pubsub.publisher,logging.bucketWriter). A common failure is a sink that exports nothing because that grant is missing. - Aggregated sinks at organization or folder level export logs from all child projects (set
includeChildren). Sinks are not retroactive. - Built-in buckets:
_Required(400 days, fixed, Admin Activity, System Event, Access Transparency),_Default(30 days, configurable). User-defined buckets allow retention from 1 to 3,650 days, a chosen region, CMEK, and locking. - To keep logs out of
_Default(and avoid ingestion charges) edit or disable the_Defaultsink and exclude. - Log Analytics: upgrade a bucket to run SQL over logs in the console, and create a linked BigQuery dataset to join logs with other data without copying.
- Exporting to external security systems: Pub/Sub sink plus a Dataflow template to the SIEM, or ingest to Google Security Operations through its native Google Cloud integration. Pub/Sub preserves order of delivery only within limits and has retention, so plan for replays.
Network logs and traffic analysis
| Source | What it gives | Notes |
|---|---|---|
| VPC Flow Logs | Sampled records of flows (5-tuple, bytes, RTT, metadata) for VM, VPN tunnel and VLAN attachment traffic | Enabled per subnet. Default aggregation 5 s, default sampling 50% of flows. Adjust for cost. Records flows, not payload |
| Firewall Rules Logging (and Cloud NGFW logs) | Each time a rule allows or denies a connection | Per rule. Verify rules are used. Find blocked attacks |
| Cloud NAT logging | Translations and drops | Needed to find which VM made an outbound connection |
| Load balancer logs | Requests at the LB, including Cloud Armor decisions | Enforced policy name appears in logs |
| Cloud DNS logging | Queries | Detect DGA and tunnelling |
| Packet Mirroring | Full packet copies, including payload, of selected VMs, sent to a collector behind an internal load balancer | Policy chooses sources by subnet, tag or instance. Needed for deep inspection, forensics or third-party IDS. Billed for mirrored traffic. Source and collector in the same region |
| Cloud IDS | Managed network threat detection (Palo Alto Networks engine) | You create an IDS endpoint in a zone and a packet mirroring policy sends traffic to it. Findings appear in Cloud Logging and SCC. Detects only, doesn’t block |
Choose: Flow logs to see who talked to whom, Packet Mirroring when payload is needed, Cloud IDS for managed signature-based detection, Cloud NGFW Enterprise when blocking is needed.
Securing access to logs
Treat logs as sensitive (they can hold user data and secrets). Use dedicated projects, privateLogViewer only for security analysts, log views to expose subsets, CMEK on buckets, VPC-SC around Logging and BigQuery, and an exported evidence bucket with retention lock so even admins can’t delete it. Don’t give developers roles/logging.admin.
Security Command Center
Security Command Center (SCC) is the central security and risk platform. It is activated at the organisation level.
| Tier | Includes |
|---|---|
| Standard | Basic posture detections (a limited set of Security Health Analytics detectors), free |
| Premium | Full SHA, Event Threat Detection, Container Threat Detection, VM Threat Detection, Web Security Scanner (managed and custom), Rapid Vulnerability Detection, attack path simulation and attack exposure scores, compliance dashboards, Posture Management, CIEM (entitlement risk), Sensitive Data Protection discovery, custom modules, AI Protection |
| Enterprise | Premium plus multi-cloud (AWS, Azure), case management and SOAR playbooks via Google Security Operations, SIEM, and toxic-combination and risk correlation across clouds |
Key detectors:
| Service | Detects |
|---|---|
| Security Health Analytics | Misconfigurations: public bucket, open firewall, no MFA, unencrypted disk, service account key age, default SA usage |
| Event Threat Detection | Threats from logs: anomalous IAM grant, brute force, malware communication, crypto-mining DNS lookups, data exfiltration |
| Container Threat Detection | Runtime attacks in GKE (added binary executed, reverse shell, malicious scripts) |
| VM Threat Detection | Hypervisor-level memory scan for cryptominers and rootkits, no agent |
| Web Security Scanner | XSS, mixed content, outdated libraries in App Engine, GKE and Compute web apps |
| Cloud Infrastructure Entitlement Management | Over-privileged identities and risky grants |
Working with findings:
- Findings have severity, state (ACTIVE / INACTIVE), a category, the resource, and security marks. Mute rules hide known-accepted findings (static or dynamic). Filter by attack exposure.
- Export: continuous exports to Pub/Sub and BigQuery, and notifications (NotificationConfig with a filter) to Pub/Sub for automation.
- Roles:
securitycenter.admin,securitycenter.adminEditor,findingsViewer,findingsEditor. Grant narrowly. Use folder or project-level roles for teams. - Compliance dashboard maps findings to CIS Benchmarks, PCI DSS, NIST 800-53, ISO 27001.
- Remediate by workflow: finding to Pub/Sub, to Cloud Run or a Workflows definition, to fix (for example remove a public IAM binding), with human approval for risky actions.
Incident response on Google Cloud
- Detect: SCC finding, log alert, Cloud IDS alert.
- Contain: isolate a VM with a deny-all firewall rule using a secure tag or service account target, remove external IP, remove or disable service account keys, revoke sessions, suspend a user, remove IAM bindings.
- Preserve evidence: snapshot the disk (and memory if needed) into a separate forensics project, keep logs in a locked bucket. Don’t terminate the VM before snapshotting if you need disk evidence.
- Investigate: Log Analytics SQL across audit and flow logs, SCC attack paths, Cloud Asset Inventory history (what changed and when).
- Eradicate and recover: rebuild from a clean image, rotate secrets and keys, patch root cause.
- Learn: update detections and org policies.
Choosing the control
| Need | Pick |
|---|---|
| Only signed, scanned images run on GKE | Binary Authorization with attestors |
| Fail the build on critical CVEs | On-demand scanning in Cloud Build |
| Roll out OS patches on a schedule | VM Manager patch deployments |
| Who read a particular secret last week | Data Access audit logs (must be enabled) |
| Every project’s logs in one place, tamper-proof | Org aggregated sink to a locked log bucket |
| Send logs to Splunk | Pub/Sub sink and Dataflow |
| Full packet capture of a few VMs | Packet Mirroring |
| Managed network threat detection | Cloud IDS |
| Find misconfigurations at scale | SCC Security Health Analytics |
| Custom misconfiguration rule | SHA custom module (detect) or custom org constraint (prevent) |
| Page security on a high-severity finding | SCC notification to Pub/Sub |
Common traps
- Data Access logs are off by default and not retroactive.
- Admin Activity cannot be turned off, and the
_Requiredbucket can’t be changed. - Sinks need their writer identity granted. Exclusions apply before storing.
- Cloud IDS only alerts. It’s not a firewall.
- Binary Authorization checks at deploy, not running Pods unless continuous validation is used.
- Rotating an image tag doesn’t re-trigger attestation, so use digests.
- SCC Standard doesn’t include threat detection services.
Exam checklist
- Add scanning, provenance and Binary Authorization to a pipeline, with dry-run and break-glass.
- Build, harden, patch and restrict VM and container images.
- Prevent versus detect: org policies, custom constraints, SHA custom modules, Posture Management.
- Enable the right audit log types and use correct viewer roles.
- Configure sinks and aggregated sinks, buckets, retention, Log Analytics, SIEM export.
- Select VPC Flow Logs, firewall logs, Packet Mirroring and Cloud IDS correctly.
- Describe SCC tiers, detectors, mute rules, exports and automated response.
- Walk through containment and evidence preservation.