Disabling builder sandboxes can lead to unauthorized access of the host system by malicious programs.

By default, programs that are executed by a RUN instruction are in a sandbox mode that limits the capabilities of the according process. Explicitly disabling the sandbox grants the process additional capabilities that might allow it to escalate privileges and access the host system.

Ask Yourself Whether

There is a risk if you answered yes to the question.

Recommended Secure Coding Practices

Sensitive Code Example

# syntax=docker/dockerfile:1-labs
FROM ubuntu:22.04
# Sensitive
RUN --security=insecure ./example.sh

Compliant Solution

# syntax=docker/dockerfile:1-labs
FROM ubuntu:22.04
RUN ./example.sh
RUN --security=sandbox ./example.sh

See