Skip to content

Conversation

@schcamille
Copy link
Owner

No description provided.

Comment on lines +5 to +23
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/setup-node@v1
- run: |
npm install
npm build
- uses: completely/fakeaction@v2
with:
arg1: ${{ secrets.supersecret }}

- uses: fakerepo/comment-on-pr@v1
with:
message: |
Thank you!

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 7 months ago

To resolve the issue, we will add a permissions block at the root of the workflow, applying it to all jobs unless overridden. In this case, we will set the contents permission to read (allowing the workflow to read repository contents) and the pull-requests permission to write (required for commenting on pull requests). This ensures the workflow has the least privilege necessary to perform its tasks. We will add the permissions block after the on key to apply it globally.


Suggested changeset 1
.github/workflows/vulnerable.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/vulnerable.yml b/.github/workflows/vulnerable.yml
--- a/.github/workflows/vulnerable.yml
+++ b/.github/workflows/vulnerable.yml
@@ -1,3 +1,6 @@
+permissions:
+  contents: read
+  pull-requests: write
 on: pull_request_target
 
 jobs:
EOF
@@ -1,3 +1,6 @@
permissions:
contents: read
pull-requests: write
on: pull_request_target

jobs:
Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +13 to +16
- run: |
npm install
npm build
- uses: completely/fakeaction@v2

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
@schcamille schcamille closed this Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants