|
| 1 | +# Based on `scorecard.yml` Github Actions starter workflow: |
| 2 | +# https://github.com/actions/starter-workflows/blob/b1df8a546ed4d0f27d46aaf2f8ac1118bc522638/code-scanning/scorecard.yml |
| 3 | + |
| 4 | +# This is separate from the CI workflow due to certain restrictions imposed by the GitHub Action action: |
| 5 | +# https://github.com/ossf/scorecard-action/tree/99cc02c8ee27bab5f5f41e79066e0de91d313dec#workflow-restrictions |
| 6 | +# For consistency, we should keep it a separate workflow across all our Github repositories, regardless if it's actually needed. |
| 7 | + |
| 8 | +name: OSSF Scorecard |
| 9 | +on: |
| 10 | + # For Branch-Protection check. Only the default branch is supported. See |
| 11 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection |
| 12 | + branch_protection_rule: {} |
| 13 | + # To guarantee Maintained check is occasionally updated. See |
| 14 | + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained |
| 15 | + schedule: |
| 16 | + - cron: '30 6 * * 5' |
| 17 | + push: |
| 18 | + branches: [master] |
| 19 | + |
| 20 | +# Declare default permissions as read only. |
| 21 | +# permissions: read-all |
| 22 | +permissions: {} |
| 23 | + |
| 24 | +jobs: |
| 25 | + analysis: |
| 26 | + name: Scorecard analysis |
| 27 | + runs-on: ubuntu-latest |
| 28 | + permissions: |
| 29 | + # Needed to upload the results to code-scanning dashboard. |
| 30 | + security-events: write |
| 31 | + # Needed to publish results and get a badge (see publish_results below). |
| 32 | + id-token: write |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0 |
| 36 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 37 | + with: |
| 38 | + disable-sudo: true |
| 39 | + egress-policy: block |
| 40 | + allowed-endpoints: > |
| 41 | + api.github.com:443 |
| 42 | + api.osv.dev:443 |
| 43 | + api.securityscorecards.dev:443 |
| 44 | + fulcio.sigstore.dev:443 |
| 45 | + github.com:443 |
| 46 | + oss-fuzz-build-logs.storage.googleapis.com:443 |
| 47 | + rekor.sigstore.dev:443 |
| 48 | + tuf-repo-cdn.sigstore.dev:443 |
| 49 | + www.bestpractices.dev:443 |
| 50 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 51 | + with: |
| 52 | + persist-credentials: false |
| 53 | + |
| 54 | + - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 |
| 55 | + with: |
| 56 | + results_file: results.sarif |
| 57 | + results_format: sarif |
| 58 | + # Public repositories: |
| 59 | + # - Publish results to OpenSSF REST API for easy access by consumers |
| 60 | + # - Allows the repository to include the Scorecard badge. |
| 61 | + # - See https://github.com/ossf/scorecard-action#publishing-results. |
| 62 | + # For private repositories: |
| 63 | + # - `publish_results` will always be set to `false`, regardless |
| 64 | + # of the value entered here. |
| 65 | + publish_results: true |
| 66 | + |
| 67 | + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF |
| 68 | + # format to the repository Actions tab. |
| 69 | + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 |
| 70 | + with: |
| 71 | + name: OSSF Scorecard SARIF file |
| 72 | + path: results.sarif |
| 73 | + retention-days: 90 |
| 74 | + |
| 75 | + # Upload the results to GitHub's code scanning dashboard. |
| 76 | + - uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5 |
| 77 | + with: |
| 78 | + sarif_file: results.sarif |
0 commit comments