Acme Corp Cloudflare Cloud Workload Security demo

The lab

One Ubuntu VM and one Cloudflare account. Terraform configures Cloudflare; the VM runs everything else in Docker. Nothing here talks to AWS.

Git repository, runner and job containers on the left; the CWS proxy in the middle, configured from the Cloudflare account; the AWS Emulator and the Cloudflare API on the right.
Every cloud API call goes through the CWS proxy - or, for the before half of each demo, around it.

What runs where

ComponentWhat it isWhere
CWS proxyThe cws-proxy package from Cloudflare's APT repository, in a container. Loads deployment - every 30 seconds.VM, cws-proxy:8080
AWS EmulatorAWS's own local emulator of the AWS APIs, generated from the same models as the SDKs. In memory.VM, internal only
aws-edgePresents a certificate for *.amazonaws.com and forwards to the emulator.VM, internal only
Lab DNSAnswers every *.amazonaws.com name with aws-edge's address.VM, internal only
Git server + runnerThis lab runs GitLab with a docker-executor runner: acme/acme-infra, with jobs on the lab network. Setup picks GitLab on a VM with 8 GB of RAM or more, and Gitea with its Actions runner on a smaller one - the demo is the same.VM,
Exfiltration testNode and the AWS SDK for JavaScript, unmodified.VM,
This guideA public, assets-only Worker, deployed from the VM with this lab's lab.json - nothing secret in it.Workers,
cloudflaredCloudflare Tunnel: the only way in to the exfiltration test and the git server, both behind Access.VM, outbound only
CWS configurationDeployment, policy sets, policies, workloads, Rego module and metadata, domain ACL, Basic Auth credentials.Cloudflare account, by Terraform

How AWS is emulated - and why it matters

The CWS proxy classifies a request by its destination. It knows s3.us-east-1.amazonaws.com; it does not know 172.30.0.10:9297, and a request to a host it does not recognise is passed through untouched. So pointing the AWS CLI at the emulator with AWS_ENDPOINT_URL, as the emulator's docs suggest, would make every demo here meaningless.

Instead, every client calls AWS exactly as it would in production, and the lab redirects it underneath:

  1. The lab's DNS answers every *.amazonaws.com name with the address of aws-edge.
  2. aws-edge presents a certificate for those names, signed by the lab's own Lab AWS Emulator CA.
  3. It forwards to the emulator, which runs with signature checks off because the Host header has changed.
  4. Clients trust one bundle: the system roots, the CWS proxy's CA and the Lab AWS CA - so the same client works through CWS or straight to "AWS".

The result: the requests the proxy sees are byte-for-byte what it would see in front of real AWS.

If someone asks whether this is real

The proxy, the policies and the Cloudflare API calls are the real product against a real account. The AWS responses come from the AWS Emulator, which AWS publishes and measures against real AWS. CWS makes its decision before the request reaches either, so the emulator cannot change what CWS does.

How the proxy gets into the path

A CI job and the exfiltration test both use the standard HTTPS_PROXY variable and trust the proxy's CA - the pattern the CWS docs describe for CI/CD runners and application hosts. Nothing else changes: no SDK plugin, no code change.

variables:
  HTTPS_PROXY: "http://ci-pipeline:${CWS_PROXY_PASS}@cws-proxy:8080"
  AWS_CA_BUNDLE: /certs/lab-trust.pem

In production the variable is not the control. Egress from the runners is limited to the proxy - with Gateway, a firewall or a security group - so a job that drops the variable reaches nothing; and the deployment's domain ACL limits the proxy to cloud API hostnames. The demo's CWS_BYPASS switch exists only to show the before.

The resources

S3SQSSNSKinesisDynamoDB
Acme's own - approvedacme-corp-dataacme-ordersacme-alertsacme-clickstreamacme-customers
The attacker's - outside the perimeterexfil-drop-bucketexfil-drop-queueexfil-drop-topicexfil-drop-streamexfil-drop-table

The data perimeter's approved list: acme-corp-data, acme-website-assets, acme-orders, acme-alerts, acme-clickstream, acme-customers. acme-website-assets is created by the pipeline.

All in the emulator's single AWS account, 000000000000. Seeded by the exfiltration test whenever they are missing, so an emulator restart heals itself.

acme-infra

infrastructure.jsonSafeUnsafeBlocked by
aws.website_bucket.publicfalsetrueaws-s3-no-public-buckets
aws.orders_queue.encryptedtruefalseaws-sqs-encryption-required
aws.deploy_role.managed_policy…/ReadOnlyAccess…/AdministratorAccessaws-iam-no-admin
cloudflare.assets_bucket.publicfalsetruecf-r2-no-public-access
cloudflare.origin_record.proxiedtruefalsecf-dns-proxied-only

CI/CD variables on the project: CWS_PROXY_PASS (masked), CF_API_TOKEN (masked), CF_ACCOUNT_ID, CF_ZONE_ID, CF_ZONE_NAME, example AWS keys, and CWS_BYPASS.

Proxy identities

Basic Auth identityUsed by
ci-pipelineCI jobs in acme/acme-infra, on GitLab or Gitea
workstationThe exfiltration test, and cws-lab shell on the VM

Known differences from production

Open the exfiltration test's Lab page for the same details from inside the app.