Container Security
Secure container images, registries, runtime, and orchestration for "$ARGUMENTS". Assess the full container lifecycle from image build to production runtime and define security controls at each stage.
Prerequisites
Read .metapowers/security/$ARGUMENTS/00-govern.md. If this file does not exist, tell the user:
Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., /security:security-policy $ARGUMENTS), or use --skip-checks to bypass.
If --skip-checks is present in $ARGUMENTS, skip this check and log to .metapowers/security/$ARGUMENTS/skip-log.md.
Process
Assess base image selection:
- Verify base images are minimal (Alpine, distroless, or slim variants preferred)
- Confirm base images are from official, trusted sources
- Check base image update frequency and vulnerability patching cadence
- Identify custom base images and their maintenance process
Review Dockerfile best practices:
- Run as non-root user (USER directive)
- Use multi-stage builds to minimize final image size and attack surface
- No secrets in image layers (no COPY of .env files, no ARG for passwords)
- Pin dependency versions (no
latest tags for base images or packages)
- Minimize installed packages (no build tools in production images)
- Use
.dockerignore to prevent sensitive files from being included in build context
Plan image scanning:
- Select scanning tools (Trivy, Snyk Container, Grype, Clair)
- Integrate scanning into CI/CD pipeline (fail build on critical/high vulnerabilities)
- Define scanning cadence for images already in production (catch newly discovered CVEs)
- Set vulnerability thresholds (block critical, warn on high, track medium)
Secure container registry:
- Use private registry with access controls (not public Docker Hub for proprietary images)
- Enable image signing and verification (Docker Content Trust, cosign/Sigstore)
- Implement image promotion workflow (dev -> staging -> production with gates)
- Set image retention and cleanup policies
- Enable vulnerability scanning at registry level
Harden runtime security:
- Run containers with read-only root filesystem where possible
- Set resource limits (CPU, memory) to prevent resource exhaustion attacks
- Drop all Linux capabilities and add back only those required
- Use seccomp and AppArmor/SELinux profiles to restrict system calls
- Disable privilege escalation (no-new-privileges flag)
Secure orchestration (Kubernetes):
- Implement Kubernetes RBAC with least-privilege service accounts
- Enforce Pod Security Standards (restricted level for production workloads)
- Define network policies to restrict pod-to-pod communication
- Use namespaces for multi-tenant isolation
- Secure the Kubernetes API server (authentication, audit logging, admission controllers)
- Implement admission controllers (OPA/Gatekeeper, Kyverno) to enforce policies
Write the artifact to .metapowers/security/$ARGUMENTS/02-protect.md with heading:
Container Security
Include sections:
- Base Image Assessment — current base images, sources, and update practices
- Dockerfile Review — findings on build best practices
- Image Scanning — tool selection, CI/CD integration, and vulnerability thresholds
- Registry Security — access controls, signing, and promotion workflow
- Runtime Hardening — resource limits, capability restrictions, and filesystem policies
- Orchestration Security — RBAC, pod security, network policies, and admission control
- Implementation Roadmap — prioritized actions from quick wins to long-term hardening
Output
The container security plan written to .metapowers/security/$ARGUMENTS/02-protect.md. Present a summary to the user highlighting:
- Current container security posture and key gaps
- Image scanning integration plan
- Runtime hardening priorities
- Orchestration security controls to implement
1---2name: container-security3description: Secure container images, registries, runtime, and orchestration4---56# Container Security78Secure container images, registries, runtime, and orchestration for "$ARGUMENTS". Assess the full container lifecycle from image build to production runtime and define security controls at each stage.910## Prerequisites1112Read `.metapowers/security/$ARGUMENTS/00-govern.md`. If this file does not exist, tell the user:1314> Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., `/security:security-policy $ARGUMENTS`), or use `--skip-checks` to bypass.1516If `--skip-checks` is present in $ARGUMENTS, skip this check and log to `.metapowers/security/$ARGUMENTS/skip-log.md`.1718## Process19201. **Assess base image selection:**21 - Verify base images are minimal (Alpine, distroless, or slim variants preferred)22 - Confirm base images are from official, trusted sources23 - Check base image update frequency and vulnerability patching cadence24 - Identify custom base images and their maintenance process25262. **Review Dockerfile best practices:**27 - Run as non-root user (USER directive)28 - Use multi-stage builds to minimize final image size and attack surface29 - No secrets in image layers (no COPY of .env files, no ARG for passwords)30 - Pin dependency versions (no `latest` tags for base images or packages)31 - Minimize installed packages (no build tools in production images)32 - Use `.dockerignore` to prevent sensitive files from being included in build context33343. **Plan image scanning:**35 - Select scanning tools (Trivy, Snyk Container, Grype, Clair)36 - Integrate scanning into CI/CD pipeline (fail build on critical/high vulnerabilities)37 - Define scanning cadence for images already in production (catch newly discovered CVEs)38 - Set vulnerability thresholds (block critical, warn on high, track medium)39404. **Secure container registry:**41 - Use private registry with access controls (not public Docker Hub for proprietary images)42 - Enable image signing and verification (Docker Content Trust, cosign/Sigstore)43 - Implement image promotion workflow (dev -> staging -> production with gates)44 - Set image retention and cleanup policies45 - Enable vulnerability scanning at registry level46475. **Harden runtime security:**48 - Run containers with read-only root filesystem where possible49 - Set resource limits (CPU, memory) to prevent resource exhaustion attacks50 - Drop all Linux capabilities and add back only those required51 - Use seccomp and AppArmor/SELinux profiles to restrict system calls52 - Disable privilege escalation (no-new-privileges flag)53546. **Secure orchestration (Kubernetes):**55 - Implement Kubernetes RBAC with least-privilege service accounts56 - Enforce Pod Security Standards (restricted level for production workloads)57 - Define network policies to restrict pod-to-pod communication58 - Use namespaces for multi-tenant isolation59 - Secure the Kubernetes API server (authentication, audit logging, admission controllers)60 - Implement admission controllers (OPA/Gatekeeper, Kyverno) to enforce policies61627. **Write the artifact** to `.metapowers/security/$ARGUMENTS/02-protect.md` with heading:6364 ## Container Security6566 Include sections:67 - **Base Image Assessment** — current base images, sources, and update practices68 - **Dockerfile Review** — findings on build best practices69 - **Image Scanning** — tool selection, CI/CD integration, and vulnerability thresholds70 - **Registry Security** — access controls, signing, and promotion workflow71 - **Runtime Hardening** — resource limits, capability restrictions, and filesystem policies72 - **Orchestration Security** — RBAC, pod security, network policies, and admission control73 - **Implementation Roadmap** — prioritized actions from quick wins to long-term hardening7475## Output7677The container security plan written to `.metapowers/security/$ARGUMENTS/02-protect.md`. Present a summary to the user highlighting:78- Current container security posture and key gaps79- Image scanning integration plan80- Runtime hardening priorities81- Orchestration security controls to implement