Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: OpenSSF Scorecard

on:
push:
branches: [main]
schedule:
- cron: "30 1 * * 6"
workflow_dispatch:

# Keep the default token read-only. The analysis job grants only the two
# additional capabilities needed to publish its independently generated result.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write
Comment on lines +19 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Grant contents read to the analysis job

This job-level permissions block overrides the workflow-level read-all; GitHub's permissions docs say omitted scopes are set to none, so the default token used by the very next actions/checkout step no longer has contents: read. Since checkout's documented recommended permission is contents: read unless an alternate token/SSH key is provided, add that scope here so scheduled/manual Scorecard runs can fetch and scan the repository.

Useful? React with 👍 / 👎.

steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- name: Run analysis
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0 # v7.0.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the full upload-artifact commit SHA

This uses: ref is only 39 hex characters, so it is an abbreviated commit rather than the full-length SHA used by the other action pins. In repositories or organizations that enforce GitHub's SHA-pinning policy, and for the Scorecard Pinned-Dependencies signal this workflow is meant to improve, this can be treated as not pinned to a full-length immutable commit; replace it with the full v7.0.1 commit SHA (the ref appears to be missing the trailing a).

Useful? React with 👍 / 👎.

with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: Upload to code scanning
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
sarif_file: results.sarif
Loading