Repository navigation
Fix: Harden Scorecard against agent startup races - #204
ModeSevenIndustrialSolutions merged 2 commits into
Conversation
v0.16.4 restarts the harden-runner agent after a transient resolver failure (agent_restart_attempts, default 2). Under v0.16.3 a single SERVFAIL from dns.google while the agent resolved the organisation allow-list made the agent exit, and the action then failed the job closed. That is how the OpenSSF Scorecard 'Link' job has been failing intermittently, on a different unrelated host each time. The fix lands in the loader, so every lane that pins it benefits with no new inputs to wire, and the existing harden_runner_* inputs keep their behaviour. This updates all ten pins across nine workflows. Co-authored-by: Copilot <[email protected]> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
harden-runner's pre hook waits about 9 s for its agent, then lets the
job continue. When DNS is slow the agent finishes setting up only after
ossf/scorecard-action has started, and its 'systemctl restart docker'
kills the analysis container ('unexpected EOF', 'context canceled').
The Scorecard API leaves no way to make the scan job wait: run: steps
and harden-runner-block-action are off its permitted list, and a
second harden-runner step returns at once because the agent is already
installed. It checks only each step's 'uses', so the 'Run analysis'
step now carries an id and continue-on-error, and an identical step
straight after it runs only when that outcome is 'failure'. A failed
first attempt leaves the job successful, so the retry and the uploads
pass their implicit success() check; a failed retry fails the job.
The race cannot be forced in CI, so the retry path is reasoned from
logs, not exercised. A genuine failure now runs the analysis twice, and
the window before egress filtering starts remains open.
tests/scorecard-retry-steps.sh holds the shape: same ref and inputs,
adjacent steps, the outcome condition. It is a new file because
tests/workflow-steps.sh is executable and this change could not edit
it. The workflow comments, README and design brief describe the retry
and its limits.
Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
YAML-shape tests cannot exercise the Docker startup race, so a maintainer must validate a real publishing Scan and Link run, including uploads and startup recovery logs.
No open issues 🎉
What changed in this PR
This PR mitigates intermittent OpenSSF Scorecard failures during harden-runner startup. It updates the shared hardening loader and adds one conditional analysis retry without changing caller inputs.
Changes:
- Updates all ten
harden-runner-block-actionpins to v0.16.4 for agent restart support. - Retries failed Scorecard analysis once, keeping the scan job failed if both attempts fail.
- Adds workflow-shape tests and documents the mitigation’s limits, including the remaining startup window without egress filtering.
| File | Description |
|---|---|
tests/scorecard-retry-steps.sh |
Adds checks for matching, adjacent analysis attempts and retry conditions. |
README.md |
Explains the retry and links to its design rationale. |
docs/BRIEF.md |
Documents startup failures, retry limits, and continued shared-loader use. |
.github/workflows/zizmor.yaml |
Updates both hardening-loader pins to v0.16.4. |
.github/workflows/workflow-tests.yaml |
Runs the new retry checks and updates the hardening loader. |
.github/workflows/sonatype-lifecycle.yaml |
Updates the hardening loader to v0.16.4. |
.github/workflows/sonarqube-cloud.yaml |
Updates the hardening loader to v0.16.4. |
.github/workflows/release-drafter.yaml |
Updates the hardening loader to v0.16.4. |
.github/workflows/package-hardening-audit.yaml |
Updates the hardening loader to v0.16.4. |
.github/workflows/openssf-scorecard.yaml |
Adds conditional analysis retry, explains restrictions, and updates the Link job’s loader. |
.github/workflows/codeql.yaml |
Updates the hardening loader to v0.16.4. |
.github/workflows/action-pin-audit.yaml |
Updates the hardening loader to v0.16.4. |
Review effort: Balanced
There was a problem hiding this comment.
🤖 Antagonistic review by agent: no line-level findings; the summary below is the verdict.
No actionable defects found in the diff: the bounded retry preserves failure reporting, upload gating, and existing permissions. The offline review cannot establish recovery from the live startup race or independently verify the upstream loader revision and publish verifier compatibility.
Antagonistic round 1 of 3.
Automated antagonistic review by lf-releng-antagonistic-review-bot[bot] using model gpt-6-astra; see the run. This is not a human review and never an approval: a maintainer must still review and approve this pull request.
6edd901
into
lfreleng-actions:main
Closes #201
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLIdf36b8d85d1b8bb7c9ebafb0b1c11381ac315615bash tests/scorecard-retry-steps.shbash tests/workflow-steps.shbash tests/python-warning-steps.shbash tests/tox-python-steps.shbash tests/uv-interpreter-steps.shprek run --files <changed files>uvx [email protected] --persona auditor --offline --no-progress <changed workflows>aislop scan --changes --base df36b8d --json .git log --raw --format=%h df36b8d85d1b8bb7c9ebafb0b1c11381ac315615..HEADThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.
This follows the revised request in the issue comment, which replaces requested changes 1 and 2.
What changed
1.
Chore: Bump harden-runner-block-action to v0.16.4(Link job)All ten
lfreleng-actions/harden-runner-block-actionpins, across nine workflow files, move from v0.16.3 (f5a4756…) to v0.16.4 (65ff87957e1cac2de3203a85dbb07c31810321cb). After a transient resolver failure, v0.16.4 restarts the agent (agent_restart_attempts, default2). Before, a singleSERVFAILfromdns.googlekilled the ScorecardLinkjob. The Link job keeps using the shared loader, with no curated list and no new inputs, and theharden_runner_*inputs work as before.docs/BRIEF.mdD15 records why the summary job stays on the loader.2.
Fix: Retry the Scorecard analysis once(Scan job)Run analysisnow hasid: analysisandcontinue-on-error: true.Run analysis (retry)runs the sameossf/scorecard-actioncommit with the samewith:inputs, guarded byif: steps.analysis.outcome == 'failure'.success()is true.continue-on-error, its outcome isfailurebut its conclusion issuccess. The job stays successful, so the retry runs, and the uploads run if the retry succeeds.continue-on-error, so the job fails and the uploads are skipped.run:step is rejected,harden-runner-block-actionis not on the permitted list, and a second harden-runner step skips its wait.README.md(Egress allow-list section) anddocs/BRIEF.mdD15 describe the retry and its limits.tests/scorecard-retry-steps.shchecks that:ossf/scorecard-action, next to each other;with:;id,continue-on-error: trueand noif:;if: steps.<id>.outcome == 'failure'and nocontinue-on-error.What this does not do
step-security/harden-runnercan close that.What I ran
bash tests/scorecard-retry-steps.sh: 10/10 pass. I also ran it against mutated copies of the workflow: different inputs on the retry, a differentif:, and the original single-step file. Each mutation failed the expected cases.bash tests/workflow-steps.sh: 119/119 pass. This includes "scan is the one job running ossf/scorecard-action" and "scan job uses only permitted actions".bash tests/python-warning-steps.sh,tox-python-steps.sh,uv-interpreter-steps.sh: all pass.prek run --files <changed files>(yamllint, actionlint, zizmor, reuse, codespell, workflow validators, gitlint on commit): pass.zizmor --persona auditor --offlineon every changed workflow: no findings.aislop scan --changes --base df36b8d: emptydiagnostics.For reviewers
uses, so twoossf/scorecard-actionsteps in one job, withid,ifandcontinue-on-error, are accepted. I could not check this againstossf/scorecard-infrafrom this session. The first real publish confirms it: a rejection shows up as a warning in the analysis step.tests/workflow-steps.sh, for the reason in the banner above.