You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request updates the extended-pr-validation.yml workflow to improve security and validation checks for pull request events. The main changes are focused on tightening permissions, refining the workflow trigger conditions, and ensuring the correctness of the referenced commit.
Workflow trigger and permissions improvements:
The workflow now only triggers on pull_request_target events if the pull request is not a draft and originates from the same repository, reducing the risk of running untrusted code from forks.
The id-token: write permission is moved to the job level, ensuring it's only granted when necessary and not globally.
Validation enhancements:
Added a step to resolve the actual commit SHA for the source ref and verify that it matches the provided commit, preventing mismatches and potential errors in downstream steps. If the ref does not exist or the commit does not match, the workflow fails early with a clear error message.
The output for source_commit is now set to the resolved commit SHA, ensuring downstream jobs use the correct commit.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Ref resolution can select the wrong branch or return an annotated tag’s object SHA instead of its commit SHA, causing incorrect expected-commit validation or forwarding an invalid downstream commit ID.
Hardens the workflow that dispatches extended PR validation to the private pipeline, tightening automatic execution and checking manually selected revisions.
Changes:
Limits automatic dispatch to non-draft PRs from the same repository while retaining manual dispatch.
Scopes id-token: write permission to the dispatch job.
Adds remote-ref resolution and commit comparison before forwarding the resolved SHA.
File
Description
.github/workflows/extended-pr-validation.yml
Updates dispatch conditions, job permissions, and manual revision validation.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The workflow rejects previously supported same-repository PR refs and can dispatch blob or tree IDs as source commits without verifying that they resolve to commits.
git ls-remote can return a blob or tree ID for a lightweight or annotated tag, which this code then dispatches as source_commit. Fetch the selected ref and verify that it resolves with ^{commit} so invalid revisions fail before reaching the private pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the
extended-pr-validation.ymlworkflow to improve security and validation checks for pull request events. The main changes are focused on tightening permissions, refining the workflow trigger conditions, and ensuring the correctness of the referenced commit.Workflow trigger and permissions improvements:
pull_request_targetevents if the pull request is not a draft and originates from the same repository, reducing the risk of running untrusted code from forks.id-token: writepermission is moved to the job level, ensuring it's only granted when necessary and not globally.Validation enhancements:
source_commitis now set to the resolved commit SHA, ensuring downstream jobs use the correct commit.