Demo library › Chapter 2
A pipeline tries to make a bucket public
A one-line change to acme-infra would make an S3 bucket world-readable. Cloud Workload Security blocks the API calls in the pipeline - with no plugin, no policy file in the repository and no change to the deployment scripts.
The problem
Pipelines hold the broadest cloud credentials in most companies, and the people who change what they deploy are developers, not cloud security. A single line in a config file can make a bucket public.
The usual answers all leave a gap. IAM can say who may change a bucket, not what they may change it to. SCPs are organisation-wide and blunt. Posture scanning finds the public bucket after it is public. And checks inside the pipeline live in the repository, where the developer they are meant to stop can delete them.
Lands with: platform engineering, DevSecOps, cloud security - anyone who owns a CI/CD platform
Before you start
- Signed in to the git server (GitLab) as
root- the password is on the exfiltration test's Lab page, orsudo cws-lab statuson the VM. - acme-infra open, and the latest pipeline is green - if not, see Setup.
infrastructure.jsonhas"public": falseunderaws.website_bucket.
Run it
An ordinary pipeline
| Do | Say |
|---|---|
In acme-infra, open .gitlab-ci.yml. | An ordinary GitLab pipeline: plan, then deploy to AWS and to Cloudflare with plain CLI calls. The only Cloudflare thing in it is this line - HTTPS_PROXY. No plugin, no policy file, nothing to install on the runner. |
Open infrastructure.json. | All of Acme's infrastructure: a website bucket, an orders queue, a deployment role, and some Cloudflare settings. Change this file, and the pipeline applies it. |
| Build → Pipelines → the latest pipeline → deploy-aws. | Every one of these AWS calls went through Cloud Workload Security and was allowed. Guardrails you don't notice when you're doing the right thing. |
Whybackground, if you are asked
The proxy URL carries the ci-pipeline Basic Auth identity, with its password in a masked CI/CD variable. That identity is what lets a policy treat pipelines differently from people - see Different guardrails for pipelines and people.
A risky change
| Do | Say |
|---|---|
Open infrastructure.json → Edit → Edit single file. Set aws.website_bucket.public to true and commit to main with the message Serve website assets straight from S3. | A developer wants to serve the website straight from S3. Reasonable request, one-line change, and it makes the bucket readable by the whole internet. |
| Build → Pipelines → the new pipeline → deploy-aws, once it has run. | The pipeline tried to remove the bucket's public access block, then to attach a public bucket policy. Both were blocked - here, before they reached AWS - and the job failed with a clear reason. |
| Point at the steps above and below the banners. | Everything else in the job still ran: the website uploaded, the queue was updated. CWS judges each API call on what it does, not the whole job. |
Whybackground, if you are asked
The policy is aws-s3-no-public-buckets. It looks at the operation and the request itself: DeletePublicAccessBlock is always refused, PutPublicAccessBlock is refused if any of its four flags is false, PutBucketPolicy is refused if the principal is everyone. Its Rego is on the Policies page.
What would have happened
| Do | Say |
|---|---|
Build → Pipelines → Run pipeline. Add the variable CWS_BYPASS with value true, and run. | Now the same pipeline with the proxy taken away - which is what most companies have today. |
| Open the bypass run's deploy-aws job. | Straight through. The bucket is public, and the first anyone hears of it is a posture scanner tomorrow, or a researcher next month. |
Edit infrastructure.json back to "public": false and commit. | Fixed - and the next run puts the public access block back. |
Whybackground, if you are asked
CWS_BYPASS just unsets HTTPS_PROXY in the job, so the demo can show the before. In production you would not leave that choice to the developer: the runners' egress is limited to the proxy - with Gateway, a firewall or a security group - so a job that drops HTTPS_PROXY reaches nothing. The deployment's domain ACL then limits the proxy itself to cloud API hostnames.
What the audience should see
- A green pipeline with every call allowed.
- A failed deploy-aws with two red BLOCKED banners, while the other steps in the same job succeed.
- The bypass run succeeding, which is the risk CWS removes.
Where the evidence is
The Proxy decisions page: the denied DeletePublicAccessBlock and PutBucketPolicy, from the ci-pipeline identity. On the VM, sudo cws-lab decisions.
Known limitations
The bypass run really does attach a public policy to the emulated bucket. The revert commit puts the public access block back but leaves that bucket policy, which is harmless in the emulator and is cleared by sudo cws-lab reset --emulator.
Rules IAM cannot write - the same pipeline, two more guardrails. Guardrails for the Cloudflare API - the other half of this pipeline.
Part of: Cloud Workload Security in 20 minutes · Guardrails for every pipeline