Skip to content

Add auto-labelling and security linting for workflows - #260

Open
rlahfa-dinum wants to merge 5 commits into
mainfrom
autolabeller
Open

rlahfa-dinum wants to merge 5 commits into
mainfrom
autolabeller

Conversation

@rlahfa-dinum

Copy link
Copy Markdown
Contributor

This adds automatic labelling for status updates and areas.

Because I had to use pull_request_target, I ensured that from now on, our workflows will pass zizmor which is a well-known basic security practice for GHA workflows, esp. ones that uses pull_request_target.

I spent extra time checking and hardening all workflows that made use of it.

Signed-off-by: Ryan Lahfa ryan.lahfa.ext@numerique.gouv.fr

Required for zizmor.

Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
Add zizmor (static analysis for GitHub Actions) as a pre-push hook.

Also address every zizmor finding in the existing workflows:

- scope GITHUB_TOKEN permissions per-job and drop unneeded writes,
- set `persist-credentials: false` on checkout where no push is needed,
- add the REUSE SPDX header that was missing from several files.

Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
Add a path-based labeler that applies A/* area labels to pull
requests based on the files they touch, matching the existing labels
of the Sécurix repository.

The workflow is restricted to same-repository PRs, scopes its token to
contents: read + pull-requests: write, and pins actions/labeler by SHA1.

Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
Signed-off-by: Ryan Lahfa <ryan.lahfa.ext@numerique.gouv.fr>
@rlahfa-dinum rlahfa-dinum added status: awaiting-maintainers This is blocked on a maintainer's review bandwidth A/infra CI, S3 cache, workflows and so on. labels Sep 9, 2026

@agrimault-dinum agrimault-dinum left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you are using pull_request_target safely, I don't see untrusted code execution. I would still justify the safety a bit more by saying that there are:

  • no checkout
  • no payload as code (no ${{ }})

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
# zizmor: ignore[artipacked] - the persisted credential is required to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The docs seems to recommend adding explicit persist-credentials: true https://docs.zizmor.sh/audits/#remediation_3

# workflow_run is safe here: github-script is pinned, no secrets are used,
# and the action only calls the GitHub API to manage labels. We only act on
# PRs from the same repository to avoid processing fork-sourced workflow runs.
if: github.event_name == 'workflow_run' && github.event.workflow_run.head_repository.full_name == github.repository

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is workflow_run missing from on:?

@rlahfa-dinum rlahfa-dinum added status: awaiting-author Blocked on author's actions and removed status: awaiting-maintainers This is blocked on a maintainer's review bandwidth labels Sep 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A/infra CI, S3 cache, workflows and so on. status: awaiting-author Blocked on author's actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants