Skip to content

ci: use commit hash for github action, add persist-credentials false [citest_skip] - #896

Closed
richm wants to merge 2 commits into
mainfrom
use-commit-hash
Closed

ci: use commit hash for github action, add persist-credentials false [citest_skip]#896
richm wants to merge 2 commits into
mainfrom
use-commit-hash

Conversation

@richm

@richm richm commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

The latest security guidance is to use the full commit hash, which is immutable,
instead of a tag or version, which can be mutable, for the reference to a version
of a github action. There are known attacks which inserted unauthorized code
in a version tag and moved the tag. This prevents this sort of attack, at the
cost of more maintenance burden, but dependabot will largely take care of this
for us.

Each version or tag has been replaced with the corresponding commit hash - in some
cases, this is not the latest commit on the main branch, so I would expect to see
some dependabot updates in the near future. I thought it was safer to do it this
way - preserve existing behavior/functionality - rather than replace and upgrade
to a newer version at the same time.

The coderabbit Pin the Galaxy action's container image. issue is tracked at
robertdebock/galaxy-action#16

This also adds persist-credentials: false to the actions/checkout tasks so that
any credentials used by that task will not persist for subsequent tasks, for those
workflows that do not need the credentials for subsequent tasks.

@richm richm self-assigned this Aug 12, 2026
The latest security guidance is to use the full commit hash, which is immutable,
instead of a tag or version, which can be mutable, for the reference to a version
of a github action.  There are known attacks which inserted unauthorized code
in a version tag and moved the tag.  This prevents this sort of attack, at the
cost of more maintenance burden, but dependabot will largely take care of this
for us.

Each version or tag has been replaced with the corresponding commit hash - in some
cases, this is not the latest commit on the main branch, so I would expect to see
some dependabot updates in the near future.  I thought it was safer to do it this
way - preserve existing behavior/functionality - rather than replace and upgrade
to a newer version at the same time.

This also adds `persist-credentials: false` to the actions/checkout tasks so that
any credentials used by that task will not persist for subsequent tasks.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The workflows replace mutable GitHub Actions references and selected tox-lsr version references with pinned commits. Checkout steps also disable persisted credentials.

CI dependency pinning

Layer / File(s) Summary
Test workflow toolchain pins
.github/workflows/ansible-lint.yml, .github/workflows/ansible-managed-var-comment.yml, .github/workflows/ansible-test.yml, .github/workflows/python-unit-test.yml, .github/workflows/qemu-kvm-integration-tests.yml
Test workflows pin actions and tox-lsr to specific commits.
Documentation and release workflow pins
.github/workflows/build_docs.yml, .github/workflows/changelog_to_tag.yml, .github/workflows/test_converting_readme.yml
Documentation, release, tagging, publishing, and artifact actions now use pinned commits.
Analysis and lint workflow pins
.github/workflows/codeql.yml, .github/workflows/codespell.yml, .github/workflows/markdownlint.yml, .github/workflows/pr-title-lint.yml, .github/workflows/shellcheck.yml, .github/workflows/woke.yml
Analysis and lint workflows replace mutable action references with pinned commits.
Integration and status workflow pins
.github/workflows/qemu-kvm-integration-tests.yml, .github/workflows/tft.yml, .github/workflows/weekly_ci.yml
Integration, Testing Farm, status, artifact, and GitHub Script actions now use pinned commits.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description Format ⚠️ Warning The template requires Enhancement/Feature, Reason, and Result sections; the supplied description has none, although it includes a valid Signed-off-by line. Rewrite the PR description with Enhancement or Feature, Reason, and Result sections, and retain the Signed-off-by line with the contributor's name and email.
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title uses the valid ci type, follows Conventional Commits syntax, and accurately describes the workflow security changes. (github.com)
Description check ✅ Passed The description explains the reason, implementation result, credential change, and tracked issue, so it covers the template content despite missing section headings.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/changelog_to_tag.yml (1)

82-82: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider replacing the superfluous release action.

