Skip to content

Security: pin GitHub Actions to SHA hashes#61

Merged
afsmeira merged 1 commit intomasterfrom
security/pin-actions-to-sha
Mar 25, 2026
Merged

Security: pin GitHub Actions to SHA hashes#61
afsmeira merged 1 commit intomasterfrom
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

Copy link
Copy Markdown

@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

This PR implements security hardening by pinning GitHub Actions to immutable SHA-1 hashes, which is aligned with security best practices; Codacy quality standards are met. However, a critical logic bug was identified in .github/workflows/comment_issue.yml where incorrect variable scoping in if conditions prevents steps from executing. Additionally, there is a recurring discrepancy across all files where actions/github-script is pinned to a SHA for v3.1.0 while being labeled as v2.0.0 in the comments. These issues must be addressed to ensure the workflows function correctly and remain maintainable.

About this PR

  • Systemic inconsistency detected: The SHA hash used for actions/github-script (6e5ee1d...) corresponds to version v3.1.0, but the inline comments label it as v2.0.0. Please ensure the SHA and the version tag in the comment are synchronized to the intended version.

Test suggestions

  • Verify 'Comment issue on Jira' workflow executes successfully with pinned actions
  • Verify 'Create issue on Jira' workflow executes successfully with pinned actions
  • Verify 'Create issue on Jira when labeled' workflow executes successfully with pinned actions
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify 'Comment issue on Jira' workflow executes successfully with pinned actions
2. Verify 'Create issue on Jira' workflow executes successfully with pinned actions
3. Verify 'Create issue on Jira when labeled' workflow executes successfully with pinned actions

🗒️ Improve review quality by adding custom instructions

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 if condition for this step relies on env.GITHUB_ISSUE_TYPE and env.GITHUB_ISSUE_HAS_JIRA_ISSUE_LABEL, which are not defined in the job-level environment. Consequently, this step will never execute. Use step outputs directly in the condition.

- 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 SHA hash 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 belongs to v3.1.0. To pin to v2.0.0 as specified in the comment, use the correct SHA.

Suggested change
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.0
uses: actions/github-script@76387de5877f864e405d45d31139454174312781 # 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 SHA hash 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 belongs to v3.1.0. To pin to v2.0.0 as specified in the comment, use the correct SHA.

Suggested change
uses: actions/github-script@6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 # v2.0.0
uses: actions/github-script@76387de5877f864e405d45d31139454174312781 # 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.

🟡 MEDIUM RISK

The SHA hash 6e5ee1dc1cb3740e5e5e76ad668e3f526edbfe45 belongs to v3.1.0. To strictly pin to v2.0.0 as specified in the comment, use the correct SHA.

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

@afsmeira afsmeira merged commit 84a97b4 into master Mar 25, 2026
3 checks passed
@jorgebraz jorgebraz deleted the security/pin-actions-to-sha branch March 25, 2026 10:42
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