Gatekeeper: secure CI/CD delivery chain
A small containerised Flask API. The app is the thing delivered; the chain around it is the project.
Every change passes security gates before an image can reach Amazon ECR, and no AWS key is stored anywhere.
- GitHub Actions pipeline with gitleaks, Semgrep, Trivy on dependencies and on the image, Checkov, an OWASP ZAP baseline and a CycloneDX SBOM.
- Terraform for the S3 state bucket, ECR, and a GitHub OIDC role that trusts one repository and one branch.
- Deployment tested in a kind cluster under Pod Security restricted with NetworkPolicy. The image is built once and tagged with the commit SHA.
What broke and how I fixed it
- The first image was 1.11 GB with 344 HIGH and CRITICAL CVEs. A hardened Dockerfile brought it to 125 MB, 44 HIGH and 0 CRITICAL.
- Trivy found 3 HIGH CVEs in Flask and Werkzeug. Upgrading brought it to 0.