ci: add OpenSSF Scorecard workflow - #2720
Conversation
Runs the OpenSSF Scorecard action on: - weekly schedule (Mon 06:00 UTC) - branch protection rule changes - pushes to main - manual dispatch Publishes results to: - the public OpenSSF Scorecard API (scorecard.dev) for transparency - the GitHub code-scanning dashboard (Security tab) for triage No README badge is added yet — the badge will be introduced in a follow-up PR once the first scans have run and any quick-win improvements (token permissions, dependency pinning) have landed. Aligns with the project's CNCF Incubation readiness work and the security self-assessment in progress. Signed-off-by: Timur Tukaev <timur.tukaev@aenix.io>
📝 WalkthroughWalkthroughThis PR introduces a new GitHub Actions workflow ( ChangesSecurity Scanning Workflow Setup
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/scorecard.yml:
- Line 32: The workflow uses mutable action tags—replace each occurrence of
actions/checkout@v4, ossf/scorecard-action@v2, actions/upload-artifact@v4, and
github/codeql-action/upload-sarif@v3 with the corresponding full commit SHA for
the specific action release you want pinned; locate the correct commit SHA on
each action's GitHub repository (Releases/Tags), update the uses lines to use
the full SHA (e.g., actions/checkout@<full-sha>) so the workflow references an
immutable commit, and commit the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 579a1c33-7790-4031-82eb-fb55764bcdcb
📒 Files selected for processing (1)
.github/workflows/scorecard.yml
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Read-only verification: confirm there are no tag-based action refs left.
rg -nP '^\s*uses:\s*[^@]+@v\d+(\.\d+)?$' .github/workflows/scorecard.yml
# Expected: no output after pinning.Repository: cozystack/cozystack
Length of output: 240
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE=".github/workflows/scorecard.yml"
echo "== Uses lines =="
rg -n '^\s*uses:\s*' "$FILE"
echo
echo "== Uses with tag refs like `@v4` / `@v2.1` / `@v3` =="
rg -nP '^\s*uses:\s*[^@]+@v\d+(\.\d+)?$' "$FILE" || true
echo
echo "== Uses with commit-SHA refs (40 hex chars) =="
rg -nP '^\s*uses:\s*[^@]+@[0-9a-fA-F]{40}$' "$FILE" || true
echo
echo "== File excerpt (1-90) =="
nl -ba "$FILE" | sed -n '1,90p'Repository: cozystack/cozystack
Length of output: 620
Pin all uses actions to full commit SHAs in scorecard.yml.
The workflow still references mutable action tags:
actions/checkout@v4(32)ossf/scorecard-action@v2(37)actions/upload-artifact@v4(46)github/codeql-action/upload-sarif@v3(53)
Replace each @v* with the corresponding immutable commit SHA to prevent silent upstream changes.
Suggested change
- - name: Checkout repository
- uses: actions/checkout@v4
+ - name: Checkout repository
+ uses: actions/checkout@<FULL_COMMIT_SHA>
- - name: Run analysis
- uses: ossf/scorecard-action@v2
+ - name: Run analysis
+ uses: ossf/scorecard-action@<FULL_COMMIT_SHA>
- - name: Upload SARIF as artifact
- uses: actions/upload-artifact@v4
+ - name: Upload SARIF as artifact
+ uses: actions/upload-artifact@<FULL_COMMIT_SHA>
- - name: Upload SARIF to code-scanning
- uses: github/codeql-action/upload-sarif@v3
+ - name: Upload SARIF to code-scanning
+ uses: github/codeql-action/upload-sarif@<FULL_COMMIT_SHA>🧰 Tools
🪛 zizmor (1.25.2)
[error] 32-32: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/scorecard.yml at line 32, The workflow uses mutable action
tags—replace each occurrence of actions/checkout@v4, ossf/scorecard-action@v2,
actions/upload-artifact@v4, and github/codeql-action/upload-sarif@v3 with the
corresponding full commit SHA for the specific action release you want pinned;
locate the correct commit SHA on each action's GitHub repository
(Releases/Tags), update the uses lines to use the full SHA (e.g.,
actions/checkout@<full-sha>) so the workflow references an immutable commit, and
commit the change.
## What this PR does Fixes the OpenSSF Scorecard workflow added in #2720. The initial workflow used floating major-version tags (`@v2`, `@v4`, `@v3`). `ossf/scorecard-action` does not publish a floating `v2` tag — only specific patch releases — so the first scheduled run failed: > Unable to resolve action `ossf/scorecard-action@v2`, unable to find version `v2` This PR pins every action by its full commit SHA with a trailing comment showing the human-readable version. This also satisfies the **Pinned-Dependencies** Scorecard check itself. - `actions/checkout@de0fac2` (v6.0.2) - `ossf/scorecard-action@4eaacf0` (v2.4.3) - `actions/upload-artifact@043fb46` (v7.0.1) - `github/codeql-action/upload-sarif@03e4368` (v3) ### Release note ```release-note NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated CI/CD infrastructure dependency versions to maintain security and stability. **Note:** This release contains no user-facing changes. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/cozystack/cozystack/pull/2721?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
What this PR does
Adds a GitHub Actions workflow that runs the OpenSSF Scorecard on this repository.
Schedule
mainWhere results go
scorecard.dev— transparency for adopters and reviewers (CNCF DD).Token permissions
Default
read-all, with the minimum required scopes elevated only inside the analysis job:security-events: write— upload to code scanningid-token: write— publish toscorecard.devvia OIDC, no long-lived secretcontents: read,actions: readWhy no README badge yet
This PR enables the workflow but does not add a badge to the README. Once the first scans have completed and quick-win improvements (token permissions across other workflows, dependency pinning in workflows, etc.) have landed, a follow-up PR will add the badge.
Context
Release note
```release-note
NONE
```
Summary by CodeRabbit