Repository navigation
security: ci: pass the merged pull request title to git commit as data - #237
Open
Shengcun-Scanner wants to merge 1 commit into
Open
Shengcun-Scanner wants to merge 1 commit into
Shengcun-Scanner wants to merge 1 commit into
Conversation
The manifest sync step substituted the PR title into the commit message, so a title containing a command substitution ran in a pull_request_target job. Read it from env. Co-Authored-By: Shengcun <business@rs-systems-web.com>
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.
The manifest sync job runs after a pull request is merged and puts the PR title
straight into the commit command:
The expression is expanded before bash parses the line, so the double quotes are
script text. A pull request titled
runs that command in a
pull_request_targetjob — the event that gets the baserepository's credentials rather than the fork's. The command runs before the
git pushbelow it; whether that push then succeeds depends on the repository'sdefault token permissions, which this workflow does not declare.
The job is
if: … merged == true, so the title only reaches the shell once amaintainer merges. That is this job's normal trigger, and a commit-message
template is not where anyone looks for code.
Fix
The commit message is byte-identical for a normal title; the title is a variable
instead of script.
Verification
yaml.safe_loadparses the workflow; thecheckjob and the trigger areuntouched.