Skip to content

Secure workflows against supply-chain attacks #13

Description

@DougReeder

The Problem

Supply-chain attacks against GitHub workflows are now frequent enough that we must act.

Our remediation

Run zizmor (or an equivalent tool) on each workflow and assess the recommendations

cd localrepo
docker run --rm --name zizmor -v .:/usr/repo ghcr.io/zizmorcore/zizmor --fix=all /usr/repo

Determine what permissions are needed for each workflow and then set the permissions accordingly

You can find the needed permissions by creating a testing branch and adding the following line to the start of each job (so it becomes the first step) in the workflow file, then push the modified workflow to your fork and run it (if it doesn't run automatically).

- uses: GitHubSecurityLab/actions-permissions/monitor@bf82d13b9b10051d224345ab9184f5ede0a94289 #v1 Beta 9

Note: workflows that are limited to Hubs Foundation repositories will need to be modified to work on your fork. Also, some workflows may only be triggerable when on the default branch, in which case you'll need to make the changes there and revert afterwards. Finally, there are some cases where this may not work, e.g. if the workflow uses the graphql api, so if this is the case, then you'll need to disable all permissions for the workflow file and turn on the ones GitHub complains about when running the workflow.

Main repos check status

Change Default workflow permissions

When all the workflows we actually use have been tightened up, we'll

  • change the Hubs-Foundation default workflow permissions to "Read repository contents and packages permissions"

Other repos

Metadata

Metadata

Assignees

No one assigned

    Labels

    Roadmap: ProgrammingIndicates that this issue/pull request is on the Programming Team roadmapTracking IssueLabel for issues that are used as a central place to coordinate larger pieces of work

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions