Skip to content

Commit 3a8d1c5

Browse files
authored
ci: add OpenSSF Scorecard workflow (#2720)
## What this PR does Adds a GitHub Actions workflow that runs the [OpenSSF Scorecard](https://github.com/ossf/scorecard) on this repository. ### Schedule - Weekly on Mondays at 06:00 UTC - On branch protection rule changes - On pushes to `main` - Manual dispatch ### Where results go - **Public** [`scorecard.dev`](https://scorecard.dev/viewer/?uri=github.com/cozystack/cozystack) — transparency for adopters and reviewers (CNCF DD). - **Code-scanning dashboard** (Security tab) — for in-team triage of individual findings. - SARIF artifact retained for 5 days for local inspection. ### Token permissions Default `read-all`, with the minimum required scopes elevated only inside the analysis job: - `security-events: write` — upload to code scanning - `id-token: write` — publish to `scorecard.dev` via OIDC, no long-lived secret - `contents: read`, `actions: read` ### Why 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 - Tracked under the project's CNCF Incubation readiness work and the in-progress security self-assessment. - Companion to the OpenSSF Best Practices passing badge (https://www.bestpractices.dev/en/projects/10177) — Scorecard adds machine-verifiable, continuously-updated evidence; Best Practices captures self-attested controls. ### Release note \`\`\`release-note NONE \`\`\` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added automated security scanning to the development process to continuously monitor codebase health and security posture. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/cozystack/cozystack/pull/2720?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 -->
2 parents b689613 + 2396d08 commit 3a8d1c5

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

‎.github/workflows/scorecard.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: OpenSSF Scorecard
2+
3+
on:
4+
branch_protection_rule:
5+
schedule:
6+
# Run weekly on Mondays at 06:00 UTC.
7+
- cron: '0 6 * * 1'
8+
push:
9+
branches: [main]
10+
workflow_dispatch:
11+
12+
# Declare default permissions as read-only.
13+
permissions: read-all
14+
15+
jobs:
16+
analysis:
17+
name: Scorecard analysis
18+
runs-on: ubuntu-latest
19+
permissions:
20+
# Needed to upload the results to the GitHub code-scanning dashboard.
21+
security-events: write
22+
# Needed to publish results to the public scorecard.dev API
23+
# (OIDC token allows publish without storing long-lived credentials).
24+
id-token: write
25+
# Needed to read repository contents.
26+
contents: read
27+
# Needed to read workflow definitions for the Dangerous-Workflow check.
28+
actions: read
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
persist-credentials: false
35+
36+
- name: Run analysis
37+
uses: ossf/scorecard-action@v2
38+
with:
39+
results_file: results.sarif
40+
results_format: sarif
41+
# Publish the results to the OpenSSF Scorecard public API so the
42+
# project appears at https://scorecard.dev/viewer/?uri=github.com/cozystack/cozystack
43+
publish_results: true
44+
45+
- name: Upload SARIF as artifact
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: scorecard-sarif
49+
path: results.sarif
50+
retention-days: 5
51+
52+
- name: Upload SARIF to code-scanning
53+
uses: github/codeql-action/upload-sarif@v3
54+
with:
55+
sarif_file: results.sarif

0 commit comments

Comments
 (0)