Skip to content

Commit edb621f

Browse files
committed
feat(ci): add OpenSSF scorecard to workflow + README badge
1 parent c3f8e91 commit edb621f

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.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+
# Run on every push to master so the score reflects the current default branch.
5+
push:
6+
branches:
7+
- master
8+
# Run weekly to catch score changes driven by external factors (new checks, upstream CVEs, etc).
9+
schedule:
10+
- cron: '30 1 * * 6'
11+
# Run whenever branch protection rules change, as that directly affects the score.
12+
branch_protection_rule:
13+
14+
# Required by the Scorecard publish API to verify the workflow identity via OIDC.
15+
# The server-side enforcement for publish_results: true requires permissions: read-all at the
16+
# workflow level and prohibits top-level env: or defaults: blocks.
17+
permissions: read-all
18+
19+
jobs:
20+
scorecard:
21+
name: scorecard
22+
runs-on: ubuntu-latest
23+
permissions:
24+
# Required to upload SARIF results to the GitHub Security tab.
25+
security-events: write
26+
# Required for keyless OIDC token used to publish results to the public Scorecard API.
27+
id-token: write
28+
# Required to read workflow files and repository contents for analysis.
29+
contents: read
30+
actions: read
31+
steps:
32+
# Checkout without persisting credentials — Scorecard's server-side enforcement requires this
33+
# to prevent the workflow from being used to exfiltrate tokens.
34+
- name: Checkout code
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
persist-credentials: false
38+
39+
# Run the Scorecard analysis against this repository. publish_results: true pushes the score
40+
# to the public Scorecard API (api.scorecard.dev) and enables the README badge. Results are
41+
# also uploaded to the GitHub Security tab as SARIF alerts in the next step.
42+
- name: Run Scorecard analysis
43+
uses: ossf/scorecard-action@99c09fe975337306107572b4fdf4db224cf8e2f2 # v2.4.3
44+
id: scorecard
45+
with:
46+
results_file: scorecard-results.sarif
47+
results_format: sarif
48+
publish_results: true
49+
50+
# Upload Scorecard findings to the GitHub Security tab so each failing check appears as an
51+
# individual code scanning alert with remediation guidance.
52+
- name: Upload Scorecard results to GitHub Security tab
53+
uses: github/codeql-action/upload-sarif@cb06a0a8527b2c6970741b3a0baa15231dc74a4c # v4.34.1
54+
with:
55+
sarif_file: scorecard-results.sarif

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
[![Docker Pulls kube-router](https://img.shields.io/docker/pulls/cloudnativelabs/kube-router.svg?label=docker+pulls)](https://hub.docker.com/r/cloudnativelabs/kube-router/)
1515
[![](https://img.shields.io/github/release/cloudnativelabs/kube-router/all.svg?style=flat-square)](https://github.com/cloudnativelabs/kube-router/releases)
1616
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
17+
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/cloudnativelabs/kube-router/badge)](https://scorecard.dev/viewer/?uri=github.com/cloudnativelabs/kube-router)
1718
<!-- markdownlint-restore -->
1819

1920
kube-router is a turnkey solution for Kubernetes networking with the aim to provide operational simplicity and high performance.

0 commit comments

Comments
 (0)