glsec

Rules / GL019

GL019 Deploy job missing resource_group:

Severity: warn
OWASP: CICD-SEC-1 – Insufficient Flow Control Mechanisms

What glsec checks

glsec flags deployment and publish jobs that do not have a resource_group: key. Without it, multiple pipeline runs can execute the same deploy job concurrently — causing race conditions, partial deploys, overwritten state, or conflicting releases.

A job is considered a deployment/publish job if it has:

Trigger example

deploy-prod:
  stage: deploy
  environment: production
  script:
    - ./deploy.sh
  # no resource_group: — two pipeline runs can deploy simultaneously

Safe alternative

deploy-prod:
  stage: deploy
  environment: production
  resource_group: production
  script:
    - ./deploy.sh

GitLab serialises jobs in the same resource_group — the second run waits until the first completes. Use separate group names per environment (e.g. staging, production) if you want concurrent deploys across environments but serialised deploys within each.

Why this matters

Without concurrency control, two developers merging to the same branch within seconds of each other can trigger overlapping deploys. The later deploy may start before the earlier one finishes, causing:

References

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