Skip to main content

CI/CD provider

ISSUE-510CriticalAccess and Authorization

Tags are not protected

Control:CTRL-510Tag must be protected

📋 What is this?

The project uses tags, but anyone allowed to push a tag can move, delete or create one. By default every tag must be covered by a protected tag *; when the control lists namePatterns, each listed pattern must be covered instead.

⚠️ Impact

Tags are what release pipelines run on and what consumers pin to. A moved tag ships unreviewed code under a version name consumers already trust: the tj-actions/changed-files compromise re-pointed existing version tags to a malicious commit.

🔧 How to fix

Protect all tags with a protected tag * in the project settings, and leave tag creation to Maintainers or a narrower set.

  1. 1

    Open Settings > Repository > Protected tags and click Add new.

  2. 2

    In Tag, enter * to cover every tag.

    If the control lists namePatterns, protect each listed pattern instead, for example v*. A protected tag already blocks updates and deletions by itself.

  3. 3

    Set Allowed to create to Maintainers, or a narrower set.

    No one, or named users, groups or deploy keys also count as restricted. Developers + Maintainers does not: any developer could then forge a release tag.

  4. 4

    Click Protect and re-run Plumber to confirm the finding clears.

✗ BeforeA job runs on tag pipelines while anyone with push access can create or move a tag.
# .gitlab-ci.yml: ❌ the tag pipeline publishes, but no protected tag covers all tags
publish:
rules:
- if: $CI_COMMIT_TAG
script:
- ./publish.sh

💡 Tips

  • The finding is critical when a job runs on tag pipelines (only: [tags], or a rules: entry on $CI_COMMIT_TAG), high otherwise.
  • By default the control raises one finding, for the tag pattern *. A protected tag on a narrower pattern such as v* does not cover all tags.
  • To check specific patterns instead, set namePatterns, for example [v*]. Each pattern then gets its own finding.
  • Nothing is checked until the project has a tag or a job runs on tag pipelines, so a project that never tags stays quiet.
  • Plumber needs a token with read_api to list protected tags and tags. Without it the control reports "not evaluated" and raises no finding.
  • Protected tags are available on every GitLab plan. Restricting creation to named users or groups needs GitLab Premium.

⚙️ Configure this control

With the CLI alone: set it in your configuration file. Every field and default is in the controls configuration reference, CTRL-510.