SKY-D331 · Deployment and infrastructure
Host device or control path mounted into a container
A Docker Compose service that maps a host device, the whole /dev, /proc or /sys tree, /run/udev, or the Docker socket into the container. These paths give the container direct control over host hardware or over the host itself.
- Languages
- Docker Compose
- Quality gate
- counted toward the gate limits (full and diff scans). Reported under security (
danger). It counts towardmax_highandmax_security; the detector never reports CRITICAL. - Finding type
- review
- Catalog name
- Docker Compose host device exposure
Why it matters
Whoever can talk to the Docker socket can start a privileged container with the host's disk mounted, which is root on the host. Broad /dev, /proc or /sys access lets a compromised container read other processes' memory or reconfigure hardware.
What Skylos flags
services: fleet-agent: image: ghcr.io/acme/fleet-agent:1.8.0 restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock - ./agent.toml:/etc/fleet-agent/agent.toml:ro environment: FLEET_API: https://fleet.example.comWhat Skylos leaves alone
services: fleet-agent: image: ghcr.io/acme/fleet-agent:1.8.0 restart: always volumes: - /var/run/postgresql:/var/run/postgresql - agent-state:/var/lib/fleet-agent - ./agent.toml:/etc/fleet-agent/agent.toml:ro environment: FLEET_API: https://fleet.example.comvolumes: agent-state:Why Skylos leaves it alone
The service still mounts a host socket folder, but it is PostgreSQL's, not Docker's, and it is not a device or kernel interface. Named volumes and files from the project folder are not host control paths either.
How Skylos decides
- Runs with
--danger. Reads the same Compose files as SKY-D330 (compose.y*ml,docker-compose.y*mland names starting withcompose.ordocker-compose.), skipping symlinks, files over 1 MB and YAML that does not parse. - For each service, reads the host side of every
devices:andvolumes:entry, in short form (/host:/container) or long form (source:orsrc:). - Counts the path when it is
/dev,/proc,/sys,/run/udev,/run/docker.sockor/var/run/docker.sock, or anything below one of them, such as/dev/video0or/sys/class/gpio. - Skips host paths written with
${...}, which are not resolved. A:rosuffix does not change the result. - Does not need an edge or GPU context: any service is checked. Reports HIGH once per service, on its
devices:line when the service has one, otherwise on itsvolumes:line.
How to fix it
Mount only what the service needs. Here the agent only reports status, so it does not need the Docker socket at all. A service that must manage containers is better run as a host service under its own user; a socket proxy still mounts the socket and is still reported, so give that mount a suppression with a reason.
services: fleet-agent: image: ghcr.io/acme/fleet-agent:1.8.0 restart: always volumes:Removed: - /var/run/docker.sock:/var/run/docker.sock - ./agent.toml:/etc/fleet-agent/agent.toml:ro environment: FLEET_API: https://fleet.example.comWhen it can be wrong
- A camera or serial device that the service really needs, such as
/dev/video0, is reported the same way as a broad/devmount. Keep the device specific and suppress it with a reason. - It misses a host path that comes from a variable, such as
${DOCKER_SOCKET}:/var/run/docker.sock. - The finding sits on the
devices:orvolumes:key, not on the mount itself. When a service has both keys it points atdevices:even if the risky path is undervolumes:.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put the marker on the reported
volumes:ordevices:line, or on a comment line directly above it.YAML volumes: # skylos: ignore[SKY-D331] camera node needs /dev/video0A marker on the mount line itself does not work: the finding is on the
volumes:line above it, and only that line and the line before it are read.[tool.skylos] ignore = ["SKY-D331"]turns the rule off for the project.