SKY-D318 · CI/CD pipelines
GitLab CI Docker-in-Docker TLS disabled
Docker-in-Docker (DinD) starts a Docker daemon as a service container next to the job. By default it listens on port 2376 with TLS. SKY-D318 reports a job that turns TLS off, with DOCKER_TLS_CERTDIR: "" or a DOCKER_HOST on the plain-text port tcp://docker:2375.
- Languages
- GitLab CI
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
Without TLS the daemon accepts commands from anything that can reach it on the network, with no certificate. On a shared runner host that can be another job's container, which can then run privileged containers, read your build or push its own image under your tag.
What Skylos flags
stages: [build] build-image: stage: build image: docker:27.3 services: - docker:27.3-dind variables: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" script: - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .What Skylos leaves alone
stages: [build] build-image: stage: build image: docker:27.3 services: - docker:27.3-dind variables: DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_VERIFY: "1" DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" script: - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .Why Skylos leaves it alone
The same Docker-in-Docker job with TLS on: the daemon writes its certificates to /certs, and the client talks to port 2376 and checks them.
How Skylos decides
- Runs with
--danger(and-a). Reads every file named exactly.gitlab-ci.ymlin the scanned folder, skipping.git,node_modules,.venv,venv,build,distand cache folders. A subfolder scan of a Git repository also reads the repository's top-level.gitlab-ci.yml. Files pulled in withinclude:are not read. - Skips a file that PyYAML's safe loader cannot read, without a warning. That includes every file that uses GitLab's
!referencetag. - For every job, hidden
.templatejobs included, takes itsservices(the job's own, else thedefault:ones, else the top-level ones). It goes on only when one of them is a Docker-in-Docker image: the last path part contains bothdockeranddind. - Merges the top-level
variables:with the job's own. Variables set under a service entry are not read. - Reports the job when
DOCKER_TLS_CERTDIRis a string that is empty after trimming, orDOCKER_HOSTstarts withtcp://docker:2375(in any case). ADOCKER_TLS_CERTDIR:key with no value at all is not reported. - One finding per job, HIGH, on the first line of the file that sets the variable it found (
DOCKER_TLS_CERTDIRwhen both are set).
How to fix it
Delete both variables, or set them to the TLS values. The official docker:dind image creates certificates in DOCKER_TLS_CERTDIR (/certs by default) and the docker client image picks them up. Use the runner's privileged setting only on runners reserved for trusted projects.
stages: [build] build-image: stage: build image: docker:27.3 services: - docker:27.3-dind variables:Removed: DOCKER_HOST: tcp://docker:2375Removed: DOCKER_TLS_CERTDIR: ""Added: DOCKER_TLS_CERTDIR: "/certs" script: - docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA" .When it can be wrong
- A top-level
DOCKER_TLS_CERTDIR: ""is reported for every job with a DinD service, and every finding points at that one line. - Hidden
.templatejobs are checked as jobs. - Every example on this page is also a SKY-D314 finding: a DinD service without a digest. That one is separate.
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
# skylos: ignore[SKY-D318]and a reason on the reported line, or on the line directly above it. Skylos looks for that exact text, so write one rule per marker, with the ID in upper case.YAML variables: # skylos: ignore[SKY-D318] dedicated runner, one job per VM DOCKER_TLS_CERTDIR: ""A baseline hides the findings that exist today. Each entry records the rule, the absolute file path and the line, so it stops matching when the line moves or the checkout is at another path.
[tool.skylos] ignore = ["SKY-D318"]turns the rule off for the whole project.