Skip to content

Security: pin GitHub Actions to SHA hashes - #56

Merged
DMarinhoCodacy merged 1 commit into
masterfrom
security/pin-actions-to-sha
Apr 8, 2026
Merged

DMarinhoCodacy merged 1 commit into
masterfrom
security/pin-actions-to-sha

Conversation

@jorgebraz

Copy link
Copy Markdown
Contributor

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.

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

Actions left as tags: 0
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Alerts:

"

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

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

Pull Request Overview

While the PR successfully implements the security requirement of pinning GitHub Actions to SHA hashes, several critical errors in the specific commit hashes will cause immediate workflow failures and must be addressed before merging.

Invalid SHAs were detected for atlassian/gajira-login and atlassian/gajira-create, meaning these workflows will fail to initialize. Additionally, there is a systemic version mismatch for actions/github-script across all workflow files; the hashes point to version 3.x (Node 12 runtime) while being labeled as version 2.0.0. This could introduce breaking changes to existing logic.

About this PR

  • Multiple actions are pinned to non-existent SHAs in the Atlassian suite (gajira-login and gajira-create). These must be corrected to the valid commit hashes for the intended versions or the workflows will fail to pull the actions.
  • There is a systemic issue where the commit hashes used do not match the version labels provided in the comments. Specifically, the hash for actions/github-script points to v3.x while the code is labeled for v2.0.0. This pattern occurs in all modified YAML files.

Test suggestions

  • Verify actions/github-script is pinned to SHA 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45
  • Verify atlassian/gajira-login is pinned to SHA 90a599561baaf8c05b080645ed73db7391c246ed
  • Verify atlassian/gajira-create is pinned to SHA c0a9c69ac9d6aa063fed57201e55336ada860183
  • Verify atlassian/gajira-comment is pinned to SHA 8ec356b5df49f1325653db7ee2da2b59a1d78203

🗒️ Improve review quality by adding custom instructions

if: env.JIRA_CREATE_ISSUE_AUTO == 'true'
id: create_jira_issue
uses: atlassian/gajira-create@v2.0.1
uses: atlassian/gajira-create@c0a9c69ac9d6aa063fed57201e55336ada860183 # v2.0.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The SHA c0a9c69ac9d6aa063fed57201e55336ada860183 is invalid for the atlassian/gajira-create repository. Please use the official SHA associated with the v2.0.1 tag to ensure the action can be resolved correctly.

Suggested change
uses: atlassian/gajira-create@c0a9c69ac9d6aa063fed57201e55336ada860183 # v2.0.1
uses: atlassian/gajira-create@4459f4296b088828f0808a3d1d4d80a138981442 # v2.0.1

if: env.JIRA_CREATE_COMMENT_AUTO == 'true' && env.GITHUB_ISSUE_TYPE == 'issue' && env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL == 'true'
id: login
uses: atlassian/gajira-login@v2.0.0
uses: atlassian/gajira-login@90a599561baaf8c05b080645ed73db7391c246ed # v2.0.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.

🔴 HIGH RISK

The SHA 90a599561baaf8c05b080645ed73db7391c246ed does not exist in the official atlassian/gajira-login repository. Pinning to a SHA that cannot be resolved will cause the workflow to fail. Use the commit SHA for the official v2.0.0 tag instead.

Suggested change
uses: atlassian/gajira-login@90a599561baaf8c05b080645ed73db7391c246ed # v2.0.0
uses: atlassian/gajira-login@f463236e84d7a8d57b3f94ec601004246830509a # v2.0.0

if: env.JIRA_CREATE_COMMENT_AUTO == 'true'
id: github_issue_type
uses: actions/github-script@v2.0.0
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.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.

🔴 HIGH RISK

The SHA 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 corresponds to version v3.1.0, but the comment indicates v2.0.0. This mismatch appears on lines 21, 36, and 70 of this file. Version 3 introduced potential breaking changes, such as the switch to a Node 12 runtime. Please use the correct SHA for v2.0.0 to maintain compatibility.

Suggested change
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.0
uses: actions/github-script@79e000451f2216584c3bc1f7535b44c698e6c89f # v2.0.0

- name: Change Title
if: github.event.label.name == env.JIRA_ISSUE_LABEL
uses: actions/github-script@v2.0.0
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.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.

🟡 MEDIUM RISK

The commit SHA 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 corresponds to v3.0.0, but the label says v2.0.0. This also affects line 73 in this file.

Suggested change
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.0
uses: actions/github-script@79e000451f2216584c3bc1f7535b44c698e6c89f # v2.0.0

- name: Update GitHub issue
if: env.JIRA_CREATE_ISSUE_AUTO == 'true'
uses: actions/github-script@v2.0.0
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.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.

🟡 MEDIUM RISK

The commit SHA 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 corresponds to v3.0.0, but the label says v2.0.0. This also affects line 81 in this file.

Suggested change
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.0
uses: actions/github-script@79e000451f2216584c3bc1f7535b44c698e6c89f # v2.0.0

@DMarinhoCodacy
DMarinhoCodacy merged commit de85a42 into master Apr 8, 2026
1 check 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.

2 participants