Security: Scorecard analysis #2541
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Security: Scorecard analysis" | |
on: | |
# Only the default branch is supported. | |
branch_protection_rule: | |
schedule: | |
# Weekly on Saturdays. | |
- cron: '30 1 * * 6' | |
push: | |
branches: [ main, master ] | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
analysis: | |
name: "Scorecard analysis" | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed if using Code scanning alerts | |
security-events: write | |
# Needed for GitHub OIDC token if publish_results is true | |
id-token: write | |
steps: | |
- name: "Harden Security" | |
uses: step-security/[email protected] | |
with: | |
egress-policy: block | |
disable-sudo: true | |
allowed-endpoints: > | |
api.github.com:443 | |
api.osv.dev:443 | |
api.securityscorecards.dev:443 | |
codeload.github.com:443 | |
fulcio.sigstore.dev:443 | |
github.com:443 | |
oss-fuzz-build-logs.storage.googleapis.com:443 | |
rekor.sigstore.dev:443 | |
tuf-repo-cdn.sigstore.dev:443 | |
www.bestpractices.dev:443 | |
- name: "Checkout code" | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
persist-credentials: false | |
- name: "Run analysis" | |
uses: ossf/[email protected] | |
with: | |
results_file: results.sarif | |
results_format: sarif | |
# (Optional) fine-grained personal access token. Uncomment the `repo_token` line below if: | |
# - you want to enable the Branch-Protection check on a *public* repository, or | |
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional. | |
repo_token: ${{ secrets.SOURCE_PUSH_TOKEN }} | |
# Publish the results for public repositories to enable scorecard badges. For more details, see | |
# https://github.com/ossf/scorecard-action#publishing-results. | |
# For private repositories, `publish_results` will automatically be set to `false`, regardless | |
# of the value entered here. | |
publish_results: true | |
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF | |
# format to the repository Actions tab. | |
- name: "Upload artifact" | |
uses: actions/[email protected] | |
with: | |
name: SARIF file | |
path: results.sarif | |
retention-days: 5 | |
# required for Code scanning alerts | |
- name: "Upload SARIF results to code scanning" | |
uses: github/codeql-action/[email protected] | |
with: | |
sarif_file: results.sarif |