Skip to content

Security: pin GitHub Actions to SHA hashes#17

Open
jorgebraz wants to merge 1 commit intomasterfrom
security/pin-actions-to-sha
Open

Security: pin GitHub Actions to SHA hashes#17
jorgebraz wants to merge 1 commit intomasterfrom
security/pin-actions-to-sha

Conversation

@jorgebraz
Copy link

Pins all GitHub Actions from mutable tags/branches to immutable SHA hashes.

This prevents supply chain attacks like the TeamPCP/Trivy incident (March 2026), where attackers force-pushed tags to point at malicious commits.

Auto-generated by the Codacy security audit script.

@codacy-production
Copy link

codacy-production bot commented Mar 24, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes. Give us feedback

Copy link

@codacy-production codacy-production bot 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

While this PR correctly implements the move to SHA pinning for security, it introduces critical regressions and misses one action.

Most significantly, the pinning of actions/github-script in jira.yml to v4.0.2 will cause the workflow to fail, as the script utilizes the github.rest API introduced in v5. Additionally, multiple actions (checkout, setup-node) have been regressed to much older versions, which removes recent security and performance improvements. One action, Rebilly/lexi, was missed entirely. These issues should be resolved to maintain workflow functionality and security standards.

About this PR

  • Consider adding an automated linting step (e.g., using actionlint) to your CI/CD pipeline to ensure that all future GitHub Actions additions or updates are enforced to use SHA-1 hashes.

Test suggestions

  • Pin actions/checkout to SHA in all workflows
  • Pin tj-actions/changed-files to SHA in deleted-files.yml
  • Pin thollander/actions-comment-pull-request to SHA in deleted-files.yml
  • Pin actions/setup-node to SHA in docusaurus.yml
  • Pin peaceiris/actions-gh-pages to SHA in docusaurus.yml
  • Pin atlassian/gajira actions to SHA in jira.yml
  • Pin actions/github-script to SHA in jira.yml
  • Pin Rebilly/lexi to SHA in readability.yml
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Pin Rebilly/lexi to SHA in readability.yml

🗒️ Improve review quality by adding custom instructions


- name: Add comment to GitHub issue
uses: actions/github-script@v7
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The SHA f28e40c7f34bde8b3046d885e986cb6290c5673b corresponds to v4.0.2. Please update to the latest v7 SHA to ensure compatibility with 'github.rest.issues.createComment'.

Suggested change
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffec1c3799cdea # v7.0.1


- name: Update title of GitHub issue
uses: actions/github-script@v7
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The SHA f28e40c7f34bde8b3046d885e986cb6290c5673b corresponds to v4.0.2. Since this script relies on 'github.rest' (introduced in v5), using v4 will cause a ReferenceError at runtime. Please update to the latest v7 SHA.

Suggested change
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffec1c3799cdea # v7.0.1

steps:
- name: Checkout repo with history
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

The SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 corresponds to v2.4.2. Use the correct SHA for the current v4 release.

Suggested change
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7


- name: Setup Node
uses: actions/setup-node@v4
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

The SHA 49933ea5288caeca8642d1e84afbd3f7d6820020 corresponds to v3.8.1. To match the intended version v4, use the correct SHA for the latest v4 release.

Suggested change
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
uses: actions/setup-node@1d71ad2e3bb7c1861502197f1f3ad01a9bd8107c # v4.0.2

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

The SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 corresponds to v2.4.2. Please use the SHA for the latest v4 release instead.

Suggested change
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

The SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 corresponds to v2.4.2. Since the workflow was using v4, please use the correct SHA for the latest v4 release.

Suggested change
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- uses: Rebilly/lexi@v2

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: The 'Rebilly/lexi@v2' action remains pinned to a mutable version tag. To meet the security objectives of this PR, please pin this to a specific SHA-1 hash and include the version tag as a comment.

Replaces mutable tag/branch references with immutable SHA hashes
to prevent supply chain attacks (ref: TeamPCP/Trivy March 2026).

Actions left as tags: 0
@jorgebraz jorgebraz force-pushed the security/pin-actions-to-sha branch from 17af98c to ddd6e46 Compare March 24, 2026 18:14
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