glsec

Rules / GL065

GL065 Container image from a non-allowlisted registry

Severity: warn
OWASP: CICD-SEC-4 – Poisoned Pipeline Execution
CWE: CWE-829 – Inclusion of Functionality from Untrusted Control Sphere

Risk

A pipeline can pull an image: or services: entry from any registry. An image from an untrusted or unexpected registry runs with full access to the job's secrets and build context, so a compromised or malicious image is a direct path to pipeline execution. Teams that mandate a curated internal registry (or a small set of trusted public ones) have no way to enforce that from .gitlab-ci.yml alone.

How glsec checks

This rule is opt-in and config-driven: it does nothing until you set allowed_registries: in .glsec.yml. Once set, glsec flags any image: / services: reference whose registry is not on the list.

# .glsec.yml
allowed_registries:
  - registry.example.com   # bare host — any image from this registry is allowed
  - ghcr.io/myorg          # host + namespace — only this namespace is allowed

Trigger example

# .glsec.yml has allowed_registries: [registry.example.com]
build:
  image: docker.io/library/node:20   # flagged — docker.io is not on the allowlist
  script:
    - ./build.sh

Safe alternative

build:
  image: registry.example.com/node:20
  script:
    - ./build.sh

Notes

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