Skip to content

ci: add OpenSSF Scorecard workflow - #412

Merged
TheGupta2012 merged 4 commits into
mainfrom
ci/openssf-scorecard
Aug 26, 2026
Merged

ci: add OpenSSF Scorecard workflow#412
TheGupta2012 merged 4 commits into
mainfrom
ci/openssf-scorecard

Conversation

@ryanhill1

Copy link
Copy Markdown
Member

Adds the OpenSSF Scorecard workflow, copied verbatim from qbraid-algorithms, where it
is already running and publishing a score to the public Scorecard API.

Scorecard grades a repository against supply-chain practices — branch protection, pinned
dependencies, token permissions, publishing provenance, code review — and publishes the
result at api.securityscorecards.dev, where anyone can look it up. The value is that a
third party computes the number rather than us.

Notes on the workflow itself, carried over from the original:

  • Action versions are pinned to full commit SHAs rather than tags, because a tag can be
    repointed at other code, and that is exactly what Scorecard's own Pinned-Dependencies
    check looks for.
  • Top-level permissions: {} means a job added later starts with nothing until it
    declares what it needs.
  • concurrency cancels superseded runs, since Scorecard reports current repository
    state and an outdated run has nothing to add.

Results upload to code scanning as SARIF and to the public API. No secrets are required;
id-token: write is what lets the run publish under the repository's identity.

@argus-eye

argus-eye Bot commented Aug 24, 2026

Copy link
Copy Markdown

Argus review

Auto-review is off for this repo. Tick the box below to run a review on this PR.

  • Trigger Argus review

Estimated cost

  • Files changed: 1
  • Diff lines (±): 61
  • Historical avg: ~243.6k tokens · ~$0.95 · across last 10 review(s)

Tip: you can also comment @argus-eye review at any time.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c692d21b-3cb0-4942-89ed-92a146bdb148

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread .github/workflows/scorecard.yml Outdated
# Lets Scorecard read workflow definitions and run history. Documented by the
# upstream starter workflow as required for private repositories; this repo is
# public, so it is retained only as a safeguard should that ever change.
actions: read

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed? As per the comment, it is present only as a safeguard if we choose to make pyqasm private , which might not be happening.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You're right, and it goes one line further than you flagged — contents: read has exactly the same status. Both removed in dd81908.

I dug through the OpenSSF sources rather than reason from the comment, since my own justification for the line turned out to be the weak part. Evidence, strongest last:

1. The endpoint Scorecard needs is publicly readable. Its only Actions API call is ListWorkflowRunsByFileName (checks/raw/github/packaging.go, checks/raw/binary_artifact.go), hitting GET /repos/{owner}/{repo}/actions/workflows/{file}/runs. Requesting that with no authentication at all returns 200; /user returned 401 in the same session, so the request really was anonymous. A token cannot have less access than anonymous on a public repo.

2. Upstream ships both commented out. actions/starter-workflows code-scanning/scorecard.yml:

      # Uncomment the permissions below if installing in a private repository.
      # contents: read
      # actions: read

So my comment's premise was right — private-repo only — and the conclusion I drew from it was wrong. Keeping it "as a safeguard" just meant carrying a permission that does nothing, which is what a least-privilege review should strip.

3. OSSF dogfoods it. ossf/scorecard and ossf/scorecard-action are both public and run with security-events: write and id-token: write alone. Last five runs green, and the checks that touch the Actions API score Packaging 10, Binary-Artifacts 10, CI-Tests 10. That is also what justifies dropping contents: read — their actions/checkout works without it.

Residual risk, stated plainly: both affected checks return an error rather than degrading if the call fails, so a mistake here surfaces as a check erroring, not as a silently lower score. The same workflow has already run green on qBraid and qbraid-algorithms with the wider permissions, giving a baseline to compare the next run against.

Same change: qBraid/qBraid#1354 and qBraid/qbraid-algorithms#97 (both merged their scorecard PRs before this came up, so they needed follow-ups).

@TheGupta2012 TheGupta2012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ryanhill1 looks good, just one comment regarding permissions

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@TheGupta2012

Copy link
Copy Markdown
Member

Haven't tested it 'cause we'll need it to be merged to main for it to appear in the actions.

TheGupta2012 and others added 2 commits August 25, 2026 13:08
Both are private-repository permissions and this repo is public.

The only Actions API call Scorecard makes is ListWorkflowRunsByFileName, from
the Packaging and Binary-Artifacts checks. That endpoint is publicly readable:
requesting it for a public repo with no authentication at all returns 200.

Upstream's starter workflow ships `contents: read` and `actions: read` commented
out under "uncomment if installing in a private repository", and OSSF runs
Scorecard on its own public repos -- ossf/scorecard and ossf/scorecard-action --
with `security-events: write` and `id-token: write` alone. Those runs are green
and score Packaging 10, Binary-Artifacts 10 and CI-Tests 10, which is the same
evidence for dropping `contents: read`: their checkout step works without it.
ryanhill1 added a commit to qBraid/qbraid-algorithms that referenced this pull request Aug 25, 2026
Both are private-repository permissions and this repo is public.

The only Actions API call Scorecard makes is ListWorkflowRunsByFileName, from
the Packaging and Binary-Artifacts checks. That endpoint is publicly readable:
requesting it for a public repo with no authentication at all returns 200.

Upstream's starter workflow ships `contents: read` and `actions: read` commented
out under "uncomment if installing in a private repository", and OSSF runs
Scorecard on its own public repos -- ossf/scorecard and ossf/scorecard-action --
with `security-events: write` and `id-token: write` alone. Those runs are green
and score Packaging 10, Binary-Artifacts 10 and CI-Tests 10, which is the same
evidence for dropping `contents: read`: their checkout step works without it.

Follows #94, which merged before this was raised in review on qBraid/pyqasm#412.
@TheGupta2012
TheGupta2012 self-requested a review August 26, 2026 05:22
@TheGupta2012
TheGupta2012 merged commit 09175f7 into main Aug 26, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants