Randomize GITHUB_ENV delimiter in commit-message check - #1073
Merged
Conversation
Derive the GITHUB_ENV heredoc delimiter from a per-run GUID instead of a fixed marker committed to the repo. gitlint echoes the PR's own commit messages into that block, so a static marker could be reproduced in a commit to close the heredoc early and inject environment variables into later steps. A random delimiter cannot be guessed, so the content stays inert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
NUnit Tests 1 files 1 suites 11m 40s ⏱️ Results for commit 9de8c8f. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1073 +/- ##
=========================================
+ Coverage 0 38.06% +38.06%
=========================================
Files 0 1499 +1499
Lines 0 350146 +350146
Branches 0 40239 +40239
=========================================
+ Hits 0 133296 +133296
- Misses 0 187572 +187572
- Partials 0 29278 +29278 🚀 New features to boost your workflow:
|
papeh
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
Commit messages checkworkflow wrotegitlintoutput into aGITHUB_ENVmulti-line variable using a fixed heredoc delimiter (###LINT_DELIMITER###) that is committed to the repo. This replaces it with a per-run random delimiter derived from a GUID.Why it matters
gitlintechoes the PR's own commit messages into that output. Because the delimiter was a static, publicly-known string, a crafted commit message containing a line equal to the delimiter could close the heredoc early and append attacker-chosenNAME=valuelines toGITHUB_ENV— injecting arbitrary environment variables into the job. The PR is checked out on disk (fetch-depth: 0) and a later step runs a Node action, so an injectedNODE_OPTIONS(or similar) is a plausible path to code execution on the runner. This is the exact class of bug GitHub's random-delimiter guidance forGITHUB_ENVis meant to prevent.A per-run GUID delimiter cannot be predicted or reproduced in commit content, so the multi-line value stays inert regardless of what the commit messages contain.
Scope / validation
.github/workflows/CommitMessage.yml.This is one of two PRs from a GitHub Actions security audit. The other PR (least-privilege
permissions:blocks) also editsCommitMessage.yml, but in a different region (top of file), so the two merge independently.This change is