Commit bdb66b1
committed
Configure permissions of
`GITHUB_TOKEN` is an access token provided automatically by GitHub Actions. The default permissions of this token for
workflow runs in a trusted context (i.e., not triggered by a PR from a fork) are set in the enterprise/organization/
epository's administrative settings, giving it either read-only or write permissions in all scopes.
In the case of a read-only default configuration, any workflow operations that require write permissions would fail with
an error like:
> 403: Resource not accessible by integration
In the case of a write default configuration, workflows have unnecessary permissions, which violates the security
principle of least privilege.
For this reason, GitHub Actions now allows fine grained control of the permissions provided to the token, which are used
here to configure the workflows for only the permissions they require in each job.
The automatic permissions downgrade from write to read for workflows triggered by events generated by a PR from a fork
is unaffected.
Even when all permissions are withheld (`permissions: {}`), the token still provides the authenticated API request rate
limiting allowance, which is a common use of the token in these workflows.
Read permissions are required in the "contents" scope in order to checkout private repositories. Even though those
permissions are not required for this public repository, the standardized "Sync Labels" workflow template is intended to
be applicable in public and private repositories both and so a small excess in permissions was chosen in order to use
the upstream template unmodified.GITHUB_TOKEN in workflows1 parent ed6838d commit bdb66b1
File tree
3 files changed
+9
-0
lines changed- .github/workflows
3 files changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
0 commit comments