Harden dependency-validation workflow - #1385
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe dependency validation workflow fetches and verifies the PR head, compares dependency files against the base commit, and updates validation comment steps to ChangesDependency validation workflow
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).github/workflows/dependency-validation.ymlTraceback (most recent call last): 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/dependency-validation.yml:
- Around line 32-42: Update the “Fetch PR head as data” and “Detect modified
go.mod files” workflow steps to resolve and use a single PR head SHA: capture
the fetched ref’s SHA, compare it with github.event.pull_request.head.sha, and
fail immediately on mismatch. Pass the verified resolved SHA into the validation
step so change detection and validation inspect the same commit.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a16d33c9-1067-4836-a217-4a7efa8dee5d
📒 Files selected for processing (1)
.github/workflows/dependency-validation.yml
c9aa45f to
d18b368
Compare
- Remove the unsafe fork checkout (head.sha + allow-unsafe-pr-checkout) 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. - Fetch the PR head without an invalid --depth flag. - Bump actions/github-script from v7 to v8 to run on Node 24.
Purpose
Fixes the
Dependency Validationworkflow, which was failing at checkout and carried a security risk.Changes
pull_request_targetjob checked out fork code viahead.shawithallow-unsafe-pr-checkout: true, 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.--depth=0(not a valid depth); full history is already available viafetch-depth: 0on the checkout step.actions/github-scriptfrom v7 to v8 to run on Node 24 and clear the Node 20 deprecation warning.No change to the validation logic or PR-gating behavior.
Summary by CodeRabbit