zizmor reports ncipollo/release-action as a superfluous action. This step has no output consumer in the workflow. A token-authenticated gh release create step can preserve the tag, title, notes file, and latest-release behavior while removing one third-party action. Verify --verify-tag, --notes-file, --title, --latest, and token permissions before changing it. GitHub CLI supports these options. (cli.github.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/changelog_to_tag.yml at line 82, Replace the
ncipollo/release-action step with a token-authenticated GitHub CLI release
creation step, preserving the existing tag, title, notes file, and
latest-release behavior. Configure the command with --verify-tag, --notes-file,
--title, and --latest, and ensure the workflow grants the token permissions
required to create releases.

Sources: MCP tools, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build_docs.yml:
- Around line 28-30: Update the workflow’s actions/checkout configuration so the
docs-branch initialization push in the surrounding git flow is authenticated:
either enable checkout credential persistence or explicitly configure origin
with secrets.GITHUB_TOKEN before the push. Preserve the existing branch creation
and push behavior.

In @.github/workflows/changelog_to_tag.yml:
- Line 90: Update the robertdebock/galaxy-action invocation in the workflow to
use a publisher or action revision whose Docker container image is pinned by
immutable digest rather than the mutable latest tag, while preserving the
existing galaxy_api_key input and action behavior.

In @.github/workflows/weekly_ci.yml:
- Around line 33-35: Update the checkout step using actions/checkout to preserve
Git authentication for the later git push: remove persist-credentials: false, or
explicitly configure masked Git credentials before the push. Keep the existing
commit identity configuration unchanged.

In @.github/workflows/woke.yml:
- Around line 18-20: Update the “Run lsr-woke-action” workflow step so the
downloaded woke executable from the nhosoi/woke source is pinned to an immutable
commit or verified by checksum, rather than following main. Preserve the
existing action pin while configuring its downloaded artifact reference
accordingly.

---

Nitpick comments:
In @.github/workflows/changelog_to_tag.yml:
- Line 82: Replace the ncipollo/release-action step with a token-authenticated
GitHub CLI release creation step, preserving the existing tag, title, notes
file, and latest-release behavior. Configure the command with --verify-tag,
--notes-file, --title, and --latest, and ensure the workflow grants the token
permissions required to create releases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f0d09290-4884-403d-af93-3eedc22647cf

📥 Commits

Reviewing files that changed from the base of the PR and between 88fd7be and 7cf895d.

📒 Files selected for processing (16)
  • .github/workflows/ansible-lint.yml
  • .github/workflows/ansible-managed-var-comment.yml
  • .github/workflows/ansible-test.yml
  • .github/workflows/build_docs.yml
  • .github/workflows/changelog_to_tag.yml
  • .github/workflows/codeql.yml
  • .github/workflows/codespell.yml
  • .github/workflows/markdownlint.yml
  • .github/workflows/pr-title-lint.yml
  • .github/workflows/python-unit-test.yml
  • .github/workflows/qemu-kvm-integration-tests.yml
  • .github/workflows/shellcheck.yml
  • .github/workflows/test_converting_readme.yml
  • .github/workflows/tft.yml
  • .github/workflows/weekly_ci.yml
  • .github/workflows/woke.yml

Comment thread .github/workflows/build_docs.yml
Comment thread .github/workflows/changelog_to_tag.yml
Comment thread .github/workflows/weekly_ci.yml Outdated
Comment thread .github/workflows/woke.yml Outdated
@richm richm changed the title ci: use commit hash for github action, add persist-credentials false ci: use commit hash for github action, add persist-credentials false [citest_skip] Aug 12, 2026
…[citest_skip]

The latest security guidance is to use the full commit hash, which is immutable,
instead of a tag or version, which can be mutable, for the reference to a version
of a github action.  There are known attacks which inserted unauthorized code
in a version tag and moved the tag.  This prevents this sort of attack, at the
cost of more maintenance burden, but dependabot will largely take care of this
for us.

Each version or tag has been replaced with the corresponding commit hash - in some
cases, this is not the latest commit on the main branch, so I would expect to see
some dependabot updates in the near future.  I thought it was safer to do it this
way - preserve existing behavior/functionality - rather than replace and upgrade
to a newer version at the same time.

The coderabbit `Pin the Galaxy action's container image.` issue is tracked at
robertdebock/galaxy-action#16

This also adds `persist-credentials: false` to the actions/checkout tasks so that
any credentials used by that task will not persist for subsequent tasks, for those
workflows that do not need the credentials for subsequent tasks.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm richm closed this Aug 12, 2026
@richm
richm deleted the use-commit-hash branch August 12, 2026 23:01
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.

1 participant