Score-driven hardening: least-privilege tokens + checksummed Trivy#13
Merged
Conversation
Two fixes aimed at OpenSSF Scorecard's Token-Permissions (0/10) and
Pinned-Dependencies (6/10) findings.
Token-Permissions
weekly-audit had contents:write + pull-requests:write at workflow
level. Scorecard's rule: workflow-level perms must be minimal so any
future job added without an explicit block doesn't accidentally get
write. Moved both write perms to job level (only the scan job needs
them — peter-evans/create-pull-request pushes a branch and opens
the PR).
Pinned-Dependencies
All three workflows previously installed Trivy via:
curl .../trivy/v0.70.0/contrib/install.sh | sudo sh
Scorecard flags this as "downloadThenRun not pinned by hash" because
the install script's content isn't checksum-verified — only the URL
path is version-tagged. Replaced with a direct binary download:
pinned tarball URL + SHA256 verification (8b4376d5d6be...) + tar +
install. Same pattern as the actionlint workflow already established.
Doesn't address Code-Review (structural to solo project), CII Best
Practices (separate self-assessment), Fuzzing (N/A for templates), or
Branch-Protection (needs a PAT — separate PR).
Contributor
Trivy misconfiguration findings (HIGH + CRITICAL)Findings below. Fix the issue or add an ignore entry to |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two targeted fixes for the OpenSSF Scorecard findings that were driving us to 6.9:
Token-Permissions (0 → 10 expected)
weekly-audit.ymlhadcontents: write+pull-requests: writeat workflow level. Scorecard wants top-level minimal so a future job added without an explicit permissions block can't accidentally inherit write. Moved both write permissions to the job level (only thescanjob actually needs them —peter-evans/create-pull-requestpushes the branch and opens the PR).Pinned-Dependencies (6 → 10 expected)
All three workflows installed Trivy via
curl .../install.sh | sudo sh. Scorecard flagged this as "downloadThenRun not pinned by hash" because only the URL path was version-tagged — the script content itself wasn't verified. Replaced with the same pattern we use for actionlint: pinned tarball URL + SHA256 checksum verification + tar + install.Three workflows updated (
pr-cve-gate,pr-misconfig-scan,weekly-audit).Not addressed (yet)
-1/ "not measured" due to token scope) — needs a fine-grained PAT. Separate follow-up; instructions below.Expected score after merge
8.5–9.0, depending on weights. Scorecard re-runs on push to main, but the badge cache can take a few hours to refresh.
Test plan
scancheck passes trivially (no compose changes)Branch-Protection fix (follow-up — needs your action)
The error "some github tokens can't read classic branch protection rules" means the default token can't see branch protection. Fix:
wnstify/dockerSCORECARD_TOKENat Settings → Secrets and variables → ActionsThat alone should land another +1.0 on the average.