glsec

Rules / GL072

GL072 needs:project artifact download with mutable or variable ref

Severity: warn
OWASP: CICD-SEC-3 – Dependency Chain Abuse

What glsec checks

glsec flags needs:project entries — cross-project artifact downloads — whose ref: is mutable or variable-controlled.

needs:project downloads artifacts from another project's job:

build_job:
  needs:
    - project: my-group/my-project
      job: build-1
      ref: main
      artifacts: true

The artifacts come from the latest successful run of that job on the given ref — there is no pinning to a specific pipeline or commit. So:

This is the needs: analogue of GL003 (unpinned include: ref) and reuses the same mutable-ref classification: a commit SHA is pinned, branch names like main/master/develop/production/latest/HEAD are mutable, and tags are treated as allowed.

Trigger examples

consume_mutable:
  needs:
    - project: my-group/my-project
      job: build
      ref: main                       # mutable branch
      artifacts: true
  script:
    - ./build.sh

consume_variable:
  needs:
    - project: my-group/my-project
      job: build
      ref: $ARTIFACTS_DOWNLOAD_REF     # variable-controlled
      artifacts: true
  script:
    - ./build.sh

Safe alternative

Pin ref: to a commit SHA or release tag:

consume_pinned:
  needs:
    - project: my-group/my-project
      job: build
      ref: 3fa92b1c4d5e6f7081920a1b2c3d4e5f60718293   # commit SHA
      artifacts: true
  script:
    - ./build.sh

What is not flagged

References

Documentation for glsec 1.23.0. Source of this page · Rule implementation