Q: You need to enforce that every Docker image pushed to your internal container registry has been scanned for CVEs and has zero Critical severity vulnerabilities. How do you implement this as a hard gate in the CI pipeline and in the registry itself?
CI pipeline gate:
Want to master this scenario in a live sandbox? KodeKloud's Enterprise GitOps with ArgoCD & Kubernetes Rollouts covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "During a high-stakes release, we hit a similar deployment challenge and resolved it with automated safeguards. The interviewer is testing: Container image scanning, registry admission controls, Trivy or Grype in CI.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Initial Diagnostics & Root Cause Analysis
CI pipeline gate:
- ECR: Enable Enhanced Scanning (powered by Inspector). Set a lifecycle policy to deny pull of images tagged
:latestthat have Critical findings. - Harbor: Enable the Interrogation Service with Trivy. Set a project-level rule: "Prevent vulnerable images from running" at Critical threshold. Images failing the gate cannot be pulled by Kubernetes — the
imagePullPolicyfails, preventing deployment.
Remediation & Permanent Safeguards
--exit-code 1 makes the job fail if any unfixed Critical CVEs are found. --ignore-unfixed skips CVEs where no upstream patch yet exists (reduces noise). Registry-level enforcement: Configure the registry (ECR, Harbor, or Artifactory) to enforce a scan policy:
- name: Scan image for CVEs
run: |
trivy image --exit-code 1 --severity CRITICAL \
--ignore-unfixed \
${{ env.IMAGE_TAG }}
- ECR: Enable Enhanced Scanning (powered by Inspector). Set a lifecycle policy to deny pull of imag...
- Harbor: Enable the Interrogation Service with Trivy. Set a project-level rule: "Prevent vulnerabl...
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Promoting application releases to production without an automated, canary-validated rollback mechanism when configuring need enforce every Pipelines that lack automated rollback mechanisms force engineering teams to scramble manual hotfixes during severe production regressions.
- Running concurrent deployment pipeline jobs without stage mutex locking on shared target environments when configuring need enforce every Concurrent pipeline runs on the same environment race to apply state changes, causing out-of-order commits and unpredictable deployment state.
- Omitting dependency lockfiles (package-lock.json, go.sum, Cargo.lock) from continuous integration builds when configuring need enforce every Omitting lockfiles allows upstream package updates to break builds unpredictably without any changes to application codebase.
- Failing to define dynamic cache invalidation keys for CI package managers and layer caches when configuring need enforce every Stale build caches mask underlying dependency incompatibilities or pull outdated libraries, while un-cached runs slow feedback loops.