Skip to content

Commit 12608b0

Browse files
grasci-armsoumeh01
andauthored
[Security] Updated token permissions (#1389) (#2326)
Co-authored-by: Sourabh Mehta <73165318+soumeh01@users.noreply.github.com>
1 parent d3223e3 commit 12608b0

12 files changed

Lines changed: 51 additions & 16 deletions

.github/workflows/buildmgr.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ concurrency:
3535
group: ${{ github.workflow }}-${{ github.ref }}
3636
cancel-in-progress: true
3737

38+
permissions:
39+
contents: read
40+
3841
jobs:
3942
setup:
4043
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
@@ -215,6 +218,8 @@ jobs:
215218
# Debian package generation in ubuntu 22.04 produces incompatible metadata
216219
runs-on: ubuntu-22.04
217220
timeout-minutes: 15
221+
permissions:
222+
contents: write
218223
steps:
219224
- name: Harden Runner
220225
if: ${{ !github.event.repository.private }}
@@ -506,8 +511,7 @@ jobs:
506511
AC6_TOOLCHAIN_6_18_0: ${{ github.workspace }}/${{ matrix.toolchain_root }}
507512
runs-on: ubuntu-22.04
508513
timeout-minutes: 15
509-
strategy:
510-
fail-fast: true
514+
511515
steps:
512516
- name: Harden Runner
513517
if: ${{ !github.event.repository.private }}

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: true
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
analyze:
2427
name: Analyze

.github/workflows/global.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
release:
55
types: [ published ]
6+
67
permissions:
78
contents: read
89

.github/workflows/markdown.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ on:
66
- '.github/markdownlint.json'
77
- '.github/markdownlint.jsonc'
88
- '**/*.md'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
917
jobs:
1018
linter:
1119
name: Lint markdown files

.github/workflows/nightly.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
21
name: nightly
32

43
on:
54
workflow_dispatch:
65
schedule:
76
- cron: '0 0 * * *'
87

8+
permissions:
9+
contents: read
10+
911
jobs:
1012
buildmgr:
1113
if: github.repository == 'Open-CMSIS-Pack/devtools'

.github/workflows/packchk.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ concurrency:
4040
group: ${{ github.workflow }}-${{ github.ref }}
4141
cancel-in-progress: true
4242

43+
permissions:
44+
contents: read
45+
4346
jobs:
4447
setup:
4548
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
@@ -60,6 +63,8 @@ jobs:
6063
strategy:
6164
fail-fast: true
6265
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
66+
permissions:
67+
contents: write
6368
steps:
6469
- name: Harden Runner
6570
if: ${{ !github.event.repository.private }}
@@ -324,6 +329,8 @@ jobs:
324329
if-no-files-found: error
325330

326331
release:
332+
permissions:
333+
contents: write
327334
if: |
328335
github.event_name == 'release' &&
329336
startsWith(github.ref, 'refs/tags/tools/packchk/')

.github/workflows/packgen.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ concurrency:
3535
group: ${{ github.workflow }}-${{ github.ref }}
3636
cancel-in-progress: true
3737

38+
permissions:
39+
contents: read
40+
3841
jobs:
3942
setup:
4043
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
@@ -114,7 +117,8 @@ jobs:
114117
needs: [ build, unittest ]
115118
runs-on: ubuntu-22.04
116119
timeout-minutes: 15
117-
120+
permissions:
121+
contents: write
118122
steps:
119123
- name: Checkout devtools
120124
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

.github/workflows/projmgr.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: projmgr
32
on:
43
workflow_call:
@@ -40,6 +39,9 @@ concurrency:
4039
group: ${{ github.workflow }}-${{ github.ref }}
4140
cancel-in-progress: true
4241

42+
permissions:
43+
contents: read
44+
4345
jobs:
4446
setup:
4547
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
@@ -204,6 +206,8 @@ jobs:
204206
needs: [ build, build-swig, unittest, coverage ]
205207
runs-on: ubuntu-22.04
206208
timeout-minutes: 15
209+
permissions:
210+
contents: write
207211

208212
steps:
209213
- name: Checkout devtools

.github/workflows/scorecard.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,17 @@ on:
1111
branches: [ "main" ]
1212
workflow_dispatch:
1313

14-
# Declare default permissions as read only.
15-
permissions: read-all
14+
permissions:
15+
contents: read
1616

1717
jobs:
1818
analysis:
1919
if: github.repository == 'Open-CMSIS-Pack/devtools'
2020
name: Scorecard analysis
2121
runs-on: ubuntu-latest
2222
permissions:
23-
# Needed to upload the results to code-scanning dashboard.
2423
security-events: write
25-
# Needed to publish results and get a badge (see publish_results below).
2624
id-token: write
27-
# Uncomment the permissions below if installing in a private repository.
28-
# contents: read
29-
# actions: read
3025

3126
steps:
3227
- name: Harden Runner

.github/workflows/svdconv.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ concurrency:
3232
group: ${{ github.workflow }}-${{ github.ref }}
3333
cancel-in-progress: true
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
setup:
3740
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
@@ -52,6 +55,8 @@ jobs:
5255
strategy:
5356
fail-fast: true
5457
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
58+
permissions:
59+
contents: write
5560
steps:
5661
- name: Harden Runner
5762
if: ${{ !github.event.repository.private }}

0 commit comments

Comments
 (0)