Skip to content

Harden GitHub actions#424

Merged
flavorjones merged 7 commits into
masterfrom
harden-github-actions
May 27, 2026
Merged

Harden GitHub actions#424
flavorjones merged 7 commits into
masterfrom
harden-github-actions

Conversation

@flavorjones
Copy link
Copy Markdown
Contributor

@flavorjones flavorjones commented May 27, 2026

Using zizmor, pinact, and actionlint to harden the github actions configuration.

  • all actions pinned to SHAs (using pinact and a minimum age of 7 days)
  • lock down permissions: empty at top level, contents read per job, and persist-credentials false on checkouts
  • suppress the SC2086 shellcheck warning on the gem update --system command
  • added a lint-actions CI job running zizmor and actionlint to prevent regresssions
  • added a dependabot config for bundler and actions (weekly, 7-day cooldown)

cc @jasnow @connorshea @simi

Runs actionlint and zizmor on workflow files. Placed after the
rubocop lint job since it is a linting concern.

🤖 Assisted by Claude
Batches all github-actions updates into a single weekly PR. Adds
cooldown windows to both ecosystems so updates soak before landing;
github-actions matches the 7-day pinact --min-age.

🤖 Assisted by Claude
Ran `pinact run --min-age 7` to pin all actions to commit SHAs with
version comments. Matches the 7-day cooldown in dependabot.yml.

🤖 Assisted by Claude
Resolves zizmor medium findings:
- excessive-permissions: deny-all permissions: {} at workflow level,
  scope contents: read per job
- artipacked: persist-credentials: false on checkout in test/lint jobs
  (neither pushes to git)

🤖 Assisted by Claude
actionlint/shellcheck flags the unquoted ${RUBYGEMS_VERSION:-}, but the
unquoted expansion is intentional: when the version is unset the arg
must vanish so `gem update --system` picks the latest. Quoting would
pass an empty version string instead. Suppress with a reason.

🤖 Assisted by Claude
Copy link
Copy Markdown
Contributor

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

This PR hardens the repository’s GitHub Actions setup by pinning actions to SHAs, tightening workflow permissions, and adding automated linting/auditing to prevent future regressions.

Changes:

  • Tightens workflow triggers/permissions and disables credential persistence on checkouts.
  • Pins referenced actions to commit SHAs and documents versions inline.
  • Adds a lint-actions job (actionlint + zizmor) and introduces a Dependabot configuration for Bundler and GitHub Actions.

Reviewed changes

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

File Description
.github/workflows/ruby.yml Restricts triggers, locks down permissions, pins actions by SHA, and adds a new CI job to lint/audit workflows.
.github/dependabot.yml Adds weekly Dependabot updates for Bundler and GitHub Actions with cooldown settings.

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

Comment thread .github/workflows/ruby.yml
Comment thread .github/workflows/ruby.yml
Comment thread .github/workflows/ruby.yml
Comment thread .github/workflows/ruby.yml Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
contents: read

steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

any reason to keep it on 2.7 rather than updating to v6?

Copy link
Copy Markdown
Contributor Author

@flavorjones flavorjones May 27, 2026

Choose a reason for hiding this comment

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

No reason other than trying to keep it consistent with the previous @v2 tag used everywhere else. Dependabot will update it when it runs and then we should be all up-to-date with a separate PR that updates the versions.

Copy link
Copy Markdown

@connorshea connorshea left a comment

Choose a reason for hiding this comment

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

LGTM

@flavorjones flavorjones merged commit bd297f4 into master May 27, 2026
11 checks passed
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