Skip to content

Commit f71f6e1

Browse files
authored
Fix security issues on actions (#20416)
# Objective - CodeQL is reporting some issues on actions <img width="930" height="379" alt="Screenshot 2025-08-04 at 19 25 24" src="https://github.com/user-attachments/assets/7de5efe1-4962-4d15-9031-13ce3e1ac202" /> ## Solution - Fix them - Follow https://securitylab.github.com/resources/github-actions-untrusted-input/ for the code injection - Set default permissions to every workflow that doesn't specify some ## Testing - Not entirely sure permissions specified are enough, but I guess CI will fail if they aren't
1 parent 418419d commit f71f6e1

File tree

8 files changed

+33
-10
lines changed

8 files changed

+33
-10
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
22

3+
permissions:
4+
contents: read
5+
36
on:
47
merge_group:
58
pull_request:

.github/workflows/dependencies.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
name: Dependencies
22

3+
permissions:
4+
contents: read
5+
36
on:
47
pull_request:
58
paths:
6-
- '**/Cargo.toml'
7-
- 'deny.toml'
9+
- "**/Cargo.toml"
10+
- "deny.toml"
811
push:
912
paths:
10-
- '**/Cargo.toml'
11-
- 'deny.toml'
13+
- "**/Cargo.toml"
14+
- "deny.toml"
1215
branches:
1316
- main
1417

.github/workflows/example-run-report.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ jobs:
5959
path: screenshots
6060
- name: branch name
6161
id: branch-name
62+
env:
63+
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
6264
run: |
63-
echo "result=PR-$(cat PR)-${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
65+
echo "result=PR-$(cat PR)-$BRANCH_NAME" >> $GITHUB_OUTPUT
6466
- name: PR number
6567
id: pr-number
6668
run: |

.github/workflows/example-run.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Example Run
22

3+
permissions:
4+
contents: read
5+
36
on:
47
merge_group:
58
pull_request:

.github/workflows/send-screenshots-to-pixeleagle.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Send Screenshots to Pixel Eagle
22

3+
permissions:
4+
contents: read
5+
36
on:
47
workflow_call:
58
inputs:
@@ -45,9 +48,10 @@ jobs:
4548
if: ${{ fromJSON(env.PIXELEAGLE_TOKEN_EXISTS) }}
4649
env:
4750
project: B04F67C0-C054-4A6F-92EC-F599FEC2FD1D
51+
branch: ${{ inputs.branch }}
4852
run: |
4953
# Create a new run with its associated metadata
50-
metadata='{"os":"${{ inputs.os }}", "commit": "${{ inputs.commit }}", "branch": "${{ inputs.branch }}"}'
54+
metadata='{"os":"${{ inputs.os }}", "commit": "${{ inputs.commit }}", "branch": "$branch"}'
5155
run=`curl https://pixel-eagle.com/$project/runs --json "$metadata" --oauth2-bearer ${{ secrets.PIXELEAGLE_TOKEN }} | jq '.id'`
5256
5357
SAVEIFS=$IFS

.github/workflows/update-caches.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Update Actions Caches
22

3+
permissions:
4+
contents: read
5+
36
on:
47
# Manually
58
workflow_dispatch:

.github/workflows/validation-jobs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: validation jobs
22

3+
permissions:
4+
contents: read
5+
36
on:
47
merge_group:
58
pull_request:

.github/workflows/weekly.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
name: Weekly beta compile test
22

3+
permissions:
4+
contents: read
5+
36
on:
47
schedule:
58
# New versions of rust release on Thursdays. We test on Mondays to get at least 3 days of warning before all our CI breaks again.
69
# https://forge.rust-lang.org/release/process.html#release-day-thursday
7-
- cron: '0 12 * * 1'
10+
- cron: "0 12 * * 1"
811
workflow_dispatch:
912

1013
env:
@@ -85,7 +88,7 @@ jobs:
8588

8689
close-any-open-issues:
8790
runs-on: ubuntu-latest
88-
needs: ['test', 'lint', 'check-compiles']
91+
needs: ["test", "lint", "check-compiles"]
8992
permissions:
9093
issues: write
9194
steps:
@@ -106,14 +109,13 @@ jobs:
106109
COMMENT: |
107110
[Last pipeline run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) successfully completed. Closing issue.
108111
109-
110112
open-issue:
111113
name: Warn that weekly CI fails
112114
runs-on: ubuntu-latest
113115
needs: [test, lint, check-compiles]
114116
permissions:
115117
issues: write
116-
# We disable this job on forks, because
118+
# We disable this job on forks, because
117119
# Use always() so the job doesn't get canceled if any other jobs fail
118120
if: ${{ github.repository == 'bevyengine/bevy' && always() && contains(needs.*.result, 'failure') }}
119121
steps:

0 commit comments

Comments
 (0)