Skip to content

Commit 011e1db

Browse files
committed
ci: pass trigger_names via environment variable to prevent template injection
1 parent 311dc0e commit 011e1db

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎.github/workflows/cloud_build_failure_reporter.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ jobs:
4040

4141
steps:
4242
- uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # v8
43+
env:
44+
TRIGGER_NAMES: ${{ inputs.trigger_names }}
4345
with:
4446
script: |-
4547
// parse test names
46-
const testNameSubstring = '${{ inputs.trigger_names }}';
48+
const testNameSubstring = process.env.TRIGGER_NAMES || '';
4749
const testNameFound = new Map(); //keeps track of whether each test is found
4850
testNameSubstring.split(',').forEach(testName => {
49-
testNameFound.set(testName, false);
51+
testNameFound.set(testName.trim(), false);
5052
});
5153
5254
// label for all issues opened by reporter
@@ -173,8 +175,8 @@ jobs:
173175
const noTestFound = Array.from(testNameFound.values()).every(value => value === false);
174176
if (noTestFound){
175177
createOrCommentIssue(
176-
'Missing periodic tests: ${{ inputs.trigger_names }}',
177-
`No periodic test is found for triggers: ${{ inputs.trigger_names }}. Last checked from ${
178+
`Missing periodic tests: ${testNameSubstring}`,
179+
`No periodic test is found for triggers: ${testNameSubstring}. Last checked from ${
178180
commits[0].html_url
179181
} to ${commits[commits.length - 1].html_url}.`
180182
);

0 commit comments

Comments
 (0)