From 03401cd46e6566af4d063bac11efc30f28b5358a Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Sat, 9 Dec 2023 06:49:26 -0800 Subject: [PATCH] ci: fix untrusted input in pr check workflow (#680) --- .github/workflows/check-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index 2b5f02b0..76edb9b8 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -46,13 +46,17 @@ jobs: check-breaking-change-label: runs-on: ubuntu-latest + env: + # use an environment variable to pass untrusted input to the script + # see https://securitylab.github.com/research/github-actions-untrusted-input/ + PR_TITLE: ${{ github.event.pull_request.title }} steps: - name: Check breaking change label id: check_breaking_change run: | pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!:' # Check if pattern matches - if echo "${{ github.event.pull_request.title }}" | grep -qE "$pattern"; then + if echo "${PR_TITLE}" | grep -qE "$pattern"; then echo "breaking_change=true" >> $GITHUB_OUTPUT else echo "breaking_change=false" >> $GITHUB_OUTPUT