Skip to content

Commit 53785b6

Browse files
ci(security): fix vulnerability in slash_command_dispatch.yml (#1064)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent cdd7014 commit 53785b6

1 file changed

Lines changed: 6 additions & 34 deletions

File tree

.github/workflows/slash_command_dispatch.yml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
issue_comment:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
712
jobs:
813
slashCommandDispatch:
914
runs-on: ubuntu-24.04
@@ -18,9 +23,7 @@ jobs:
1823
private-key: ${{ secrets.OCTAVIA_BOT_PRIVATE_KEY }}
1924
- name: Slash Command Dispatch
2025
id: dispatch
21-
# TODO: Revert to `peter-evans/slash-command-dispatch@v4` after PR merges:
22-
# - https://github.com/peter-evans/slash-command-dispatch/pull/372/files
23-
uses: aaronsteers/slash-command-dispatch@aj/fix/add-dispatched-bool-output
26+
uses: peter-evans/slash-command-dispatch@v4
2427
with:
2528
repository: ${{ github.repository }}
2629
token: ${{ steps.get-app-token.outputs.token }}
@@ -52,34 +55,3 @@ jobs:
5255
comment-id: ${{ github.event.comment.id }}
5356
body: |
5457
> Error: ${{ steps.dispatch.outputs.error-message }}
55-
56-
- name: Generate help text
57-
id: help
58-
if: >
59-
startsWith(github.event.comment.body, '/') &&
60-
!steps.dispatch.outputs.dispatched
61-
run: |
62-
HELP_TEXT="The following slash commands are available:
63-
64-
- \`/autofix\` - Corrects any linting or formatting issues
65-
- \`/test\` - Runs the test suite
66-
- \`/poetry-lock\` - Re-locks dependencies and updates the poetry.lock file
67-
- \`/prerelease\` - Triggers a prerelease publish with default arguments
68-
- \`/help\` - Shows this help message"
69-
70-
if [[ "${{ github.event.comment.body }}" == "/help" ]]; then
71-
echo "body=$HELP_TEXT" >> $GITHUB_OUTPUT
72-
else
73-
echo "body=It looks like you are trying to enter a slash command. Either the slash command is unrecognized or you don't have access to call it.
74-
75-
$HELP_TEXT" >> $GITHUB_OUTPUT
76-
fi
77-
78-
- name: Post help message
79-
if: >
80-
startsWith(github.event.comment.body, '/') &&
81-
!steps.dispatch.outputs.dispatched
82-
uses: peter-evans/create-or-update-comment@v4
83-
with:
84-
comment-id: ${{ github.event.comment.id }}
85-
body: ${{ steps.help.outputs.body }}

0 commit comments

Comments
 (0)