Skip to content

Commit 3610f99

Browse files
committed
chore
1 parent 570c227 commit 3610f99

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/pr-check.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: PR Check
33
permissions:
44
contents: read
55
pull-requests: write
6+
issues: write
67

78
on:
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,

0 commit comments

Comments
 (0)