dcg

GitLab CI

cicd.gitlab_ci

Protects against destructive GitLab CI/CD operations like deleting variables, removing artifacts, and unregistering runners.

  • 4blocking rules
  • 7safe patterns
  • 1Critical
  • 2High
  • 1Medium
~/.config/dcg/config.toml
[packs]
enabled = ["cicd.gitlab_ci"]

Evaluated when a command contains glab, gitlab-runner.

Blocking rules

Each rule ID is cicd.gitlab_ci:<name>. Use it in allowlists and [policy.rules].

  1. gitlab-runner-unregister

    Critical

    gitlab-runner unregister removes runners and can halt CI.

    Explanation
    Unregistering a GitLab runner removes it from the GitLab instance. Jobs assigned to this runner will be stuck pending or fail. With --all-runners, all runners on the machine are removed, potentially halting all CI/CD for multiple projects. Safer alternatives: - gitlab-runner list: Review registered runners first - Pause the runner in GitLab UI instead - Verify replacement runners are available before removing
  2. glab-api-delete-variables

    High

    glab api DELETE against variables endpoints removes CI variables.

    Explanation
    Making DELETE requests to GitLab variables API removes CI/CD variables directly. This bypasses CLI confirmations and immediately affects all pipelines using these variables. Protected variable values cannot be recovered. Safer alternatives: - Use glab variable delete for safer deletion - GET request first: Verify variable exists - Prefer CLI commands over direct API calls
  3. glab-variable-delete

    High

    glab variable delete removes CI variables and can break pipelines.

    Explanation
    Deleting a GitLab CI/CD variable removes it from the project, group, or instance. Pipelines that depend on this variable will fail with undefined variable errors. Protected or masked variable values cannot be recovered after deletion. Safer alternatives: - glab variable list: Review existing variables first - Update variable value instead of deleting - Check .gitlab-ci.yml for variable usage before removing
  4. glab-ci-delete

    Medium

    glab ci delete removes pipeline artifacts or pipelines.

    Explanation
    Deleting pipelines or artifacts removes build history, job logs, and generated files. This affects debugging capabilities and audit trails. Artifacts needed for deployments or releases will no longer be available. Safer alternatives: - glab ci list: Review pipelines before deletion - glab ci view: Inspect pipeline details - Download artifacts before deletion if needed

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • glab-variable-list
  • glab-ci-list
  • glab-ci-view
  • glab-ci-status
  • gitlab-runner-list
  • gitlab-runner-status
  • glab-api-explicit-get