---
title: "Code to cloud"
description: "Tie image findings to the Kubernetes workloads, Lambda functions and ECS, Cloud Run or Azure containers running that build, and see how it moves risk."
---

A scan tells you what is wrong with one build of an image. A collection tells
you which builds are running where. Code to cloud joins the two, so a finding
can say "running in 3 workloads, one of them reachable from the internet"
rather than leaving you to work that out.

## What is recorded

Every collection of a connected cluster or cloud account records each running
container image, one row per running digest, in a **running-image index**:

| Source | What is read | Running digest | Exposure |
|---|---|---|---|
| Kubernetes | Every workload's pods. A Deployment's pods are traced to it through their ReplicaSet's `pod-template-hash`; StatefulSet, DaemonSet, Job and bare pods directly | The kubelet's `imageID` for each container | Services and Ingresses (below) |
| AWS Lambda | Functions whose package type is `Image`, through `lambda:GetFunction` | The `ResolvedImageUri` Lambda fixed at deploy time | A function URL with no authentication |
| Amazon ECS | Every running task in every cluster, Fargate and EC2, through `ecs:DescribeTasks`. A service's tasks are recorded against the service, a standalone task against its task definition | The `imageDigest` the ECS agent reports for each container | An internet-facing load balancer in front of the service, or a public IP on its tasks |
| Google Cloud Run | Every revision serving traffic, through the Admin API (v2 services, v1 revisions) | The revision's `imageDigest`, for a single-container revision | Ingress open to all traffic with `allUsers` or `allAuthenticatedUsers` as invoker, or the invoker check disabled |
| Azure Container Instances | Every container group that is not stopped | Not reported by Azure | A public IP address |
| Azure Container Apps | Every app that is not stopped, from its template (the latest revision) | Not reported by Azure | External ingress on an environment that is not internal |

When a platform reports no digest, the container is matched by tag, unless its
image reference is pinned by digest (`image@sha256:…`), which is the digest it
runs.

### What each platform's exposure means

| Platform | Internet exposed | Not exposed | Unknown |
|---|---|---|---|
| Amazon ECS | An internet-facing ALB or NLB routes to the service, or `assignPublicIp` is `ENABLED` (security groups are not evaluated) | Every load balancer is internal and the tasks run in `awsvpc` mode without a public IP | A task on an EC2 host outside `awsvpc` mode (its host ports are not read), a Classic Load Balancer, a load balancer this run did not collect, a standalone task |
| Google Cloud Run | Ingress `all` and anyone may invoke | Ingress internal only or none; ingress `all` with IAM authentication required (a public URL that refuses anonymous callers) | Ingress through Cloud Load Balancing, or the default URL disabled: the load balancer is not read |
| Azure Container Instances | A public IP, with its ports | A private IP in a virtual network, or no IP | |
| Azure Container Apps | External ingress on an environment that is not internal (IP restrictions are not evaluated) | No ingress, ingress inside the environment, or external ingress on an internal environment | The environment could not be read |

The exposure text names the workload, so a finding's risk breakdown reads, for
example, "exposed: ECS service prod/api: internet-facing load balancer web".

### Limits of the serverless sources

- **Not read:** AWS App Runner, Google Cloud Functions, Azure Functions and App
  Service containers.
- **ECS:** up to 5,000 running tasks per region per collection; past that the
  rest are not recorded. Exposure is read from services; a standalone task's is
  unknown.
- **Cloud Run:** Cloud Run reports one digest per revision, so a revision with
  several containers is matched by tag. Cloud Run jobs are not read. Up to 500
  revision and invoker-policy reads per collection.
- **Container Apps:** in multiple-revision mode, an older revision still taking
  traffic is not seen.
- **Container Instances:** the listing may not report a group's state, so a
  finished group can still be recorded until it is deleted.
- **A refused read is not a failed collection.** These reads feed code to cloud
  only, so a policy or role without them still collects and evaluates in full.
  The collection then records what it could read and removes nothing, so a
  running container recorded earlier stays until a complete collection no
  longer sees it.

