Remote ADD without a check (ARCH10004)
هذا المحتوى غير متوفر بلغتك بعد.
Key config.docker.remote-add · Severity warning · Category security · CWE CWE-494
ADD <url> puts whatever the server returns that day into the image. A moved file, a hijacked domain or a man in the middle changes the image without a line of the Dockerfile changing.
Incorrect
Section titled “Incorrect”FROM alpine:3.20ADD https://downloads.example.com/cli/cli-2.4.1.tar.gz /tmp/cli.tar.gzRUN tar -xzf /tmp/cli.tar.gz -C /usr/local/binUSER 65534Correct
Section titled “Correct”FROM alpine:3.20ADD --checksum=sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 \ https://downloads.example.com/cli/cli-2.4.1.tar.gz /tmp/cli.tar.gzRUN tar -xzf /tmp/cli.tar.gz -C /usr/local/binUSER 65534Pin the content: ADD --checksum=sha256:..., or download with curl and check it with sha256sum -c before use. A vetted file in the repository can be COPYed instead.
Not flagged
Section titled “Not flagged”ADD --checksum=....- A remote
ADDwhose file a laterRUNof the same stage verifies by name (sha256sum -c,gpg --verify,cosign verify,minisign -V).