1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Scorecard
# OpenSSF Scorecard grades this repository's security practices and
# publishes the result, which is what the README badge reads. Without
# this workflow the badge renders empty -- it did for months, because
# the badge was added and the thing that produces its data never was.
#
# `publish_results: true` is what makes the score public and feeds the
# badge. Without it the run computes a score that nothing can read.
on:
branch_protection_rule:
schedule:
- cron: "0 4 * * 1"
push:
branches:
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to publish the results and get a badge.
id-token: write
contents: read
actions: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
with:
results_file: results.sarif
results_format: sarif
publish_results: true
# Kept for 5 days so a dropped score can be compared against the
# run that produced it.
- name: Upload the results as an artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: SARIF file
path: results.sarif
retention-days: 5
# The results are deliberately NOT uploaded to code scanning.
#
# Scorecard reports posture scores -- "0 approved changesets",
# "branch protection is not maximal", "8 of 30 commits checked by
# a SAST tool". Those are ratios and policy observations, not
# defects in this code. Uploaded as SARIF they became 86 open
# "alerts" across the suite that nobody triaged and that no code
# change could clear, which is how a real finding gets lost.
#
# Code scanning now holds CodeQL results only, so an alert there
# means something about the code. The Scorecard result stays
# public through `publish_results: true` -- it feeds the README
# badge and the API -- and the SARIF is kept as an artifact
# above for anyone who wants to read it.