crickets-and-comb / crickets-and-comb/shared

Set least privileges in workflow call block permissions.

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Makefile
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Wherever we call one reusable workflow from another workflow, we should set the permissions to the least necessary. For instance, when we call `crickets-and-comb/shared/.github/workflows/block_workflow_mods.yml@main` from `block_workflow_mods_dispatch.yml`. We should do this in this repo and all others in Crickets and Comb.

From GitHub security scan report:
"""
If a GitHub Actions job or workflow has no explicit permissions set, then the repository permissions are used. Repositories created under organizations inherit the organization permissions. The organizations or repositories created before February 2023 have the default permissions set to read-write. Often these permissions do not adhere to the principle of least privilege and can be reduced to read-only, leaving the write permission only to a specific types as issues: write or pull-requests: write.

Add the permissions key to the job or the root of workflow (in this case it is applied to all jobs in the workflow that do not have their own permissions key) and assign the least privileges required to complete the task:
"""

```
name: "My workflow"
permissions:
contents: read
pull-requests: write
```

or

```
jobs:
my-job:
permissions:
contents: read
pull-requests: write
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.