Skip to content

Commit 0fb3d10

Browse files
fix: use env variables instead of inline interpolation for security
Address Cubic AI review feedback by moving user-controlled values (PR_TITLE, PR_AUTHOR, PR_BRANCH) to the env: block instead of using inline ${{ }} interpolation in shell scripts. This prevents potential shell injection attacks from malicious PR titles or branch names. Also fixed the github-script step to use process.env for PR_AUTHOR instead of inline interpolation for consistency. Co-Authored-By: unknown <>
1 parent f640d69 commit 0fb3d10

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/stale-pr-devin-completion.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ jobs:
1818
- name: Create Devin session
1919
env:
2020
DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}
21+
PR_NUMBER: ${{ github.event.pull_request.number }}
22+
PR_TITLE: ${{ github.event.pull_request.title }}
23+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
24+
PR_BRANCH: ${{ github.event.pull_request.head.ref }}
25+
REPO_NAME: ${{ github.repository }}
2126
run: |
22-
PR_NUMBER="${{ github.event.pull_request.number }}"
23-
PR_TITLE="${{ github.event.pull_request.title }}"
24-
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
25-
PR_BRANCH="${{ github.event.pull_request.head.ref }}"
26-
27-
FULL_PROMPT="You are completing a stale community PR #${PR_NUMBER} in repository ${{ github.repository }}.
27+
FULL_PROMPT="You are completing a stale community PR #${PR_NUMBER} in repository ${REPO_NAME}.
2828
2929
This PR was started by @${PR_AUTHOR} but has become stale. Your job is to complete it.
3030
3131
PR Title: ${PR_TITLE}
3232
PR Branch: ${PR_BRANCH}
3333
3434
Your tasks:
35-
1. Clone the repository ${{ github.repository }} locally.
35+
1. Clone the repository ${REPO_NAME} locally.
3636
2. Check out the PR branch: ${PR_BRANCH}
3737
3. Review the current state of the PR and understand what it's trying to accomplish.
3838
4. Read the PR description and any comments/review feedback on the PR.
@@ -78,11 +78,13 @@ jobs:
7878
- name: Post comment with Devin session link
7979
if: env.SESSION_URL != ''
8080
uses: actions/github-script@v7
81+
env:
82+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
8183
with:
8284
github-token: ${{ secrets.GITHUB_TOKEN }}
8385
script: |
8486
const sessionUrl = process.env.SESSION_URL;
85-
const prAuthor = '${{ github.event.pull_request.user.login }}';
87+
const prAuthor = process.env.PR_AUTHOR;
8688
await github.rest.issues.createComment({
8789
owner: context.repo.owner,
8890
repo: context.repo.repo,

0 commit comments

Comments
 (0)