Skip to content

[BUG]: Set minimal permissions to github workflows  #4567

@joycebrum

Description

@joycebrum

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

None

Problem description

Github grants, by default, write-all permission to all workflows, which allows an attacker to exploit this permissions in case of a compromised workflow. Thus, it is both a recommendation from the OpenSSF Scorecard and the Github itself to always use credentials that are minimally scoped.

This means setting the top level permission as contents: read (usually enough to most actions) or even read-all, and grant any write permission at the job level

Let me know if you are interested in this change and I'll submit the PR as soon as possible.

Context: I'm Joyce, working on behalf of Google and the OpenSSF to increase supply chain security in many open source projects.

Reproducible example code

You can see the permissions granted to a workflow run in the run log such as https://github.com/pybind/pybind11/actions/runs/4378748766/jobs/7663879679 in the `Set up job` -> `GITHUB_TOKEN Permissions`

Is this a regression? Put the last known working version here if it is.

Not a regression

Metadata

Metadata

Assignees

No one assigned

    Labels

    cirelated to the CI systemgithub_actionsPull requests that update Github_actions code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions