Golden Image Pipeline Hardening Prompt
Harden the build pipeline that produces golden VM images (AMIs/Packer templates) — provenance, hardening baselines, vulnerability gates, and signing — so every instance starts from a trusted, minimal base.
- Target user
- Platform engineers who own image-build pipelines and base OS templates
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform security engineer who hardens golden-image build pipelines. This is a defensive review — strengthen how trusted base images are built, scanned, and distributed. No attacker tooling. I will provide: - The image build tool and definition (Packer, image-builder, Dockerfile-for-VMs) - The build environment (CI runner, network, credentials) - Hardening baseline targeted (CIS, STIG, internal) - How images are versioned, scanned, and consumed downstream Harden the pipeline through these steps: 1. **Trusted base & provenance** — verify the source base image is from a trusted publisher with a verified checksum/signature. Pin versions; reject floating "latest" bases. 2. **Minimal footprint** — remove default accounts, unused packages, sample services, and build-time tooling from the final image. Smaller surface, fewer CVEs. 3. **Baseline hardening** — apply and verify the chosen baseline (CIS/STIG): disabled root login, no password SSH, kernel parameters, file permissions, audit daemon, time sync. Produce a compliance scan as a build step. 4. **Vulnerability gate** — scan the built image (e.g., Trivy/Grype) and fail the build on policy-violating severities. Allow documented, time-bound exceptions only. 5. **No baked secrets** — ensure no credentials, SSH keys, or tokens are embedded; build-time secrets must be ephemeral and scrubbed. Scan the final image for secrets. 6. **Build environment integrity** — isolated, ephemeral runners; short-lived OIDC credentials; pinned provisioner scripts fetched from verified sources; no `curl | bash` from unpinned URLs. 7. **Sign & attest** — sign the image and emit a build attestation/SBOM so consumers can verify provenance before launch. Enforce that only signed images can deploy. 8. **Lifecycle** — expiry/rotation policy so stale, unpatched images can't be launched indefinitely. Output as: (a) a hardening findings table (stage, issue, fix), (b) a hardened pipeline outline with the security gates inserted, (c) a consumer verification checklist (signature + SBOM + age). Bias toward minimal images, fail-the-build vulnerability gates, and signed, attested artifacts.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
npm Lockfile Supply-Chain Audit Prompt
Review a package-lock.json or pnpm-lock.yaml for supply-chain risk: unpinned versions, suspicious registries, install scripts, and dependency confusion exposure
-
Terraform Provider Checksum Verification Prompt
Review the Terraform dependency lock file and provider sourcing for missing checksums, unpinned versions, untrusted mirrors, and supply-chain tampering risk
-
Package Repository & GPG Signing Trust Review Prompt
Audit apt/yum/dnf repository configuration and GPG/key trust to catch unsigned repos, insecure HTTP mirrors, stale or overly broad signing keys, and gaps that allow malicious package injection.
-
Helm Chart Security Review Prompt
Review a Helm chart and its values for insecure Kubernetes defaults — privileged containers, missing securityContext, hostPath mounts, and risky RBAC — before it ships to a shared cluster.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.