mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-25 22:24:58 +09:00
build-main.yaml and ui-test.yaml (the latter added by the in-tree console
move) landed without following the repo's workflow conventions: no top-level
permissions block and actions referenced by moving tags. Together they zero out
two OpenSSF Scorecard checks the rest of the tree already satisfies:
- Token-Permissions: scored on the weakest workflow, so one workflow with an
undeclared (default-write) top-level token drops the whole check to 0.
- Pinned-Dependencies: the six tag-pinned action refs count as unpinned.
Fix both files (top-level read-only token; job-level packages:write kept where
needed; all action refs pinned to the SHA already used elsewhere in the tree)
and add a durable gate so it cannot recur:
- .github/zizmor.yml enables the two Scorecard-relevant audits (unpinned-uses,
excessive-permissions), clean tree-wide as of this commit. The remaining
audits carry pre-existing debt and are disabled with a TODO to burn down and
re-enable one at a time.
- .pre-commit-config.yaml runs zizmor (offline) on changed workflows.
- .github/workflows/zizmor.yml runs the same audit tree-wide on every PR that
touches a workflow, failing on any reintroduced regression.
Also wire scorecard.yml to an optional SCORECARD_TOKEN secret: the default
GITHUB_TOKEN cannot read branch-protection settings, so the Branch-Protection
check is scored on partial data. The token is a no-op until the secret is added.
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
2.2 KiB
YAML
58 lines
2.2 KiB
YAML
name: OpenSSF Scorecard
|
|
|
|
on:
|
|
branch_protection_rule:
|
|
schedule:
|
|
# Run weekly on Mondays at 06:00 UTC.
|
|
- cron: '0 6 * * 1'
|
|
workflow_dispatch:
|
|
|
|
# Declare default permissions as read-only.
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
analysis:
|
|
name: Scorecard analysis
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
# Needed to publish results to the public scorecard.dev API
|
|
# (OIDC token allows publish without storing long-lived credentials).
|
|
id-token: write
|
|
# Needed to read repository contents.
|
|
contents: read
|
|
# Needed to read workflow definitions for the Dangerous-Workflow check.
|
|
actions: read
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Run analysis
|
|
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
|
with:
|
|
results_file: results.sarif
|
|
results_format: sarif
|
|
# The default GITHUB_TOKEN cannot read branch-protection settings, so
|
|
# the Branch-Protection check is scored on partial data. Provide a PAT
|
|
# with admin:read on the repo as the SCORECARD_TOKEN secret to let it
|
|
# see the full ruleset; falls back to the default token when unset, so
|
|
# this is a no-op until the secret is added.
|
|
repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }}
|
|
# Publish the results to the OpenSSF Scorecard public API so the
|
|
# project appears at https://scorecard.dev/viewer/?uri=github.com/cozystack/cozystack
|
|
publish_results: true
|
|
|
|
# SARIF is kept as a downloadable artifact only. It is intentionally NOT
|
|
# uploaded to GitHub code-scanning: Scorecard posts one alert per check,
|
|
# which floods the Security > Code scanning dashboard and buries CodeQL's
|
|
# first-party findings. The public scorecard.dev badge (publish_results
|
|
# above) is the canonical view of these results.
|
|
- name: Upload SARIF as artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: scorecard-sarif
|
|
path: results.sarif
|
|
retention-days: 5
|