Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Code Coverage

on:
push:
branches:
- main

jobs:
cover:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
services:
redis:
image: redis:5.0.7
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v5
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install Redis
run: |
apt-get update
apt-get install -y redis-server
redis-server --daemonize yes
redis-cli ping
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --all-features --workspace --timeout 120 --out xml
- name: Upload To codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
Comment on lines +10 to +36

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 9 months ago

To fix the problem, we should add an explicit permissions block to the job that is missing it. This block should specify the least privileges required. In this workflow, the job cover does not appear to need to write back to the repository (it only checks out code, installs dependencies, runs tests, and uploads coverage results). Therefore, setting permissions: contents: read at the job level (just above runs-on:) ensures only read access to repository contents, adhering to the principle of least privilege. No new imports or action changes are needed; only the YAML configuration is updated.

Suggested changeset 1
.github/workflows/code-coverage.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/code-coverage.yml b/.github/workflows/code-coverage.yml
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -7,6 +7,8 @@
 
 jobs:
   cover:
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
     container:
       image: xd009642/tarpaulin:develop-nightly
EOF
@@ -7,6 +7,8 @@

jobs:
cover:
permissions:
contents: read
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
Copilot is powered by AI and may make mistakes. Always verify output.
Loading
Loading