Skip to main content

SKY-D332 · Deployment and infrastructure

Host networking on an edge or device service

Medium

A Docker Compose service on a robot, Jetson or other device that uses network_mode: host. The container then shares the device's network stack, so every port it opens is open on every interface of the device.

Languages
Docker Compose
Quality gate
counted toward the gate limits (full and diff scans). Reported under security (danger) at MEDIUM. It counts toward max_security.
Finding type
review
Catalog name
Docker Compose host networking on edge service
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Robot and device control services (ROS nodes, camera streams, debug consoles) often listen without authentication. With host networking they are reachable from any network the device joins, such as a customer's Wi-Fi, instead of only from the containers that need them.

What Skylos flags

docker-compose.yml · YAMLReported on line 4
services:  nav-stack:    image: ros:humble-ros-base    network_mode: host    command: ros2 launch nav_bringup robot.launch.py    environment:      ROS_DOMAIN_ID: "7"

What Skylos leaves alone

docker-compose.yml · YAML
services:  status-page:    image: nginx:1.27-alpine    network_mode: host    volumes:      - ./site:/usr/share/nginx/html:ro

Why Skylos leaves it alone

Host networking alone is not reported. This service has no GPU runtime, no host device and no edge image or command, so the rule does not treat it as an edge service.

How Skylos decides

  1. Runs with --danger. Reads the same Compose files as SKY-D330 (compose.y*ml, docker-compose.y*ml and names starting with compose. or docker-compose.), skipping symlinks, files over 1 MB and YAML that does not parse.
  2. Looks only at services whose network_mode is host.
  3. Reports when the service also looks like an edge or device service: it has GPU access (runtime: nvidia, a gpus: key or an NVIDIA_ environment value); the image name or any key or value in the service contains jetson, l4t, nvidia, cuda, ros: or ros2; or it maps a host device or control path as described under SKY-D331.
  4. Reports MEDIUM on the service's network_mode: line.

How to fix it

Put the service on a Compose network and publish only the ports other machines must reach, bound to the interface that should see them. Containers on the same Compose network still reach each other.

docker-compose.yml · YAML · the fix, against the flagged file
services:  nav-stack:    image: ros:humble-ros-baseRemoved:     network_mode: hostAdded:     networks: [robot]    command: ros2 launch nav_bringup robot.launch.py    environment:      ROS_DOMAIN_ID: "7"Added:     ports:Added:       - "127.0.0.1:9090:9090"Added: networks:Added:   robot: {}

When it can be wrong

  • The edge test is a plain text search, so a service whose name, image or settings merely contain cuda or nvidia (for example in an environment value) counts as an edge service.
  • A non-edge service on host networking, such as a reverse proxy, is not reported even when host networking is the real risk.
  • Some ROS 2 setups need host networking for DDS discovery across machines. Keep the service on a trusted network and suppress the finding with that reason.

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 network_mode: line, or on a comment line directly above it.

    YAML
    network_mode: host  # skylos: ignore[SKY-D332] DDS needs multicast on robot LAN
  • [tool.skylos] ignore = ["SKY-D332"] turns the rule off for the project.

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