Skip to content
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: go.mod
Comment on lines +7 to +15
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/ci.yml

Repository: duneanalytics/cli

Length of output: 415


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Mutable action refs (not pinned to 40-char SHA) =="
rg -nP --type=yaml '^\s*-\s*uses:\s*[^@]+@(?!(?:[0-9a-f]{40})\b)' .github/workflows || true

echo
echo "== Workflows missing explicit top-level permissions =="
fd -t f '.+\.ya?ml' .github/workflows | while read -r f; do
  if ! rg -n '^\s*permissions:' "$f" >/dev/null; then
    echo "$f"
  fi
done

Repository: duneanalytics/cli

Length of output: 319


Pin action versions to commit SHAs and add explicit workflow permissions.

Lines 11 and 13 use mutable version tags (@v4, @v5) instead of pinned commit SHAs. The workflow also lacks an explicit top-level permissions: block, allowing the default GITHUB_TOKEN to retain full repository access. This creates supply-chain and privilege-escalation risks.

🔐 Recommended hardening
 name: CI

 on:
   push:
   pull_request:

+permissions:
+  contents: read
+
 jobs:
   test:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@<full-length-commit-sha> # pin v4

-      - uses: actions/setup-go@v5
+      - uses: actions/setup-go@<full-length-commit-sha> # pin v5
         with:
           go-version-file: go.mod

       - run: go test ./...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 7 - 15, Replace mutable action tags
actions/checkout@v4 and actions/setup-go@v5 with their pinned commit SHAs and
add an explicit top-level permissions: block to limit GITHUB_TOKEN scopes;
locate the workflow job definition around the job named "test" and update the
uses entries (actions/checkout and actions/setup-go) to their corresponding
commit SHA commits, then add a top-level permissions: mapping (e.g., read-only
for contents and minimal scopes required for the job) to the workflow root so
the workflow no longer relies on default full repository permissions.


- run: go test ./...