Skip to content

Commit 1cc3783

Browse files
authored
[Security] Updated token permissions (#276)
1 parent fb633b9 commit 1cc3783

3 files changed

Lines changed: 38 additions & 22 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ on:
55
tags:
66
- "*"
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: cbridge
@@ -17,7 +23,10 @@ jobs:
1723
runs-on: ubuntu-latest
1824
needs: [ build-and-verify ]
1925
permissions:
20-
contents: write # for goreleaser/goreleaser-action to create a GitHub release
26+
contents: write
27+
actions: read
28+
id-token: write
29+
2130
steps:
2231
- name: Harden Runner
2332
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
@@ -38,7 +47,7 @@ jobs:
3847
tag: ${{ github.ref }}
3948
overwrite: true
4049

41-
- name: Checkout
50+
- name: Checkout repository
4251
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4352

4453
- name: Install Go

.github/workflows/tpip-check.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,35 @@ jobs:
2727
timeout-minutes: 5
2828
steps:
2929
- name: Harden Runner
30-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
30+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
3131
with:
3232
egress-policy: audit
3333

34-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
34+
- name: Checkout repository
35+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3536

3637
- name: Set up Go
37-
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
38+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
3839
with:
3940
go-version-file: go.mod
4041
check-latest: true
4142

4243
- name: Go tidy
43-
run: go mod tidy
44+
run: go mod tidy
4445

4546
- name: Install go-licenses
4647
run: go install github.com/google/go-licenses@5348b744d0983d85713295ea08a20cca1654a45e # v1.6.0
4748

4849
- name: Generate TPIP Report
4950
run: |
50-
go-licenses report . --ignore github.com/Open-CMSIS-Pack/generator-bridge --template ../configs/${{ env.report_name }}.template > ../${{ env.report_name }}
51+
go-licenses report . \
52+
--ignore github.com/Open-CMSIS-Pack/generator-bridge \
53+
--template ../configs/${{ env.report_name }}.template \
54+
> ../${{ env.report_name }}
5155
working-directory: ./cmd
5256

5357
- name: Archive tpip report
54-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
58+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
5559
with:
5660
name: tpip-report
5761
path: ./${{ env.report_name }}
@@ -60,39 +64,42 @@ jobs:
6064
run: cat ${{ env.report_name }} >> $GITHUB_STEP_SUMMARY
6165

6266
- name: Check Licenses
63-
run: go-licenses check . --ignore github.com/Open-CMSIS-Pack/generator-bridge --disallowed_types=forbidden,restricted
67+
run: |
68+
go-licenses check . \
69+
--ignore github.com/Open-CMSIS-Pack/generator-bridge \
70+
--disallowed_types=forbidden,restricted
6471
working-directory: ./cmd
6572

6673
commit-changes:
67-
# Running this job only on specific event
68-
# in order to have workaround for issue
69-
# related to deletion of GH checks/status data
70-
permissions:
71-
contents: write # for peter-evans/create-pull-request to create branch
72-
pull-requests: write # for peter-evans/create-pull-request to create a PR
7374
if: (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch')
7475
needs: [ check-licenses ]
7576
runs-on: ubuntu-latest
7677
timeout-minutes: 5
78+
permissions:
79+
contents: read
80+
pull-requests: read
81+
7782
steps:
7883
- name: Harden Runner
79-
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
84+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
8085
with:
8186
egress-policy: audit
8287

83-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
88+
- name: Checkout repository
89+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8490
with:
8591
ref: ${{ github.event.pull_request.head.ref }}
8692
fetch-depth: 0
8793

8894
- name: Restore Changes
89-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
95+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
9096
with:
9197
name: tpip-report
9298

9399
- name: Create Pull Request
94-
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
100+
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
95101
with:
102+
token: ${{ secrets.GRASCI_WORKFLOW_UPDATE }}
96103
commit-message: Update TPIP report
97104
title: ':robot: [TPIP] Automated report updates'
98105
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)