mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tools: ensure the PR was not pushed before merging
When using Squash and Merge feature, it would allow to a malicious actor to push unreviewed code to their PR while the CQ is running and bypass the usual checks. This commit adds a check to refuse to land if the head of the PR branch is different from the one validated by ncu. PR-URL: https://github.com/nodejs/node/pull/40747 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
@@ -110,7 +110,8 @@ for pr in "$@"; do
|
||||
jq -n \
|
||||
--arg title "$(git log -1 --pretty='format:%s')" \
|
||||
--arg body "$(git log -1 --pretty='format:%b')" \
|
||||
'{merge_method:"squash",commit_title:$title,commit_message:$body}' > output.json
|
||||
--arg head "$(grep 'Fetched commits as' output | cut -d. -f3 | xargs git rev-parse)" \
|
||||
'{merge_method:"squash",commit_title:$title,commit_message:$body,sha:$head}' > output.json
|
||||
cat output.json
|
||||
gitHubCurl "$(mergeUrl "$pr")" PUT --data @output.json > output
|
||||
cat output
|
||||
|
||||
Reference in New Issue
Block a user