Skip to content

Commit 364deea

Browse files
varunsh-coderdanielleadams
authored andcommitted
build: add GitHub token permissions for workflows
Signed-off-by: Varun Sharma <varunsh@stepsecurity.io> PR-URL: #43743 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 1deb6b7 commit 364deea

24 files changed

+93
-0
lines changed

.github/workflows/authors.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66

77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
authors_update:
1114
if: github.repository == 'nodejs/node'

.github/workflows/auto-start-ci.yml

+8
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ concurrency: ${{ github.workflow }}
1313
env:
1414
NODE_VERSION: lts/*
1515

16+
permissions:
17+
contents: read
18+
1619
jobs:
1720
get-prs-for-ci:
21+
permissions:
22+
pull-requests: read
1823
if: github.repository == 'nodejs/node'
1924
runs-on: ubuntu-latest
2025
outputs:
@@ -32,6 +37,9 @@ jobs:
3237
env:
3338
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3439
start-ci:
40+
permissions:
41+
contents: read
42+
pull-requests: write
3543
needs: get-prs-for-ci
3644
if: needs.get-prs-for-ci.outputs.numbers != ''
3745
runs-on: ubuntu-latest

.github/workflows/build-tarball.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ env:
3131
PYTHON_VERSION: '3.10'
3232
FLAKY_TESTS: dontcare
3333

34+
permissions:
35+
contents: read
36+
3437
jobs:
3538
build-tarball:
3639
if: github.event.pull_request.draft == false

.github/workflows/build-windows.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ env:
2626
PYTHON_VERSION: '3.10'
2727
FLAKY_TESTS: dontcare
2828

29+
permissions:
30+
contents: read
31+
2932
jobs:
3033
build-windows:
3134
if: github.event.pull_request.draft == false

.github/workflows/close-stale-feature-requests.yml

+6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ env:
2828
[feature request management document](https://github.com/nodejs/node/blob/HEAD/doc/contributing/feature-request-management.md).
2929
# yamllint enable
3030

31+
permissions:
32+
contents: read
33+
3134
jobs:
3235
stale:
36+
permissions:
37+
issues: write # for actions/stale to close stale issues
38+
pull-requests: write # for actions/stale to close stale PRs
3339
if: github.repository == 'nodejs/node'
3440
runs-on: ubuntu-latest
3541
steps:

.github/workflows/close-stalled.yml

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ env:
99
is still relevant, or to ping the collaborator who labelled it stalled if
1010
you have any questions.
1111
12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
stale:
17+
permissions:
18+
issues: write # for actions/stale to close stale issues
19+
pull-requests: write # for actions/stale to close stale PRs
1420
if: github.repository == 'nodejs/node'
1521
runs-on: ubuntu-latest
1622
steps:

.github/workflows/comment-labeled.yml

+8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ env:
1111
If it should remain open, please leave a comment explaining why it should remain open.
1212
FAST_TRACK_MESSAGE: Fast-track has been requested by @${{ github.actor }}. Please 👍 to approve.
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
stale-comment:
19+
permissions:
20+
issues: write
21+
pull-requests: write
1622
if: github.repository == 'nodejs/node' && github.event.label.name == 'stalled'
1723
runs-on: ubuntu-latest
1824
steps:
@@ -23,6 +29,8 @@ jobs:
2329
run: gh issue comment "$NUMBER" --repo ${{ github.repository }} --body "$STALE_MESSAGE"
2430

2531
fast-track:
32+
permissions:
33+
pull-requests: write
2634
if: github.repository == 'nodejs/node' && github.event_name == 'pull_request_target' && github.event.label.name == 'fast-track'
2735
runs-on: ubuntu-latest
2836
steps:

.github/workflows/commit-lint.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on: [pull_request]
55
env:
66
NODE_VERSION: lts/*
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
lint-commit-message:
1013
runs-on: ubuntu-latest

.github/workflows/commit-queue.yml

+5
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ concurrency: ${{ github.workflow }}
1818
env:
1919
NODE_VERSION: lts/*
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
get_mergeable_prs:
26+
permissions:
27+
pull-requests: read
2328
if: github.repository == 'nodejs/node'
2429
runs-on: ubuntu-latest
2530
outputs:

.github/workflows/coverage-linux.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ env:
2929
PYTHON_VERSION: '3.10'
3030
FLAKY_TESTS: dontcare
3131

32+
permissions:
33+
contents: read
34+
3235
jobs:
3336
coverage-linux:
3437
if: github.event.pull_request.draft == false

.github/workflows/coverage-windows.yml

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ env:
3131
PYTHON_VERSION: '3.10'
3232
FLAKY_TESTS: dontcare
3333

34+
permissions:
35+
contents: read
36+
3437
jobs:
3538
coverage-windows:
3639
if: github.event.pull_request.draft == false

.github/workflows/daily.yml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
env:
99
NODE_VERSION: lts/*
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
build-lto:
1316
runs-on: ubuntu-latest

.github/workflows/doc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
env:
1717
NODE_VERSION: lts/*
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
build-docs:
2124
if: github.event.pull_request.draft == false

.github/workflows/find-inactive-collaborators.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
env:
1111
NODE_VERSION: lts/*
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
find:
1518
if: github.repository == 'nodejs/node'

.github/workflows/find-inactive-tsc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
env:
1111
NODE_VERSION: lts/*
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
find:
1518
if: github.repository == 'nodejs/node'

.github/workflows/label-pr.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request_target:
55
types: [opened]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
label:
912
runs-on: ubuntu-latest

.github/workflows/license-builder.yml

+6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
- cron: 0 0 * * 1
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
update_license:
14+
permissions:
15+
contents: write # for gr2m/create-or-update-pull-request-action to push local changes
16+
pull-requests: write # for gr2m/create-or-update-pull-request-action to create a PR
1117
if: github.repository == 'nodejs/node'
1218
runs-on: ubuntu-latest
1319
steps:

.github/workflows/linters.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ env:
1717
PYTHON_VERSION: '3.10'
1818
NODE_VERSION: lts/*
1919

20+
permissions:
21+
contents: read
22+
2023
jobs:
2124
lint-addon-docs:
2225
if: github.event.pull_request.draft == false

.github/workflows/notify-force-push.yml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
- main
55

66
name: Notify on Force Push
7+
permissions:
8+
contents: read
9+
710
jobs:
811
slackNotification:
912
name: Slack Notification

.github/workflows/test-asan.yml

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ env:
3333
PYTHON_VERSION: '3.10'
3434
FLAKY_TESTS: dontcare
3535

36+
permissions:
37+
contents: read
38+
3639
jobs:
3740
test-asan:
3841
if: github.event.pull_request.draft == false

.github/workflows/test-internet.yml

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ env:
2424
PYTHON_VERSION: '3.10'
2525
FLAKY_TESTS: dontcare
2626

27+
permissions:
28+
contents: read
29+
2730
jobs:
2831
test-internet:
2932
runs-on: ubuntu-latest

.github/workflows/test-linux.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ env:
2626
PYTHON_VERSION: '3.10'
2727
FLAKY_TESTS: dontcare
2828

29+
permissions:
30+
contents: read
31+
2932
jobs:
3033
test-linux:
3134
if: github.event.pull_request.draft == false

.github/workflows/test-macos.yml

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ env:
3232
PYTHON_VERSION: '3.10'
3333
FLAKY_TESTS: dontcare
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
test-macOS:
3740
if: github.event.pull_request.draft == false

.github/workflows/tools.yml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66

77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
tools-deps-update:
1114
if: github.repository == 'nodejs/node'

0 commit comments

Comments
 (0)