Skip to content

ci: restore security hardening to GitHub Actions workflows#29

Open
phillip-wenig-frequenz wants to merge 1 commit into
frequenz-floss:v0.x.xfrom
phillip-wenig-frequenz:revert-workflow
Open

ci: restore security hardening to GitHub Actions workflows#29
phillip-wenig-frequenz wants to merge 1 commit into
frequenz-floss:v0.x.xfrom
phillip-wenig-frequenz:revert-workflow

Conversation

@phillip-wenig-frequenz
Copy link
Copy Markdown
Collaborator

Summary

Restores the security hardening to CI workflows that was accidentally removed in #17, as tracked in #27.

  • Re-add workflow-level permissions: contents: read to both ci.yaml and ci-pr.yaml
  • Hash-pin all GitHub Actions (replacing floating @vX.Y tags with @<sha> # vX.Y) to prevent supply chain attacks
  • Restore python -I isolated mode on all Python/mike invocations to prevent arbitrary code execution from checked-out sources
  • Re-add permissions: {} and ubuntu-slim runner on gate/aggregation jobs (nox-all, test-installation-all) that only check matrix results
  • Restore ubuntu-slim runner on create-github-release
  • Restore safe bash array pattern for $ALIASES in the mike deploy step to prevent shell injection
  • Restore quoted "$REF_NAME" and safe extra_opts array in the GitHub release creation step
  • Restore python -Im (isolated module) calls for frequenz.repo.config CLI invocations

Closes #27.

@phillip-wenig-frequenz phillip-wenig-frequenz requested a review from a team as a code owner May 7, 2026 08:29
@phillip-wenig-frequenz phillip-wenig-frequenz requested review from llucax, shsms and simonvoelcker and removed request for a team May 7, 2026 08:29
@github-actions github-actions Bot added part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels May 7, 2026
@phillip-wenig-frequenz phillip-wenig-frequenz requested review from Copilot and removed request for simonvoelcker May 7, 2026 08:29
Restore security measures that were accidentally removed:
- Add workflow-level `permissions: contents: read` to restrict default token access
- Hash-pin all GitHub Actions to prevent supply chain attacks
- Restore `python -I` isolation flag on Python invocations to prevent code execution
- Use `ubuntu-slim` runner on gate/aggregation and release jobs
- Add `permissions: {}` to jobs that only aggregate matrix results
- Implement safe bash array pattern for `$ALIASES` to prevent shell injection
- Use proper quoting and array expansion for shell variables and options
- Restore `python -Im` module invocations for frequenz.repo.config CLI

Signed-off-by: Phillip Wenig <phillip.wenig@frequenz.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restores CI workflow security hardening that was previously removed, focusing on least-privilege GITHUB_TOKEN permissions, supply-chain protection via hash-pinned actions, and safer execution of Python/mike and shell handling in release/docs steps.

Changes:

  • Re-added workflow-level permissions: contents: read and tightened permissions for gate/aggregation jobs.
  • Hash-pinned GitHub Actions and restored isolated-mode Python invocations (python -I / python -Im), plus safer bash array handling for aliases and release options.
  • Documented the tooling/security hardening restoration in RELEASE_NOTES.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
RELEASE_NOTES.md Adds a release note entry describing the workflow security hardening restoration.
.github/workflows/ci.yaml Restores hardened defaults (permissions, runner choice for gate jobs), pins actions by SHA, and hardens docs/release shell & Python invocation.
.github/workflows/ci-pr.yaml Applies the same hardened defaults (permissions, action pinning, isolated-mode mike invocation) to PR CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yaml
Comment on lines 271 to 273
- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.4
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
with:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is fine, dependabot will take care of it.

Comment thread .github/workflows/ci.yaml
Comment thread .github/workflows/ci.yaml
Comment thread .github/workflows/ci-pr.yaml
Copy link
Copy Markdown
Contributor

@llucax llucax left a comment

Choose a reason for hiding this comment

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

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revert worsened workflow security

3 participants