Rules / GL091
GL091 rules:if trusts a spoofable identity
Severity: warn
OWASP: CICD-SEC-5 – Insufficient PBAC (Pipeline-Based Access Controls)
CWE: CWE-290 – Authentication Bypass by Spoofing
Risk
A rules:if that runs a job only "for the bot" or "for the release manager" is an access control. It is only as strong as the variable it checks. Three predefined variables name a person by data that person controls:
| Variable | Where the value comes from | How it is spoofed |
|---|---|---|
$CI_COMMIT_AUTHOR |
The commit's git author, Name <email> |
git commit --author="release-bot <bot@…>" |
$GITLAB_USER_NAME |
The display name ("Full name") in the user's profile | Every user can change it, and it isn't unique |
$CI_COMMIT_USER_LOGIN (GitLab 18.10+) |
The username of the account whose public email matches the commit's author email | Put that account's public email into the commit author |
GitLab takes the commit author as written. Push rules (Premium) can require the author email to belong to a GitLab user, but nothing ties the author to the person who pushed. So whoever can push a commit, or get one merged with a fast-forward or rebase merge, passes a $CI_COMMIT_AUTHOR gate. The job then runs with whatever it was meant to give only the bot: protected variables, deploy keys, an environment:.
What glsec checks
A rules: entry in a job, in workflow:rules or in an include: entry, whose if: compares one of the variables above positively (== or =~) with a value, in either operand order and also as ${VAR}.
These are not reported:
- negative comparisons (
!=,!~) andwhen: neverrules, which only keep something from running ("skip the bot's own release commit"); - comparisons with
nullor"", which only test whether the variable is set; $GITLAB_USER_LOGIN,$GITLAB_USER_IDand$GITLAB_USER_EMAIL, which come from the account that started the pipeline.$GITLAB_USER_NAMEin an&&with$CI_PIPELINE_SOURCE == "push"(outside parentheses): in a push pipeline the user is the pusher, who already wrote the YAML that runs, so the gate filters but grants nothing.$CI_COMMIT_AUTHORand$CI_COMMIT_USER_LOGINstay reported there, since a commit with a spoofed author can reach a protected branch through someone else's merge.
Trigger example
release-by-bot:
rules:
- if: $CI_COMMIT_AUTHOR =~ /release-bot/
environment: production
script:
- ./publish.sh
Safe alternative
Match the account that started the pipeline, by username or ID:
release-by-bot:
rules:
- if: $GITLAB_USER_LOGIN == "release-bot"
environment: production
script:
- ./publish.sh
$GITLAB_USER_ID == "1234567" also survives a username change. Protect the environment and the variables the job uses as well, so that a gate in the pipeline file is not the only control.
Known attacks
CVE-2026-123852 (GitHub Actions analogue): an actor-identity check could be bypassed by a bot identity. GL091 reports the corresponding spoofable identity gate in GitLab CI, not the GitHub Actions vulnerability.
Documentation for glsec 1.29.0. Source of this page · Rule implementation