ci(github-action): switch harden-runner to block mode with explicit endpoint allowlists#266
Conversation
…ndpoint allowlists Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughMultiple GitHub Actions workflows are updated to enforce stricter runner security by switching egress policy from audit to block mode, disabling sudo and container capabilities, and explicitly allowlisting required external endpoints for each workflow. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #266 +/- ##
=======================================
Coverage 88.88% 88.88%
=======================================
Files 19 19
Lines 1332 1332
Branches 101 101
=======================================
Hits 1184 1184
Misses 104 104
Partials 44 44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/dotnet.yml:
- Around line 29-49: The allowed-endpoints list for the CI job is missing the
Azure Blob Storage host required by actions/cache; update the allowed-endpoints
block to include the Azure Blob Storage endpoint (*.blob.core.windows.net:443)
so cache restore of ~/.nuget/packages can reach the blob backend; locate the
allowed-endpoints entry in the workflow and add that host to the list.
In @.github/workflows/package.yml:
- Around line 24-38: The workflow's egress-policy is set to block so the
actions/cache step cannot reach the endpoints it needs; update the
allowed-endpoints under the same block (the allowed-endpoints list controlled by
egress-policy: block) to include results-receiver.actions.githubusercontent.com
and *.blob.core.windows.net so the actions/cache restore/save can
upload/download caches (i.e., add those two host entries to the
allowed-endpoints list where the existing endpoints like github.com and
*.nuget.org are defined).
In @.github/workflows/scorecard.yml:
- Around line 37-49: Update the allowed-endpoints list in the workflow scorecard
configuration to include GitHub Actions OIDC and Azure Blob artifact endpoints:
add *.actions.githubusercontent.com (to allow
token.actions.githubusercontent.com for id-token: write/OIDC) and
*.blob.core.windows.net (for actions/upload-artifact uploads). Modify the block
under the egress-policy/allowed-endpoints section so these two host patterns are
present alongside the existing entries.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 348e0e5b-c469-46fc-a634-32b5a92fa6a1
📒 Files selected for processing (6)
.github/workflows/codeql.yml.github/workflows/create-tag.yml.github/workflows/dependency-review.yml.github/workflows/dotnet.yml.github/workflows/package.yml.github/workflows/scorecard.yml
Summary
egress-policyfromaudittoblock, enforcing outbound network restrictions instead of just loggingdisable-sudo-and-containers: trueto all workflows (exceptscorecard.ymlwhich usesdisable-sudo: true)allowed-endpointstailored to each workflow's actual dependenciesEndpoint allowlists
codeql.ymldotnet.ymlo26192), GCSpackage.yml*.nuget.org:443wildcard covers both restore and pushcreate-tag.ymldependency-review.ymlapi.deps.dev,api.securityscorecards.dev, GitHubscorecard.yml*.github.comfor sarif uploadTest plan
dependency-reviewanddotnetworkflows pass in block modecodeql,scorecard, anddotnetpass🤖 Generated with Claude Code
Summary by CodeRabbit