Skip to content

Fix(testing): Let the credentialled self-test start - #134

Merged
askb merged 2 commits into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/testing-nested-permissions
Oct 8, 2026
Merged

askb merged 2 commits into
lfreleng-actions:mainfrom
modeseven-lfreleng-actions:fix/testing-nested-permissions

Conversation

@ModeSevenIndustrialSolutions

Copy link
Copy Markdown
Member

Summary

testing.yaml has never started in its current form. Its first dispatch on main (run 37701570063) ended in startup_failure with no jobs:

The workflow is not valid. .github/workflows/testing.yaml (Line: 310, Col: 3):
Error calling workflow '.../zizmor.yaml@40b00cb...'. The nested job 'upload' is
requesting 'actions: read, security-events: write', but is only allowed
'actions: none, security-events: none'.

This PR fixes that and a second defect a dispatch would have hit next. Each commit adds a per-PR harness check that fails against the file before it.

Commits

  1. Fix(testing): Grant legs their lanes' permissions. When GitHub loads a run, it compares each called workflow's job permissions with the calling job's grant, before any if: is evaluated, and refuses the whole run on a shortfall. GitHub reports only the first. A static audit of every leg found four short:

    Leg Lane job Missing
    zizmor-self, zizmor-fixture upload (skipped on dispatch) security-events: write, actions: read
    openssf-scorecard-dry-run scan security-events: write, id-token: write, actions: read
    codeql-matrix analyze security-events: write, actions: read

    Publishing, SARIF upload and alert upload stay off in all four legs, so the added scopes go unused. A new harness section checks every leg's grant against its lane, with a leg lacking its own block falling back to the workflow-level one.

  2. Fix(testing): Name each Sonar leg's project. Four Sonar legs left sonar_organization/sonar_project_key unset. The Maven legs took test-maven-project from the fixture's properties file. The Go and scan-only fixtures have no properties file, so the scan action derived owner and name from GITHUB_REPOSITORY, which is this repository, and both would have analysed into one project called security-workflows. None of those projects exists. Each leg now names lfreleng-actions_<fixture>, the key SonarCloud's GitHub import assigns and the one the submodule legs already use.

Server-side prerequisites

  • Nexus IQ: created lfreleng-actions-test-maven-project, -test-node-project and -test-python-submodules in the lfreleng-actions organisation, beside the existing Go and Python fixture applications. The CLI scan passes no organisation, so it can't create a missing application itself.
  • SonarCloud: these legs need lfreleng-actions_test-maven-project, lfreleng-actions_test-go-project, lfreleng-actions_test-node-project and lfreleng-actions_test-python-submodules. None exists yet, and they need someone with Create Projects permission in the SonarCloud organisation. Until they exist, the Sonar legs fail on a missing project; the rest of the run is unaffected.

Validation

  • tests/workflow-steps.sh: 112 cases pass, up from 83. Mutation: against main's testing.yaml the permission check fails on exactly the four legs above, and the naming check on exactly the four unnamed legs.
  • prek on the changed files, zizmor --persona=auditor (online): no findings, aislop gate: clean.
  • testing.yaml itself runs only on dispatch, and only an upstream dispatch carries the credentials, so the end-to-end proof is a dispatch on main after merge.

testing.yaml has never started in its current form. Its first dispatch
ended in startup_failure:

  Error calling workflow '.../zizmor.yaml@40b00cb...'. The nested job
  'upload' is requesting 'actions: read, security-events: write', but
  is only allowed 'actions: none, security-events: none'.

GitHub compares a called workflow's job permissions with the calling
job's grant when it loads the run, before any 'if:' is evaluated, and
refuses the whole run on a shortfall. Four legs granted less than
their lane declares: zizmor-self and zizmor-fixture (the skipped
upload job), openssf-scorecard-dry-run (the scan job's publishing
scopes) and codeql-matrix (the analyze job). Grant each what its lane
declares. Publishing, SARIF upload and alert upload stay off in all
four, so the new scopes go unused.

Nothing runs testing.yaml per PR, so add a check to the per-PR
harness that every leg grants each scope its lane's jobs declare. It
fails on exactly these four legs against the previous file.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
Four Sonar legs left sonar_organization and sonar_project_key unset,
so the project they analysed into was resolved by the scan action:

- the Maven legs took 'test-maven-project' from the fixture's own
  sonar-project.properties, not the key SonarCloud gives a project in
  this organisation;
- the Go and scan-only legs, whose fixtures have no properties file,
  fell back to owner and name from GITHUB_REPOSITORY. That is this
  repository, not the fixture, so both would analyse into one project
  named 'security-workflows'.

None of those projects exists. Name each leg's project explicitly as
'lfreleng-actions_<fixture>', the key SonarCloud's GitHub import
assigns and the one the submodule legs already use, and add a harness
check that every Sonar leg sets both inputs.

The four projects still need creating in SonarCloud before these legs
can pass.

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

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 changes address both defects and the 112-case regression harness passes.

0 open findings

What changed in this PR

Fixes startup validation and Sonar project targeting in the credentialled self-test.

Changes:

  • Grants reusable workflows their required permissions.
  • Configures explicit SonarCloud projects and adds regression checks.
File Description
.github/​workflows/​testing.yaml Adds required permissions and Sonar project identifiers.
tests/​workflow-steps.sh Validates permissions and Sonar configuration.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@askb
askb merged commit 4b2454d into lfreleng-actions:main Oct 8, 2026
11 checks passed
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