- Notifications
You must be signed in to change notification settings - Fork396
Commitd88bff3
Set minimal workflow token permissions (#2773)
Fixes#2772.This PR sets top-level read-only permissions on all CI/CD workflows.Jobs that require additional permissions (`stale.yml` and`pr-comment.yml`) are given them at the job-level.I made more significant changes in `pr-comment.yml`. It is vulnerable tocode injection, since it runs files controlled by the PR author(`requirements.txt` and `scripts/list_missing_entries.py`, taken fromthe PR). I have therefore modified the workflow to checkout those filesfrom the base branch instead, ensuring we're running trusted versions ofthose files.And in order to minimize the code that has access to the`issues/pull-requests: write` permissions, I have separated the workflowinto two sequential jobs:1. `define-comment`, which is unprivileged and does almost everything2. `write-comment`, which has those additional permissions and uses themto perform the very last step of actually writing the comment on the PR.---------Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>Co-authored-by: rtobar <rtobarc@gmail.com>1 parentc5908f4 commitd88bff3
3 files changed
+37
-5
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 |
| |
10 | 13 |
| |
11 | 14 |
| |
|
Lines changed: 28 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 |
| |
7 |
| - | |
| 10 | + | |
8 | 11 |
| |
9 | 12 |
| |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 |
| |
11 | 17 |
| |
12 | 18 |
| |
| |||
17 | 23 |
| |
18 | 24 |
| |
19 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
20 | 35 |
| |
21 | 36 |
| |
22 |
| - | |
| 37 | + | |
23 | 38 |
| |
24 | 39 |
| |
25 | 40 |
| |
| |||
34 | 49 |
| |
35 | 50 |
| |
36 | 51 |
| |
37 |
| - | |
| 52 | + | |
38 | 53 |
| |
39 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
40 | 64 |
| |
41 |
| - | |
42 | 65 |
| |
43 | 66 |
| |
44 |
| - | |
| 67 | + | |
45 | 68 |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 |
| |
7 | 10 |
| |
8 | 11 |
| |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 |
| |
10 | 16 |
| |
11 | 17 |
| |
|
0 commit comments
Comments
(0)