Skip to main content

SKY-D315 · CI/CD pipelines

GitLab CI unpinned external include

High

include: pulls jobs and scripts from other files into your pipeline. SKY-D315 reports includes from outside the repository that can change without a commit to it: another project's file at a branch or tag instead of a commit SHA, and a remote URL without an integrity checksum.

Languages
GitLab CI
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

The included file becomes part of your pipeline and runs with your jobs' variables and tokens. Anyone who can push to the template project's main branch, or who controls the remote server, can change what every pipeline that includes it does, including your release job.

What Skylos flags

.gitlab-ci.yml · YAMLReported on line 2
include:  - project: platform/ci-templates    ref: main    file: /templates/python-test.yml  - local: /ci/lint.yml stages: [lint, test] unit-tests:  extends: .python-test  script:    - pytest

What Skylos leaves alone

.gitlab-ci.yml · YAML
include:  - project: platform/ci-templates    ref: 4f1d2c9b7a6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c    file: /templates/python-test.yml  - remote: https://ci.example.com/templates/sast.yml    integrity: sha256-L6yQx2PbQk6n2Hq9Zr1J3vT0wYd8sF5mBc7aUe4iKoE=  - local: /ci/lint.yml  - template: Jobs/Secret-Detection.gitlab-ci.yml stages: [lint, test] unit-tests:  extends: .python-test  script:    - pytest

Why Skylos leaves it alone

The project include names a full 40-character commit SHA, and the remote include carries an integrity hash, so neither can change silently. local: files live in this repository and template: files ship with GitLab itself; the rule does not check either.

How Skylos decides

  1. Runs with --danger (and -a). Reads every file named exactly .gitlab-ci.yml in the scanned folder, skipping .git, node_modules, .venv, venv, build, dist and cache folders. A subfolder scan of a Git repository also reads the repository's top-level .gitlab-ci.yml. The included files themselves are not read.
  2. Skips a file that PyYAML's safe loader cannot read, without a warning. That includes every file that uses GitLab's !reference tag.
  3. Walks the top-level include: entries, flattening nested lists.
  4. A string entry that starts with http:// or https:// is reported: the short form cannot carry a checksum.
  5. An entry with project: is reported unless its ref: is a full 40-character hexadecimal commit SHA. A missing ref, a branch and a tag such as v1.4.0 are all reported.
  6. An entry with remote: is reported unless it has a non-empty integrity: value. Skylos does not check the hash itself.
  7. local:, template: and component: entries are never reported. Every finding is HIGH, on the first line of the file that contains the project name or URL.

How to fix it

Point ref: at a commit SHA of the template project, and give every remote include an integrity: hash (GitLab's format is sha256- and the base64 SHA-256 of the file). Update the SHA on purpose when you want the template's changes.

.gitlab-ci.yml · YAML · the fix, against the flagged file
include:  - project: platform/ci-templatesRemoved:     ref: mainAdded:     ref: 4f1d2c9b7a6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c  # v3.2.0    file: /templates/python-test.yml  - local: /ci/lint.yml stages: [lint, test] unit-tests:  extends: .python-test  script:    - pytest

When it can be wrong

  • A tag or a protected branch is reported, even in a project where only maintainers can push. Skylos accepts only a commit SHA.
  • Two includes of the same project both point at the first line that names it.
  • CI/CD catalog components (component: …@1.0) are not checked, even when their version is a moving tag such as ~latest.

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-D315] 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
    include:  # skylos: ignore[SKY-D315] owned by our team, protected branch  - project: platform/ci-templates    ref: main
  • 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-D315"] turns the rule off for the whole project.

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