Harden dependency-validation workflow#4255
Open
ranuka-laksika wants to merge 1 commit into
Open
Conversation
Contributor
📝 WalkthroughWalkthroughThe dependency validation workflow now uses newer GitHub Actions versions and verifies that the fetched PR head commit matches the event-provided SHA before continuing with dependency validation. ChangesDependency validation workflow
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubEvent
participant DependencyValidation
participant Git
participant ValidationSteps
GitHubEvent->>DependencyValidation: Provide pull_request.head.sha
DependencyValidation->>Git: Fetch PR head into pr-head
Git-->>DependencyValidation: Return fetched commit SHA
DependencyValidation->>DependencyValidation: Compare fetched SHA with event SHA
DependencyValidation->>ValidationSteps: Continue when commits match
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Remove the unsafe fork checkout (head.sha) that exposed the trusted token/secrets to untrusted PR code; check out the base repo and fetch the PR head as data to diff go.mod safely. - Verify the fetched PR head matches the event-pinned SHA so change detection and validation inspect the same commit. - Bump actions/checkout to v6 and actions/github-script to v8 (Node 24).
ranuka-laksika
force-pushed
the
harden-dependency-validation
branch
from
July 22, 2026 12:13
af52bcf to
0c81528
Compare
omindu
approved these changes
Jul 22, 2026
omindu
enabled auto-merge
July 22, 2026 15:35
Member
|
@ranuka-laksika can you rebase and force push? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
Fixes the Dependency Validation workflow, which was failing at checkout and carried a security risk.
Changes
pull_request_targetjob checked out fork code viahead.sha, exposing the trustedGITHUB_TOKENand secrets to untrusted PR code (a "pwn request" risk). It now checks out the base repo and fetches the PR head as a git ref, so the fork'sgo.modis analyzed as data and never executed.head.sha; the fetched ref is verified to match it, and the job fails fast if the PR head moved after the trigger.actions/checkoutv4 → v6 andactions/github-scriptv7 → v8 (runs on Node 24, clears the Node 20 deprecation warning).No change to the validation logic or PR-gating behavior.
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Chores