Skip to content

Add Plumber security scan and harden workflow actions - #86

Open
thomasboni wants to merge 5 commits into
cdevents:mainfrom
thomasboni:ci/add-plumber-security-scan
Open

Add Plumber security scan and harden workflow actions#86
thomasboni wants to merge 5 commits into
cdevents:mainfrom
thomasboni:ci/add-plumber-security-scan

Conversation

@thomasboni

Copy link
Copy Markdown

What this does

This PR adds a workflow (.github/workflows/plumber.yml) that runs Plumber on every push and pull request to main. Plumber scans the repository's GitHub Actions workflows for CI/CD security issues and reports them to the Security tab.

Running the scan surfaced a couple of pre-existing findings, so the PR also hardens the current workflows. It is split into five commits:

  1. ci: add plumber security scan workflow: the new workflow.
  2. ci: declare workflow permissions: add a least-privilege permissions: block to the linter, test and release workflows, which previously inherited the repository default token scope (linter gets contents: read + statuses: write for super-linter, test gets contents: read, release gets contents: write).
  3. ci: add plumber configuration: add .plumber.yaml based on Plumber's github defaults with every control kept enabled. It sets codeOwnerApprovalRequired: false, since this project has no CODEOWNERS review process; that clears the branch-protection finding.
  4. ci: enable plumber score push: publish the score on pushes to main (see the note below).
  5. docs: add plumber score badge to readme: show the score at the top of the README.

Local scan result

With these changes the local run reports:

  • Status: PASSED (score A, 100/100, required >= C)
  • Passed Controls (21), Failed Controls (0)
  • The gate is set to fail only below score C, so the check passes today.

The baseline before this PR was score B: the linter, test and release workflows had no explicit permissions: block (ISSUE-801, medium), and the branch protection policy did not match (ISSUE-505). Both are handled here.

Question: trusted action sources

The config keeps Plumber's githubActionMustComeFromAuthorizedSources control enabled. It passes today because every action used here comes from actions/* or github/*.

Does this repository (or the org) already maintain an allowlist of authorized action sources, for example through the GitHub Actions settings ("Allow select actions and reusable workflows")? If it does, I would rather disable this Plumber control than keep the same allowlist in two places. Let me know and I will adjust the config.

⚠️ About score-push: this PR publishes your plumber result

The last two commits enable score-push and add a Plumber Score badge to the README.md. When the workflow runs, it publishes this repository's result to the hosted service at score.getplumber.io over OIDC (no secret required).

This makes the repository name and its A to E score publicly visible. The README badge displays the score of the default branch.

If you would rather not publish it: just tell me and I will remove the 2 last commits from the PR. The scan and the hardening keep working either way.

Add an independent workflow that runs Plumber to scan the GitHub Actions
workflows for CI/CD security issues on every push and pull request to main.
The report is uploaded to the Security tab as SARIF.

The check fails only when the Plumber Score drops below C. Publishing the
score to the hosted badge service is left disabled.

Signed-off-by: Thomas Boni <thomas@getplumber.io>
Add an explicit least-privilege permissions block to the linter, test and
release workflows so the GITHUB_TOKEN no longer inherits the repository
default scope. linter keeps contents: read plus statuses: write for
super-linter, test keeps contents: read, and release keeps contents: write
for the version bump, push and release steps.

Signed-off-by: Thomas Boni <thomas@getplumber.io>
Add .plumber.yaml based on Plumber's github defaults, with every control kept
enabled so none is silently turned off. Code owner approval is not part of
this project's branch protection policy, so branchMustBeProtected.
codeOwnerApprovalRequired is set to false.

Signed-off-by: Thomas Boni <thomas@getplumber.io>
Turn on score-push and grant id-token: write so the workflow publishes this
repository's Plumber Score to the hosted score service. This keeps the README
badge current; the badge displays the score of the default branch. It makes
the repository name and score public.

Signed-off-by: Thomas Boni <thomas@getplumber.io>
Show the repository's Plumber Score at the top of the README. The badge is
served by the hosted score service and displays the score of the default
branch.

Signed-off-by: Thomas Boni <thomas@getplumber.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant