Skip to content

Fix(linting): Load the org allow-list for block - #65

Merged
tykeal merged 3 commits into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/linting-uv-release-host
Oct 14, 2026
Merged

tykeal merged 3 commits into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/linting-uv-release-host

Conversation

@ModeSevenIndustrialSolutions

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

harden_runner_egress: 'block' has never worked in the reusable linting workflow.

  • Cause: the workflow passed its newline-separated harden_runner_allowed_endpoints straight to harden-runner. The agent splits allowed-endpoints on single spaces (config.go: strings.Split(allowedEndpoints, " ")), so the whole list arrived as one malformed entry.
  • Effect: block refused every host outside the agent's implicit set.
  • How it surfaced: this PR's first revision added releases.astral.sh to the default list and ran the ci.skip self-test under block. The plan job then failed at Set up uv: the manifest fetch from raw.githubusercontent.com was Dropped (per StepSecurity), although the list named that host. The runtime config showed allowed_endpoints with \n separators.

The missing releases.astral.sh was real, but secondary.

Changes

1. Fix(linting): Load the org allow-list for block

linting.yaml now loads its list the way the other reusables here do (release, semantic-pull-request, autolabeler, clear-action-cache, release-drafter):

  • Loader: a harden-runner-block-action step (v0.13.1) runs before harden-runner in both the plan and lint jobs. It fetches the organisation allow-list in its pre hook and publishes it space-separated as CONNECTION_ALLOW_LIST. With its default invalid_records: filter (new in v0.13.0), it also drops entries that don't resolve, which would otherwise make harden-runner abandon block while still reporting success.
  • New input harden_runner_allowlist: the same name and config grammar the sibling reusables use. It defaults to lfreleng-actions//.github/harden-runner/lfreleng-actions/allow_list.txt, pinned by commit SHA to .github v0.17.1, which includes the Codecov hosts from Fix(allow-list): Add Codecov upload hosts .github#266.
  • Lint matrix: emits the allow-list summary on the first leg only (strategy.job-index == 0), following the action's README.
  • Removed harden_runner_allowed_endpoints: this is a breaking interface change. Its only consumer, CI(lint): Run ci.skip hooks via reusable linting tailscale-openstack-bastion-action#108, doesn't set it.
  • Unchanged: the default egress policy stays audit. Making block the default, as the siblings do, would change behaviour for every caller and deserves its own decision.
  • Self-test: the ci.skip job runs under block, so the loader and the organisation list are proven on every pull request.
  • Docs: docs/linting.md (Runner section and inputs table) describes the new mechanism, and records why the old one failed.

2. Chore(actions): Bump harden-runner allow-list pins

Moves every other reusable workflow (autolabeler, clear-action-cache, release, release-drafter, semantic-pull-request) to the same pins, so all of them load one organisation list through one loader version:

  • Allow-list: .github v0.16.4 → v0.17.1. Over that range the list only gained entries: Codecov (Fix(allow-list): Add Codecov upload hosts .github#266), the Gradle checksum host and the Yarn Berry release host.
  • Loader: harden-runner-block-action v0.12.2 → v0.13.1. This brings the unresolvable-entry filtering to the siblings too. No caller sets the newly reserved variable names (HARDEN_RUNNER_EGRESS_POLICY, GH_TELEMETRY) or reads the action's outputs, so the v0.13 changes need nothing else.
  • Docs: the README and docs/autolabeler.md inputs tables named .github v0.16.0 as the default, which was already stale; they now name v0.17.1.

3. Fix(linting): Address Copilot review feedback

  • Wait for the agent before the hardening verdict. harden-runner's pre-step polls for its agent's status file for only ~9 s (30 × 300 ms), then succeeds whether or not the agent came up. The agent pre-resolves every allow-list entry, so with the ~200-entry organisation list it can still be starting when the window closes, and the gate then failed block jobs on runners that were about to be monitored. This was seen intermittently on this PR's ci.skip self-test. A new harden_runner_await, in both extracted harden_check copies, waits up to 60 s more, but only on a GitHub-hosted runner where harden-runner wrote /home/agent/agent.json, which it does just before starting the agent. Runners with no agent coming (ubuntu-slim, containers, self-hosted) get their verdict immediately.
  • Audit mode no longer depends on the allow-list loading. Both loader steps set continue-on-error: ${{ inputs.harden_runner_egress != 'block' }}, so a .github or DNS outage can't fail default audit calls, which don't use the list. A step if: can't skip the loader's pre phase (no pre-if), but continue-on-error covers it. Under block a load failure still stops the job.
  • A self-test comment in linting-action.yaml is reworded for clarity.

Coverage of the organisation list

Every host the workflow's own jobs reached in StepSecurity data (#61's self-test, and the first consumer's run) is in the organisation list at v0.17.1: releases.astral.sh, astral.sh, PyPI, raw.githubusercontent.com, github.com and api.github.com. The hand-rolled list's remaining entries are covered by harden-runner's implicit set (agent.go: *.actions.githubusercontent.com, codeload.github.com, productionresultssa*.blob.core.windows.net) or by *.githubusercontent.com in the organisation list.

Validation

  • tests/test-lint-plan.sh (175), tests/test-locate-rules.sh (112, including five new harden_runner_await fixtures) and tests/test-relax-matches.sh (52) all pass.
  • actionlint passes on the changed workflows.
  • prek on the changed files, zizmor --persona auditor (online, all workflows; no new findings), the aislop gate (clean against main) and markdown-table-fixer all pass.
  • The decisive check is this PR's Linting (self, ci.skip) jobs, which run the branch's own copy under block. On pull requests, the semantic-pull-request and autolabeler self-tests exercise the new pins too; the release, release-drafter and clear-action-cache workflows only run on push or dispatch, so their pin bump is first exercised after merge.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions requested review from a team and a balanced review from Copilot October 8, 2026 10:37
@github-actions github-actions Bot added the bug Something isn't working label Oct 8, 2026

This comment was marked as outdated.

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions changed the title Fix(linting): Allow uv's release host under block Fix(linting): Load the org allow-list for block Oct 8, 2026
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions marked this pull request as draft October 8, 2026 11:12
Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:13

This comment was marked as outdated.

harden_runner_egress: 'block' has never worked in this workflow. It
passed its newline-separated harden_runner_allowed_endpoints input
straight to harden-runner, whose agent splits allowed-endpoints on
single spaces, so the whole list arrived as one malformed entry and
every host outside the agent's implicit set was refused. Running the
ci.skip self-test under 'block' showed it: setup-uv's manifest fetch
from raw.githubusercontent.com was dropped although the list named
the host, and the plan job failed before linting anything.

Load the list as this repository's other reusable workflows do:
harden-runner-block-action fetches the organisation allow-list,
pinned by a new harden_runner_allowlist input to a commit of the
'.github' repository, and publishes it space-separated. It also drops
entries that do not resolve, which would otherwise make harden-runner
abandon 'block' while reporting success. The organisation list
already carries every host this workflow's own jobs reach, including
releases.astral.sh, and harden-runner allows the Actions service and
cache hosts itself.

This removes harden_runner_allowed_endpoints. Its only consumer,
tailscale-openstack-bastion-action, does not set it. The default
egress policy stays 'audit'.

The ci.skip self-test now runs under 'block', so the loader and the
organisation list are proven on every pull request.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Move every other reusable workflow to the same pins the linting
workflow now uses, so all of them load one organisation allow-list
through one version of the loader.

- The .github allow-list moves from v0.16.4 to v0.17.1, which adds
  the Codecov upload hosts (lfreleng-actions/.github#266), the
  Gradle checksum host and the Yarn Berry release host. The list
  only gained entries over that range.
- harden-runner-block-action moves from v0.12.2 to v0.13.1. v0.13.0
  adds 'invalid_records', whose default 'filter' drops entries that
  do not resolve; without it harden-runner abandons 'block' while
  still reporting success. v0.13.1 publishes step outputs from the
  main step. No caller here sets the newly reserved variable names
  or reads the action's outputs.
- The README and autolabeler inputs tables named v0.16.0 as the
  default, which was already stale; they now name v0.17.1.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>

This comment was marked as outdated.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 13:43
@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions marked this pull request as ready for review October 12, 2026 13:44

This comment was marked as outdated.

ModeSevenIndustrialSolutions added a commit to modeseven-lfreleng-actions/generic-workflows that referenced this pull request Oct 12, 2026
Hooks declared 'language: system' run the project's own tools: cargo
fmt and clippy need the toolchain rust-toolchain.toml pins, and
eslint, prettier and tsc need the project's node_modules. Repositories
list them under ci.skip because pre-commit.ci cannot prepare them, and
this workflow could not either.

standalone-linting-action v0.7.0 and v0.8.0 added that preparation.
Move the executor pin from v0.6.0 to v0.8.0 and forward its five new
inputs (rust_toolchain_setup, rust_components, node_setup,
node_version, node_install_scripts) with the executor's defaults, so
'auto' prepares a project that tracks a Cargo.toml or package.json and
leaves every other repository as it was. The plan job validates the
values to the executor's own rules, so a typo fails once before any
hook rather than once per lint job.

The rules live in the input_rules region as verdict functions, which
tests/test-locate-rules.sh extracts and drives with table fixtures
(38 new cases, accepted and hostile forms alike).

Two self-test jobs run fixture projects through the workflow with
every toolchain input at its default, selecting each fixture's
ci.skip hooks:

- tests/fixtures/rust pins toolchain 1.90.0, minimal profile, and its
  cargo fmt / clippy hooks run with RUSTUP_AUTO_INSTALL=0, so they
  pass only when the executor installed that toolchain and the
  forwarded rustfmt and clippy components.
- tests/fixtures/node pins prettier in its lockfile, and its hook
  runs 'npx --no-install prettier', so it passes only after the
  executor's frozen install.

Egress is unchanged here: lfreleng-actions#65 moves
block mode onto the organisation allow-list, which already carries the
Rust, Yarn and Corepack hosts these steps reach.

docs/linting.md gains a Project toolchains section, including the
cost split_hooks multiplies (one install per lint job) and the
timeout a large project may need.

Copilot review: both findings addressed. The validation moved into
the extracted region with permanent fixtures, and the fixture jobs
demonstrate both preparation paths end to end.

Closes: lfreleng-actions#66
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Copilot review of this pull request raised:

- Await the agent before the hardening verdict. harden-runner's
  pre-step polls for the agent's status file for about nine seconds,
  then succeeds whether or not the agent came up. With the
  organisation allow-list the agent can still be resolving entries
  when that window closes, so the gate failed 'block' jobs on runners
  about to be monitored. A new harden_runner_await, in both extracted
  harden_check copies, waits up to 60 seconds more on a GitHub-hosted
  runner where harden-runner wrote the agent's configuration. Without
  that configuration no agent is coming and the verdict is immediate.
  The comment claiming the pre-step blocks until the agent starts is
  corrected, and fixtures cover the wait, its bound and its skips.
- Keep audit mode independent of the allow-list. The loader's pre
  phase fetches the list and validates it over DNS, so an outage
  failed default 'audit' calls that never use the list. A step 'if:'
  cannot skip a pre phase without 'pre-if', but continue-on-error
  covers it, so the loader is now fatal under 'block' alone.
- Rephrase the self-test comment in linting-action.yaml as a clear
  conditional.
- Pin a loader that filters unresolvable entries: addressed by the
  move to harden-runner-block-action v0.13.1 in the earlier commits.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is consistent, pinned, documented, fixture-covered, and its block-mode self-test passes.

0 open findings

4 resolved since last review

🧠 Review effort: Balanced

ModeSevenIndustrialSolutions added a commit to modeseven-lfreleng-actions/generic-workflows that referenced this pull request Oct 12, 2026
Hooks declared 'language: system' run the project's own tools: cargo
fmt and clippy need the toolchain rust-toolchain.toml pins, and
eslint, prettier and tsc need the project's node_modules. Repositories
list them under ci.skip because pre-commit.ci cannot prepare them, and
this workflow could not either.

standalone-linting-action v0.7.0 and v0.8.0 added that preparation.
Move the executor pin from v0.6.0 to v0.8.0 and forward its five new
inputs (rust_toolchain_setup, rust_components, node_setup,
node_version, node_install_scripts) with the executor's defaults, so
'auto' prepares a project that tracks a Cargo.toml or package.json and
leaves every other repository as it was. The plan job validates the
values to the executor's own rules, so a typo fails once before any
hook rather than once per lint job.

The rules live in the input_rules region as verdict functions, which
tests/test-locate-rules.sh extracts and drives with table fixtures
(38 new cases, accepted and hostile forms alike).
tests/test-lint-plan.sh adds a wiring check per input: declared with
the executor's default, forwarded verbatim to the executor step, and
handed to the plan job's validation.

Two self-test jobs run fixture projects through the workflow with
every toolchain input at its default, selecting each fixture's
ci.skip hooks:

- tests/fixtures/rust pins toolchain 1.90.0, minimal profile, and its
  cargo fmt / clippy hooks run with RUSTUP_AUTO_INSTALL=0, so they
  pass only when the executor installed that toolchain and the
  forwarded rustfmt and clippy components.
- tests/fixtures/node pins prettier in its lockfile, and its hook
  runs 'npx --no-install prettier', so it passes only after the
  executor's frozen install.

Egress is unchanged here: lfreleng-actions#65 moves
block mode onto the organisation allow-list, which already carries the
Rust, Yarn and Corepack hosts these steps reach.

docs/linting.md gains a Project toolchains section, including the
cost split_hooks multiplies (one install per lint job) and the
timeout a large project may need.

Copilot review: all findings addressed. The validation moved into
the extracted region with permanent fixtures; the fixture jobs
demonstrate both preparation paths end to end; and because the
executor shares the workflow's defaults, so those jobs alone could
not see a dropped forwarding line, the wiring check pins the
executor's with: block directly.

Closes: lfreleng-actions#66
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
@tykeal
tykeal merged commit 58db1c8 into lfreleng-actions:main Oct 14, 2026
22 checks passed
ModeSevenIndustrialSolutions added a commit to modeseven-lfreleng-actions/generic-workflows that referenced this pull request Oct 15, 2026
Hooks declared 'language: system' run the project's own tools: cargo
fmt and clippy need the toolchain rust-toolchain.toml pins, and
eslint, prettier and tsc need the project's node_modules. Repositories
list them under ci.skip because pre-commit.ci cannot prepare them, and
this workflow could not either.

standalone-linting-action v0.7.0 and v0.8.0 added that preparation.
Move the executor pin from v0.6.0 to v0.8.0 and forward its five new
inputs (rust_toolchain_setup, rust_components, node_setup,
node_version, node_install_scripts) with the executor's defaults, so
'auto' prepares a project that tracks a Cargo.toml or package.json and
leaves every other repository as it was. The plan job validates the
values to the executor's own rules, so a typo fails once before any
hook rather than once per lint job.

The rules live in the input_rules region as verdict functions, which
tests/test-locate-rules.sh extracts and drives with table fixtures
(38 new cases, accepted and hostile forms alike).
tests/test-lint-plan.sh adds a wiring check per input: declared with
the executor's default, forwarded verbatim to the executor step, and
handed to the plan job's validation.

Two self-test jobs run fixture projects through the workflow with
every toolchain input at its default, selecting each fixture's
ci.skip hooks:

- tests/fixtures/rust pins toolchain 1.90.0, minimal profile, and its
  cargo fmt / clippy hooks run with RUSTUP_AUTO_INSTALL=0, so they
  pass only when the executor installed that toolchain and the
  forwarded rustfmt and clippy components.
- tests/fixtures/node pins prettier in its lockfile, and its hook
  runs 'npx --no-install prettier', so it passes only after the
  executor's frozen install.

Egress is unchanged here: lfreleng-actions#65 moved
block mode onto the organisation allow-list, which already carries the
Rust, Node.js and Yarn hosts these steps reach, including for the
ci.skip self-test that now runs under 'block'.

docs/linting.md gains a Project toolchains section, including the
cost split_hooks multiplies (one install per lint job) and the
timeout a large project may need.

Copilot review: all findings addressed. The validation moved into
the extracted region with permanent fixtures; the fixture jobs
demonstrate both preparation paths end to end; and because the
executor shares the workflow's defaults, so those jobs alone could
not see a dropped forwarding line, the wiring check pins the
executor's with: block directly.

Closes: lfreleng-actions#66
Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants