---
id: dockerfile-compose-security
track: coding
version: 0.2.1
label: blocks
keyword: block
where: write turn-end
sha256: dd62fbc4efb722b24dbc69281432fb44c6521c9e6af34787ba2839c626264427
source: https://github.com/open-coder-ai/chock-catalog/tree/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4/base/dockerfile-compose-security
catalog_ref: e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4
---

# Dockerfile and Compose Security

dockerfile-compose-security · version 0.2.1

Blocks — Blocks on an agent's file writes and at turn end. Chock adds friction. It is not a security boundary. 

In a git repo: at commit (Chock refuses the commit, locally and in CI.)



## What it does

Blocks (some rules ask) when a change to a Dockerfile, Containerfile or compose file adds: a base image with no tag, a floating tag (latest, stable, edge, lts) or an unresolvable ARG; a final stage running as root; TLS or signature checks off; secret ENV/ARG/environment literals; COPY of key or .env files; remote ADD without checksum; fetch piped to a shell; RUN --security=insecure; chmod 777 or setuid; sudo, sshd, chpasswd; unpinned git clone; ONBUILD RUN; compose privileged, broad cap_add, unconfined profiles, devices, host namespaces, runtime socket or host-root mounts, DB ports on every interface. A one-line form goes to block-fetch-exec-in-files, block-unpinned-agent-components or agentic-code-security only where that gate is installed and reads the file; scan-secrets lines always. Misses: digest pinning (a version tag passes), build args overriding defaults, commands in variables, aliases or $'' quoting, bake and k8s files, extends or include, other file names, a moved file. Friction, not a boundary.

## Its label on each agent

- Claude Code (tested): Blocks — Blocks on an agent's file writes and at turn end. Builder: /coding/builder/#client=claude-code&p=dockerfile-compose-security
- Cursor (tested): Blocks — Blocks on an agent's file writes and at turn end. Where its description says it asks, it refuses at both points, because this client cannot prompt at either point. Builder: /coding/builder/#client=cursor&p=dockerfile-compose-security
- Codex (tested): Blocks — Blocks on an agent's file writes and at turn end. Where its description says it asks, it refuses at both points, because this client cannot prompt at either point. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run). Builder: /coding/builder/#client=codex&p=dockerfile-compose-security
- GitHub Copilot (tested): Blocks — Blocks at turn end only. It does not check a file write when it happens. Where its description says it asks, it refuses at turn end, because this client cannot prompt there. If the hook errors, the action goes through (not witnessed; the vendor's row is only partly live-run). Builder: /coding/builder/#client=copilot&p=dockerfile-compose-security
- Devin (tested): Blocks — Blocks at turn end only. It does not check a file write when it happens. Where its description says it asks, it refuses at turn end, because this client cannot prompt there. If the hook errors, the action goes through (vendor docs only, not witnessed). Builder: /coding/builder/#client=devin&p=dockerfile-compose-security
- Grok (tested): Not graded yet for Grok. Builder: /coding/builder/#client=grok&p=dockerfile-compose-security
- goose (tested): Not graded yet for goose. Builder: /coding/builder/#client=goose&p=dockerfile-compose-security
- Antigravity (tested): Not graded yet for Antigravity. Builder: /coding/builder/#client=antigravity&p=dockerfile-compose-security
- OpenHands (untested): Not graded yet for OpenHands. Builder: /coding/builder/#client=openhands&p=dockerfile-compose-security
- Kimi Code (untested): Not graded yet for Kimi Code. Builder: /coding/builder/#client=kimi-code&p=dockerfile-compose-security
- Factory Droid (untested): Not graded yet for Factory Droid. Builder: /coding/builder/#client=factory-droid&p=dockerfile-compose-security

## What it misses

Digest pinning (a version tag passes), build args overriding defaults, commands in variables, aliases or $'' quoting, bake and k8s files, extends or include, other file names, a moved file.

## Examples

- Refused: A commit adds a Dockerfile whose only stage is built FROM an untagged image.
- Allowed: A commit adds a Dockerfile pinned by digest, built FROM an earlier stage, running as a non-root user.

## Latest change

0.2.1 · 2026-11-15 — Hardening from the infra review (org-plan witness/reviews/2026-11-15-policy-hardening/REVIEW-infra.md, section 2.1 and 3; tests in test_dockerfile_compose_review.py). Behaviour change: a person's \`# chock: allow \<rule-id\>\` is honoured at push and ci as at commit (it was commit only, so a reviewed exception passed the hook and failed the pipeline); an agent's commit, write and the turn's end still refuse it. Behaviour change: the rules dk-from-no-digest and cm-image-no-digest are removed. They asked on the commonest correct image reference (a version tag without a digest), the gate has no warn tier for a script finding, and floating images are already caught by dk-from-floating and cm-image-floating, so nothing they caught is lost; pinning by digest is no longer checked, and the prose says so. Which tags float is data (dkscan/data/floating-tags.json): a tag floats when any of its \`-._\` components is a floating word (latest, stable, edge, lts, mainline and the like, so \`lts-alpine\` and \`stable-slim\` float), or when it holds no digit and does not start with a Debian or Ubuntu release codename (\`python:slim\`, \`golang:alpine\` float; \`debian:bookworm-slim\` does not); a tag with a digit and no floating component is a version (\`node:20\`, \`postgres:16.4\`). A \`# chock: allow dk-from-no-digest\` already in a file is now unused and harmless. Behaviour change: a compose file that cannot be read now refuses what a change adds even when HEAD's copy was unreadable too (cm-unreadable is new on every write, as in ci-github-actions-security); editing a compose file that stays unreadable is refused until it is fixed. Behaviour change: a compose finding is keyed without its service name, so renaming a service no longer re-fires the findings it already held; a second service with the same weakness is still new, but a weakness moved from one service to another is not (the counts match). Known limits: a moved file still re-fires its findings (engine, E-1); the scope is still by file name.

## Provenance

- Tested by 37 of 37 cases run automatically
- SHA-256: `dd62fbc4efb722b24dbc69281432fb44c6521c9e6af34787ba2839c626264427`
- Catalog commit: https://github.com/open-coder-ai/chock-catalog/commit/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4
- Source: https://github.com/open-coder-ai/chock-catalog/tree/e3d71d03e4dd32377ad5bc19fb6bacdfe6607ea4/base/dockerfile-compose-security (catalog path `base/dockerfile-compose-security`)
- Presets: Cloud and containers
- JSON: `/api/coding/policies/dockerfile-compose-security.json`
- Report a problem: https://chock.sh/report/?policy=dockerfile-compose-security&version=0.2.1&page=%2Fcoding%2Fpolicies%2Fdockerfile-compose-security%2F
