Skip to content

fix: remove untrusted checkout in pr-labelling workflow#1867

Merged
markscott-ms merged 1 commit intofinos:mainfrom
rocketstack-matt:fix/pr-labeller-untrusted-checkout
Nov 27, 2025
Merged

fix: remove untrusted checkout in pr-labelling workflow#1867
markscott-ms merged 1 commit intofinos:mainfrom
rocketstack-matt:fix/pr-labeller-untrusted-checkout

Conversation

@rocketstack-matt
Copy link
Member

Description

Removes the explicit checkout of the PR head SHA in the pull_request_target
workflow to prevent potential code execution from untrusted PRs.

The labeler action uses GitHub API to detect changed files, so it only
needs the labeler config from the trusted base branch.

Fixes code scanning alert #51 (CWE-829)

https://github.com/finos/architecture-as-code/security/code-scanning/51

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Shared (shared/)
  • CALM Widgets (calm-widgets/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • Documentation (docs/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

Removes the explicit checkout of the PR head SHA in the pull_request_target
workflow to prevent potential code execution from untrusted PRs.

The labeler action uses GitHub API to detect changed files, so it only
needs the labeler config from the trusted base branch.

Fixes code scanning alert finos#51 (CWE-829)
Copilot AI review requested due to automatic review settings November 27, 2025 14:46
@rocketstack-matt rocketstack-matt requested a review from a team as a code owner November 27, 2025 14:46
Copy link
Contributor

Copilot AI 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 addresses a security vulnerability (CWE-829) in the pull_request_target workflow by removing the explicit checkout of the untrusted PR head SHA. The pull_request_target event runs in the context of the base branch, and checking out untrusted code can enable malicious code execution. Since the labeler action uses the GitHub API to detect changed files rather than examining the local filesystem, it only requires access to the labeler configuration from the trusted base branch.

  • Removed the ref parameter from the checkout action to prevent checking out untrusted PR code
  • Maintains labeler functionality while eliminating the security risk

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@markscott-ms markscott-ms merged commit 0862a76 into finos:main Nov 27, 2025
19 checks passed
@rocketstack-matt rocketstack-matt deleted the fix/pr-labeller-untrusted-checkout branch December 8, 2025 15:51
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.

3 participants