Skip to content

Harden GitHub Actions security#3001

Merged
ferd merged 11 commits intoerlang:mainfrom
maennchen:ci
Mar 26, 2026
Merged

Harden GitHub Actions security#3001
ferd merged 11 commits intoerlang:mainfrom
maennchen:ci

Conversation

@maennchen
Copy link
Copy Markdown
Contributor

Summary

This PR contains multiple commits improving GitHub Actions security:

  • Pin GitHub Actions to commit SHAs - Prevent supply chain attacks via tag hijacking
  • Disable credential persistence - Add persist-credentials: false to all actions/checkout usages
  • Fix template injection - Use shell variable expansion instead of Actions template in brew install
  • Restrict workflow permissions - Add explicit contents: read permissions, scope write permissions to job level
  • Update GitHub Actions - Upgrade to latest versions:
    • actions/checkout: v2.7.0/v4.3.1 → v6.0.2
    • aws-actions/configure-aws-credentials: v1.7.0 → v4.3.1
  • Replace archived actions - Use gh CLI instead of archived actions/create-release and actions/upload-release-asset
  • Add security scanning - CodeQL workflow for static analysis and zizmor for CI/CD security auditing
  • Add build provenance attestation - Generate SLSA build provenance for releases with sigstore bundle
  • Add Dependabot - Keep GitHub Actions up to date

Similar changes have already been applied to:

Required Repository Settings

After merging, enable the following repository settings in "Rules" / "Rulesets":

Add "Require code scanning results" with the following tools:

  • CodeQL
  • zizmor

Set "Security Alerts" and "Alert" to "All":

Screenshot 2026-02-25 at 12 29 11

That way PR merges are blocked until all issues have been identified.

References

Fix zizmor unpinned-uses audit findings by replacing version tags
with full commit hashes for all action references.

See: https://docs.zizmor.sh/audits/#unpinned-uses
Set persist-credentials: false on all actions/checkout steps to
prevent credential leakage through artifacts.

See: https://docs.zizmor.sh/audits/#artipacked
Use shell variable expansion instead of GitHub Actions template
expansion to prevent potential code injection.

See: https://docs.zizmor.sh/audits/#template-injection
Add explicit permissions block to limit default GITHUB_TOKEN
permissions to read-only access.

See: https://docs.zizmor.sh/audits/#excessive-permissions
Move contents: write from workflow level to the specific job that
needs it, keeping workflow-level permissions read-only.

See: https://docs.zizmor.sh/audits/#excessive-permissions
- actions/checkout: v2.7.0/v4.3.1 → v6.0.2
- aws-actions/configure-aws-credentials: v1.7.0 → v4.3.1
Use gh release create/upload instead of the archived
actions/create-release and actions/upload-release-asset.

See: https://docs.zizmor.sh/audits/#archived-uses
Runs weekly and on pushes/PRs to main branch, analyzing Actions
workflow files for security issues.
Runs alongside CodeQL to detect workflow security issues.
Generate SLSA build provenance using actions/attest and include
the sigstore bundle alongside the rebar3 escript in releases.

Verify with: gh attestation verify rebar3 --owner erlang
@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.

Copy link
Copy Markdown
Collaborator

@ferd ferd left a comment

Choose a reason for hiding this comment

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

Sounds good, let's give it a try. If I see it breaks the nightly flows I will assume it might also break the release flow and we can rework things.

Comment thread .github/workflows/codeql.yml
@ferd ferd merged commit 21b0c56 into erlang:main Mar 26, 2026
10 checks passed
@maennchen maennchen deleted the ci branch March 26, 2026 14:37
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