Skip to content

ci: use commit hash for github action, add persist-credentials false - #643

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

ci: use commit hash for github action, add persist-credentials false#643
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.

Summary by CodeRabbit

  • Chores
    • Pinned workflow actions and tooling to immutable revisions for more consistent and secure automation.
    • Explicitly configured checkout credential handling across automated workflows.
    • Preserved required credentials only where workflows need to commit or push changes.

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

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

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c3503d13-228e-450e-a15b-f703b2a48f18

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c66368df-0a76-4c48-b26b-5b3bad5b92f4

📥 Commits

Reviewing files that changed from the base of the PR and between 954d8c8 and e6b230e.

📒 Files selected for processing (1)
  • .github/workflows/build_docs.yml

📝 Walkthrough

Walkthrough

GitHub Actions workflows now pin external actions and selected Git dependencies to immutable commits. Checkout steps explicitly set credential persistence according to whether later workflow steps need repository write access.

Changes

Workflow dependency pinning

Layer / File(s) Summary
CI tooling and test dependency pins
.github/workflows/ansible-*.yml, .github/workflows/python-unit-test.yml, .github/workflows/qemu-kvm-integration-tests.yml
CI workflows pin checkout, Python setup, tox-lsr, Podman, artifact, and status dependencies.
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 commit SHAs and configure checkout credentials.
Documentation and release workflow pins
.github/workflows/build_docs.yml, .github/workflows/changelog_to_tag.yml, .github/workflows/weekly_ci.yml
Documentation and release workflows pin action references. Credential persistence remains enabled for checkout steps that commit or push changes.
Integration and status workflow pins
.github/workflows/tft.yml, .github/workflows/test_converting_readme.yml
Testing Farm, commit-status, checkout, and artifact upload actions now use pinned commits.

Possibly related issues

  • linux-system-roles/.github issue 170 — The workflow changes pin actions/checkout and configure persist-credentials as requested.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description Format ⚠️ Warning The PR description has no Enhancement:/Feature:, Reason:, or Result: sections, although the repository template requires all three. Rewrite the PR description with labeled Enhancement (or Feature), Reason, and Result sections; retain the valid Signed-off-by 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 follows Conventional Commits format and accurately describes the workflow security changes.
Description check ✅ Passed The description explains the security reason, implementation result, behavior preservation, and related issue tracking.

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: 2

🧹 Nitpick comments (2)
.github/workflows/qemu-kvm-integration-tests.yml (1)

133-133: 🩺 Stability & Availability | 🔵 Trivial

Use a supported Podman repository before Questing is archived.

The pinned action defaults ubuntu-repository to questing. Ubuntu 25.10 is EOL and will move to old-releases.ubuntu.com. Configure a supported runner and repository combination that provides Podman 5 or newer.

🤖 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/qemu-kvm-integration-tests.yml at line 133, Update the
redhat-actions/podman-install action configuration in the QEMU KVM integration
workflow to use a supported Ubuntu runner and repository combination, explicitly
selecting a repository that is not Questing and provides Podman 5 or newer.
Preserve the existing pinned action reference and ensure the configured runner
matches the repository.
.github/workflows/changelog_to_tag.yml (1)

82-82: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Prefer the runner-provided gh command for release creation.

The supplied static analysis identifies ncipollo/release-action as superfluous. GitHub-hosted runners provide the GitHub CLI, and gh release create supports the current tag, title, notes-file, latest-release, and verify-tag behavior. Replacing this action removes one privileged third-party execution point. (cli.github.com)

Possible replacement
       - name: Create Release
-        id: create_release
-        uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd  # v1
-        with:
-          tag: ${{ steps.tag.outputs.tagname }}
-          name: Version ${{ steps.tag.outputs.tagname }}
-          bodyFile: ./.tagmsg.txt
-          makeLatest: true
+        env:
+          GH_TOKEN: ${{ github.token }}
+        run: |
+          gh release create "${{ steps.tag.outputs.tagname }}" \
+            --verify-tag \
+            --title "Version ${{ steps.tag.outputs.tagname }}" \
+            --notes-file ./.tagmsg.txt \
+            --latest

Verify the runner image exposes the required gh release create options before applying this refactor.
This suggestion is based on the provided zizmor hint and GitHub CLI documentation.

🤖 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 in the changelog workflow with the runner-provided
gh release create command, preserving the existing tag, title, notes-file,
latest-release, and verify-tag behavior. Confirm the configured runner supports
these gh release create options and retain the workflow’s current release inputs
and sequencing.

Source: 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 checkout step in the build-docs workflow to set
persist-credentials to true, ensuring the initial git push for a missing docs
branch can use the checkout-provided authentication.
- Around line 52-60: Update both later checkout steps in the workflow, including
the docs checkout and the README/template checkout, to disable persisted
credentials while preserving their existing refs and push-related settings.
Ensure the separate first-run branch-creation push is explicitly authenticated
or relies on docs being pre-created, without restoring persisted credentials on
these checkouts.

---

Nitpick comments:
In @.github/workflows/changelog_to_tag.yml:
- Line 82: Replace the ncipollo/release-action step in the changelog workflow
with the runner-provided gh release create command, preserving the existing tag,
title, notes-file, latest-release, and verify-tag behavior. Confirm the
configured runner supports these gh release create options and retain the
workflow’s current release inputs and sequencing.

In @.github/workflows/qemu-kvm-integration-tests.yml:
- Line 133: Update the redhat-actions/podman-install action configuration in the
QEMU KVM integration workflow to use a supported Ubuntu runner and repository
combination, explicitly selecting a repository that is not Questing and provides
Podman 5 or newer. Preserve the existing pinned action reference and ensure the
configured runner matches the repository.
🪄 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: a9bd5e48-4832-4a61-85a1-688423c1627d

📥 Commits

Reviewing files that changed from the base of the PR and between 738e800 and 954d8c8.

📒 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 Outdated
Comment thread .github/workflows/build_docs.yml Outdated
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 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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