Skip to content

Commit 285e586

Browse files
committed
finalize-g4w-release: must only run in response to a manually-triggered run
The purpose of the `finalize-g4w-release` functionality is to react to a completed `release-git` run that was triggered in a Git for Windows PR via the `/release` slash command by a trusted user. So far, we only validate the workflow name, though. But this workflow could easily be triggered in a crafted PR by changing the `on: workflow_dispatch` to `on: pull_request`. Make sure that it was triggered via `workflow_dispatch`, which would imply that it was triggered either by a trusted user or by Git for Windows' automation via the GitHub App's installation access token. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 1457cf5 commit 285e586

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

GitForWindowsHelper/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ module.exports = async function (context, req) {
5252
try {
5353
const finalizeGitForWindowsRelease = require('./finalize-g4w-release')
5454
if (req.headers['x-github-event'] === 'workflow_run'
55+
&& req.body.workflow_run?.event === 'workflow_dispatch'
56+
&& req.body.workflow_run?.head_branch === 'main'
5557
&& req.body.repository.full_name === 'git-for-windows/git-for-windows-automation'
5658
&& req.body.action === 'completed'
5759
&& req.body.workflow_run.path === '.github/workflows/release-git.yml'

0 commit comments

Comments
 (0)