Skip to content

Security: pin GitHub Actions to SHA hashes#578

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

Security: pin GitHub Actions to SHA hashes#578
DMarinhoCodacy merged 1 commit into
masterfrom
security/pin-actions-to-sha

Conversation

@jorgebraz

Copy link
Copy Markdown

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

codacy-production Bot commented Mar 24, 2026

Copy link
Copy Markdown

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

@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

This PR attempts to improve security by pinning GitHub Actions to SHA hashes; however, the implementation is currently incomplete and maintains a high-risk security vulnerability. Codacy analysis indicates that the changes are not up to standards.

The most critical issues involve a security vulnerability in the auto-merge.yml workflow configuration and an accidental version downgrade of the actions/checkout action. Furthermore, the PR fails to meet its own objective as one action remains pinned to a mutable tag. These issues must be addressed to ensure the stability and security of the CI/CD pipeline.

About this PR

  • There is no verification evidence or automated test run results provided to confirm that the chosen SHAs are correct and functional for this environment. Manual or CI verification of the workflows is necessary before merging.

Test suggestions

  • Verify the 'auto-merge' workflow executes successfully with pinned actions.
  • Verify the 'comment_issue' workflow executes successfully with pinned actions.
  • Verify the 'create_issue' workflow executes successfully with pinned actions.
  • Verify the 'create_issue_on_label' workflow executes successfully with pinned actions.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify the 'auto-merge' workflow executes successfully with pinned actions.
2. Verify the 'comment_issue' workflow executes successfully with pinned actions.
3. Verify the 'create_issue' workflow executes successfully with pinned actions.
4. Verify the 'create_issue_on_label' workflow executes successfully with pinned actions.

🗒️ Improve review quality by adding custom instructions

if: github.actor == 'dependabot[bot]'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2

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

Multiple issues identified in .github/workflows/auto-merge.yml:

  1. Security Vulnerability: Using pull_request_target while checking out the PR's head SHA allows untrusted code to access repository secrets. It is recommended to use the standard pull_request trigger instead.
  2. Version Downgrade: The SHA ee0669bd1cc54295c223e0bb666b733df41de1c5 pins actions/checkout to v2.0.0. Since the original code used @v2, this introduces a downgrade from the latest v2 patches. Use 2541b1294d2704b0964813337f33b291d3f8596b (v2.4.2) instead.
  3. Missed Pin: The action ahmadnassri/action-dependabot-auto-merge@v2 (referenced later in the file) was not updated to a SHA hash, which contradicts the goal of this PR.

See Issue in Codacy

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 5a8e268 to 121db32 Compare March 24, 2026 18:05
@DMarinhoCodacy DMarinhoCodacy merged commit 4c80a4b into master Apr 8, 2026
6 checks 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