CI(harden-runner): Add audit fallback for fork PR runs#288
Merged
tykeal merged 1 commit intoMay 13, 2026
Conversation
Both currently-open PRs to lfit/dependamerge are blocked because they were raised from forks, where the CONNECTION_WHITELIST repo/org variable is not exposed to the workflow. When the allowed-endpoints input to step-security/harden-runner is empty, block-mode egress refuses every outbound connection and CI jobs that need network access (uv installs, audit downloads, image fetches, etc.) fail before doing useful work. Replace each existing single harden-runner step with a conditional pair: - block-mode step gated on CONNECTION_WHITELIST != '' - audit-mode fallback step gated on CONNECTION_WHITELIST == '' GitHub evaluates both ifs independently and runs exactly one step. When the variable is present (push to main, internal branches) we keep the existing strict block-mode policy. When the variable is absent (fork PRs) we fall back to audit-only, which logs every egress destination without blocking it so the job still runs. The audit log is still attached to the run and remains available for review. Same step-security/harden-runner SHA pin (a5ad31d6a139d249332a2605b85202e8c0b78450, v2.19.1) preserved on every site. No other behavioural changes. Sites updated (20 total): * .github/workflows/autolabeler.yaml (1) * .github/workflows/build-test-release.yaml (11) * .github/workflows/build-test.yaml (7) * .github/workflows/release-drafter.yaml (1) actionlint and yamllint both clean for the modified files. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
There was a problem hiding this comment.
Pull request overview
This PR adjusts CI runner hardening so fork-based pull requests don’t fail due to an unavailable CONNECTION_WHITELIST repo/org variable. It keeps the existing block-mode egress policy when the whitelist is available, and falls back to audit-only mode when it isn’t (e.g., fork PR runs).
Changes:
- Replace each single
step-security/harden-runnerblock-mode step with two conditional steps:- Block-mode with
allowed-endpointswhenvars.CONNECTION_WHITELIST != '' - Audit-only fallback when
vars.CONNECTION_WHITELIST == ''
- Block-mode with
- Preserve existing action SHA pins and behavior for non-fork contexts where the whitelist is present.
- Apply the same pattern consistently across all affected workflows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/autolabeler.yaml | Add conditional harden-runner block/audit steps based on CONNECTION_WHITELIST availability. |
| .github/workflows/build-test-release.yaml | Add conditional harden-runner block/audit steps across release workflow jobs to unblock fork PR CI behavior where relevant. |
| .github/workflows/build-test.yaml | Add conditional harden-runner block/audit steps across build/test/audit jobs to avoid fork PR failures. |
| .github/workflows/release-drafter.yaml | Add conditional harden-runner block/audit steps so hardening doesn’t brick runs when whitelist isn’t exposed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tykeal
approved these changes
May 13, 2026
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.
Summary
Both currently-open PRs to
lfit/dependamerge(#277 and #285)are blocked because they were raised from forks, where the
CONNECTION_WHITELISTrepo/org variable is not exposed to theworkflow. When the
allowed-endpointsinput tostep-security/harden-runneris empty, block-mode egress refusesevery outbound connection — uv installs, audit downloads, image
fetches, etc. all fail before doing useful work.
This PR replaces each existing single
harden-runnerstep witha conditional pair:
vars.CONNECTION_WHITELIST != ''vars.CONNECTION_WHITELIST == ''GitHub evaluates both
ifexpressions independently and runsexactly one step. When the variable is present (push to main,
internal branches) we keep the existing strict block-mode policy
unchanged. When the variable is absent (fork PRs) we fall back
to audit-only, which logs every egress destination without
blocking it so the job still runs. The audit log is still
attached to the run and remains available for review.
Why audit-only for fork PRs
Fork PRs cannot leverage the org-curated whitelist anyway, so
the realistic alternatives are:
Contributors can't get review feedback on automation
workflows.
egress destinations are recorded for post-hoc review.
maintenance and would still drift from the canonical list.
Option 2 is the standard step-security pattern for this case
and matches what other LF projects use.
Sites updated
20
harden-runnerblocks across 4 workflow files:.github/workflows/autolabeler.yaml.github/workflows/build-test-release.yaml.github/workflows/build-test.yaml.github/workflows/release-drafter.yamlSame
step-security/harden-runnerSHA pin(
a5ad31d6a139d249332a2605b85202e8c0b78450, v2.19.1) preservedon every site. No other behavioural changes.
Validation
warnings in
openssf-scorecard.yamlare pre-existing andunrelated).
Once this lands, rebasing #277 and #285 onto
mainshouldunblock their CI.
Diff shape (per-site)