Skip to content

Commit ea2f834

Browse files
authored
[Security] Updated token permissions (#151)
1 parent 05b157a commit ea2f834

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ on:
55
tags:
66
- "v*"
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build-and-verify:
13+
permissions:
14+
contents: read
15+
actions: write
1016
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/build-and-verify.yml@v1.0.2
1117
with:
1218
program: cpackget
@@ -18,14 +24,17 @@ jobs:
1824
needs: [ build-and-verify ]
1925
permissions:
2026
contents: write
27+
actions: read
28+
id-token: write
2129
runs-on: ubuntu-latest
30+
2231
steps:
2332
- name: Harden the runner (Audit all outbound calls)
2433
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
2534
with:
2635
egress-policy: audit
2736

28-
- name: Checkout
37+
- name: Checkout repository
2938
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3039
with:
3140
fetch-depth: 0

.github/workflows/tpip-check.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,18 @@ permissions:
1919

2020
jobs:
2121
check-licenses:
22-
# Avoid running this on forks
2322
if: github.repository == 'Open-CMSIS-Pack/vidx2pidx'
2423
runs-on: ubuntu-latest
2524
timeout-minutes: 5
26-
permissions:
27-
checks: write
28-
pull-requests: write
29-
actions: write
25+
3026
steps:
3127
- name: Harden Runner
3228
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
3329
with:
3430
egress-policy: audit
3531

36-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
32+
- name: Checkout repository
33+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3734

3835
- name: Set up Go
3936
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
@@ -42,14 +39,17 @@ jobs:
4239
check-latest: true
4340

4441
- name: Go tidy
45-
run: go mod tidy
42+
run: go mod tidy
4643

4744
- name: Install go-licenses
4845
run: go install github.com/google/go-licenses@5348b744d0983d85713295ea08a20cca1654a45e # v1.6.0
4946

5047
- name: Generate TPIP Report
5148
run: |
52-
go-licenses report . --ignore github.com/Open-CMSIS-Pack/vidx2pidx --template ../scripts/template/${{ env.tpip_report }}.template > ../${{ env.tpip_report }}
49+
go-licenses report . \
50+
--ignore github.com/Open-CMSIS-Pack/vidx2pidx \
51+
--template ../scripts/template/${{ env.tpip_report }}.template \
52+
> ../${{ env.tpip_report }}
5353
working-directory: ./cmd
5454

5555
- name: Archive TPIP report
@@ -58,31 +58,33 @@ jobs:
5858
name: tpip-report
5959
path: ./${{ env.tpip_report }}
6060

61-
- name: Print TPIP Report
61+
- name: Print TPIP Report to summary
6262
run: cat ${{ env.tpip_report }} >> $GITHUB_STEP_SUMMARY
6363

6464
- name: Check Licenses
65-
run: go-licenses check . --ignore github.com/Open-CMSIS-Pack/vidx2pidx --disallowed_types=forbidden,restricted
65+
run: |
66+
go-licenses check . \
67+
--ignore github.com/Open-CMSIS-Pack/vidx2pidx \
68+
--disallowed_types=forbidden,restricted
6669
working-directory: ./cmd
6770

6871
commit-changes:
69-
# Running this job only on specific event
70-
# in order to have workaround for issue
71-
# related to deletion of GH checks/status data
72-
permissions:
73-
contents: write # for peter-evans/create-pull-request to create branch
74-
pull-requests: write # for peter-evans/create-pull-request to create a PR
7572
if: (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch')
7673
needs: [ check-licenses ]
7774
runs-on: ubuntu-latest
7875
timeout-minutes: 5
76+
permissions:
77+
contents: read
78+
pull-requests: read
79+
7980
steps:
8081
- name: Harden Runner
8182
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
8283
with:
8384
egress-policy: audit
8485

85-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
86+
- name: Checkout repository
87+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8688
with:
8789
ref: ${{ github.event.pull_request.head.ref }}
8890
fetch-depth: 0
@@ -92,9 +94,10 @@ jobs:
9294
with:
9395
name: tpip-report
9496

95-
- name: Create Pull Request
97+
- name: Create pull request
9698
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
9799
with:
100+
token: ${{ secrets.GRASCI_WORKFLOW_UPDATE }}
98101
commit-message: Update TPIP report
99102
title: ':robot: [TPIP] Automated report updates'
100103
body: |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Update go-workflows
1+
name: Update Workflows
22

33
on:
44
workflow_dispatch:
55
schedule:
66
- cron: "30 3 * * *"
77

88
permissions:
9-
contents: write
10-
pull-requests: write
9+
contents: read
1110

1211
jobs:
1312
update-workflows:
13+
name: Update Workflow References
1414
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/update-workflow.yml@v1.0.2
1515
secrets:
1616
TOKEN_ACCESS: ${{ secrets.GRASCI_WORKFLOW_UPDATE }}

0 commit comments

Comments
 (0)