Skip to content

ci: harden workflows for OpenSSF Scorecard - #435

Merged
blue4209211 merged 2 commits into
mainfrom
chore/scorecard-hardening
May 29, 2026
Merged

ci: harden workflows for OpenSSF Scorecard#435
blue4209211 merged 2 commits into
mainfrom
chore/scorecard-hardening

Conversation

@mayankpande88

Copy link
Copy Markdown
Contributor

Addresses OpenSSF Scorecard findings on main.

Changes

Dangerous-Workflow — fix script injection (update-image-tags.yml)
github.head_ref / github.base_ref are attacker-controllable PR inputs (the PR branch/target name). They were interpolated inline via ${{ }} into run: shell and an actions/github-script body. A PR from a branch named e.g. $(...) could execute arbitrary code on the runner. Moved them into env: vars and reference as quoted "$HEAD_REF" / $BASE_REF (shell) and ${process.env.BASE_REF} (JS). The checkout with: ref: is left as-is — an action input, not a shell-injection sink.

Pinned-Dependencies

  • All GitHub Actions pinned to commit SHAs with # vX comments. Dependabot (github-actions ecosystem, already configured) keeps them current.
  • runner/Dockerfile base images pinned to multi-arch manifest-list digests: golang:1.26-alpine (1.26.3-alpine3.23) and alpine:3.23 (3.23.4).

Token-Permissions
The 5 chart/release workflows already had top-level permissions: contents: read on main (the scorecard report was stale here). Added the same top-level block to runner-image.yaml and runner-lint-test.yaml, which were still defaulting to write-all. Job-level packages: write escalation in runner-image.yaml is preserved.

Verification

  • All uses: references SHA-pinned (verified, none left on a @vN tag).
  • No inline ${{ github.head_ref }} / ${{ github.base_ref }} remaining in any run: or github-script body.
  • All 8 workflows parse as valid YAML.

Not included (separate follow-ups)

  • Vulnerabilities (21): Go dependency CVEs — needs govulncheck triage + bumps in runner/.
  • SAST: add a CodeQL workflow for the Go code.
  • Branch-Protection / Signed-Releases: repo-admin settings + a signed release.

Note: this touches runner-image.yaml, runner-lint-test.yaml, and runner/Dockerfile, which overlap with the in-flight chore/consolidate-runner branch; that branch will need a rebase.

Address Dangerous-Workflow, Pinned-Dependencies, and Token-Permissions
findings from the OpenSSF Scorecard.

- update-image-tags.yml: fix script injection. github.head_ref /
  github.base_ref are attacker-controllable PR inputs; move them out of
  inline ${{ }} in run:/github-script into env vars referenced as quoted
  "$HEAD_REF"/$BASE_REF (shell) and ${process.env.BASE_REF} (JS).
- Pin all GitHub Actions to commit SHAs (# vX comments; Dependabot keeps
  them current).
- Pin runner/Dockerfile base images to multi-arch manifest-list digests
  (golang:1.26-alpine, alpine:3.23).
- Add top-level `permissions: contents: read` to runner-image.yaml and
  runner-lint-test.yaml (the only workflows still defaulting to write-all);
  job-level packages:write escalation preserved.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the base images in the Dockerfile to pin them to specific SHA256 digests. The reviewer pointed out that the specified Go version (1.26) and Alpine version (3.23) do not exist, which will cause build failures, and recommended correcting these version tags and digests.

Comment thread runner/Dockerfile
Comment thread runner/Dockerfile
Comment thread runner/Dockerfile
blue4209211
blue4209211 previously approved these changes May 29, 2026
Default-setup CodeQL doesn't pick up the runner because Linguist
classifies this repo as Go Template + Shell (the Helm chart dominates).
Explicit workflow scans runner/ Go code and the workflow files
themselves on push, PR, and weekly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@blue4209211
blue4209211 merged commit 3c3f2a5 into main May 29, 2026
6 checks passed
@blue4209211
blue4209211 deleted the chore/scorecard-hardening branch May 29, 2026 19:17
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