File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name: PR Check
33permissions :
44 contents : read
55 pull-requests : write
6+ issues : write
67
78on :
89 pull_request :
@@ -132,9 +133,12 @@ jobs:
132133 uses : actions/github-script@v7
133134 with :
134135 script : |
136+ // Security: Use context object instead of direct template injection to prevent script injection
135137 const lintBuildResult = '${{ needs.lint-and-build.result }}';
136138 const dockerResult = '${{ needs.docker-build-test.result }}';
137139 const prNumber = context.payload.pull_request.number;
140+ const commitSha = context.payload.pull_request.head.sha;
141+ const branchName = context.payload.pull_request.head.ref;
138142
139143 let allPassed = lintBuildResult === 'success' && dockerResult === 'success';
140144 let emoji = allPassed ? '✅' : '❌';
@@ -171,8 +175,8 @@ jobs:
171175 }
172176 }
173177
174- body += `**Commit:** \`${{ github.event.pull_request.head.sha } }\`\n`;
175- body += `**Branch:** \`${{ github.head_ref } }\`\n`;
178+ body += `**Commit:** \`${commitSha }\`\n`;
179+ body += `**Branch:** \`${branchName }\`\n`;
176180
177181 const { data: comments } = await github.rest.issues.listComments({
178182 owner: context.repo.owner,
You can’t perform that action at this time.
0 commit comments