Skip to main content

SKY-D330 · Deployment and infrastructure

Privileged container with device or GPU access

High

A Docker Compose service that sets privileged: true and also gets a host device (such as a camera or serial port) or an NVIDIA GPU. Privileged mode turns off almost every container boundary: the container sees all host devices and holds every Linux capability.

Languages
Docker Compose
Quality gate
counted toward the gate limits (full and diff scans). Reported under security (danger). It counts toward max_high and max_security; the detector never reports CRITICAL.
Finding type
review
Catalog name
Docker Compose privileged edge container
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

On an edge box such as a Jetson or a robot, anyone who gets code running in that container (through a bug in the camera or model code) is effectively root on the device. They can load kernel modules, write to every disk and reach every other device.

What Skylos flags

docker-compose.yml · YAMLReported on line 5
services:  camera:    image: nvcr.io/nvidia/l4t-jetpack:r36.3.0    runtime: nvidia    privileged: true    devices:      - /dev/video0:/dev/video0    environment:      CAMERA_FPS: "30"    restart: unless-stopped

What Skylos leaves alone

docker-compose.yml · YAML
services:  camera:    image: nvcr.io/nvidia/l4t-jetpack:r36.3.0    runtime: nvidia    privileged: false    devices:      - /dev/video0:/dev/video0    environment:      CAMERA_FPS: "30"    restart: unless-stopped

Why Skylos leaves it alone

privileged: false is read as a boolean, not as text, so the service is not privileged and this rule stays quiet. The /dev/video0 mapping is still reported by SKY-D331, which looks at device mappings on their own.

How Skylos decides

  1. Runs with --danger. Reads YAML files named compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml, or starting with compose. or docker-compose. and ending in .yml / .yaml, in any folder except .git, .venv, venv, node_modules, build, dist and cache folders.
  2. Skips a file larger than 1 MB, a symlink, a file that does not parse as YAML, and a document whose structure is deeper than 100 levels or has more than 50,000 nodes.
  3. Looks at each entry under services:. A service counts as privileged when privileged is true, or the text 1, true, yes or on.
  4. Reports only when that privileged service also has device or GPU access: a devices: or volumes: entry whose host path is /dev, /proc, /sys, /run/udev, the Docker socket or a device such as /dev/video0, /dev/ttyUSB0, /dev/i2c-1 or /dev/nvidia0; or runtime: nvidia; or a gpus: key; or an environment value starting with NVIDIA_.
  5. Host paths written with ${...} are not resolved and do not count.
  6. Reports HIGH on the privileged: line of that service, once per service.

How to fix it

Remove privileged: true and pass only the device the service needs. The NVIDIA runtime already gives the container the GPU. If the process needs one extra Linux capability, add that one with cap_add: instead.

docker-compose.yml · YAML · the fix, against the flagged file
services:  camera:    image: nvcr.io/nvidia/l4t-jetpack:r36.3.0    runtime: nvidiaRemoved:     privileged: true    devices:      - /dev/video0:/dev/video0    environment:      CAMERA_FPS: "30"    restart: unless-stopped

When it can be wrong

  • It misses a privileged service that gets its GPU through the Compose deploy.resources.reservations.devices block (driver: nvidia, capabilities: [gpu]): that form is not read as GPU access, so the service is not reported.
  • Privileged services without a device or GPU, such as a docker:dind build container, are outside this rule and are not reported.
  • The flagged example is also reported by SKY-D331 for its /dev/video0 mapping.

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 privileged: line, or on its own comment line directly above it.

    YAML
    privileged: true  # skylos: ignore[SKY-D330] vendor driver needs it
  • [tool.skylos] ignore = ["SKY-D330"] turns the rule off for the project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.