The permissions are in [Cloud posture](/configuration/cloud-posture#read-only-access-to-grant):
five ECS actions and `elasticloadbalancing:DescribeTargetGroups` on AWS; on
Google Cloud and Azure the reads are inside roles/viewer and Reader.

A workload with no pods (a Deployment scaled to zero, a CronJob between runs)
is not running and is not recorded. A Deployment in the middle of a rollout
runs two builds and is recorded twice. A complete collection replaces what the
location ran before; a partial one adds what it saw and removes nothing.

Not read yet in a cluster: Gateway API routes and service meshes.

## How a running image is matched to a scan

1. **By digest.** The running digest is one the image's latest successful scan
   recorded: the digest the scanner resolved, or the registry's digest for the
   scanned tag. For a multi-arch tag the scan also records the platform
   manifests of the index, so a workload pinned to one platform's digest still
   matches the scan of the tag. A digest match says the running build is the
   scanned build.
2. **By tag, labelled weaker.** When no digest matches, a running image whose
   reference names the same image and tag matches it. The page and the risk
   breakdown say "tag only". When both sides know their digest and they differ,
   it says the running build differs from the scanned one: the findings shown
   describe the scanned build, and you should scan the running digest.

A running image that matches by digest is not also matched by tag to another
asset that only shares its tag.

Matches are recomputed after every collection and after every successful image
scan.

## Exposure and privilege

In a cluster, a workload is **internet exposed** when a Service of type
`LoadBalancer` selects its pods, or an Ingress routes to a Service that does. A
LoadBalancer carrying the EKS, GKE or AKS internal annotation is not. A
`NodePort`, a host port and the host network are recorded as paths in, but not
as internet exposure, because whether a node's address is public is not
something the cluster's API says. **Privileged** means a container sets
`privileged: true` or the pod uses the host network.

Reading exposure needs `get` and `list` on `services` and
`networking.k8s.io/ingresses`, which the ClusterRole in the **Connect cluster**
dialog includes. A cluster connected with an older role still collects in full;
its exposure shows as **unknown**, which is never scored or filtered as "not
exposed". See [Kubernetes posture](/configuration/kubernetes-posture#permissions-the-collector-needs).

## Where you see it

- **An image's page** lists where it runs: each workload, function or
  serverless service, its cluster or account, the running digest, how it
  matched, and its exposure. A Lambda function, ECS service or task definition,
  Cloud Run service, container group or container app links to its page in the
  AWS console, Google Cloud console or Azure portal.
- **A workload's or cloud resource's page** lists the images it runs, each with
  the matched image's open findings by severity.
- **A cluster's or cloud account's page** lists everything running there.
- **Findings** has **Running** and **Internet exposed** filters (`running=true`
  and `exposed=true` on `GET /api/v1/findings`).
- The API: `GET /api/v1/assets/{id}/runtime` returns up to 200 placements.

## How it moves the risk score

Three factors of the [risk score](/concepts/risk-scoring) read the index:

| Factor | Points |
|---|---|
| Running | 15 when a running build matched; 7.5 for a tag match on a build known to differ; 0 when nothing connected runs it |
| Internet exposure | 10 when a workload running the build is internet exposed |
| Privilege | 5 when a workload running the build is privileged or on the host network |

Exposure and privilege count only for a running build. An image no connected
location runs keeps every other point and stays in the backlog: lower, never
hidden. The breakdown says how many workloads run it and whether the match was
by digest or by tag.

## What has been verified

The matching rules are unit tested (digest, tag, a tag match on a different
build, an index digest, a platform digest of a scanned index, a digest shared
by two tags). The Kubernetes reading is tested against fixtures shaped like the
API server's responses, and the cluster collection, the matching, the risk pass
and the filters against a real PostgreSQL. The platform-manifest listing is
tested against an in-process OCI registry. The Lambda, ECS, Cloud Run,
Container Instances and Container Apps readings are tested against recorded
provider responses, not live accounts, and a serverless observation is carried
through the index, the match and the risk pass against a real PostgreSQL.
