What are the permissions of `GITHUB_TOKEN` and how do you restrict them?
IntermediateConceptGitHub features, history rewriting and scale
Answer
It is a per-run token with repo-scoped permissions. Set the default to read-only in org settings and grant only what each workflow needs with a permissions: block.
permissions:
contents: read
pull-requests: write
More on GitHub features, history rewriting and scale
What does a GitHub Actions workflow look like at a basic level?BeginnerWhat are GitHub environments and what protection do they offer?IntermediateWhat is a GitHub Release and how does it relate to a Git tag?BeginnerWhy do fork PRs get no secrets, and what is `pull_request_target`?AdvancedWhat is the difference between a GitHub fork and a clone?BeginnerWhat is a branch protection rule versus a ruleset?Intermediate