Skip to content

Commit 1e894d1

Browse files
authored
[CI][OSSF] Add default permissions to work flows (#13173)
per OSSF (https://securityscorecards.dev/viewer/?uri=github.com/intel/llvm) all workflows should have default top level permission set. Which we set to below as per recommendation permissions: contents: read then within actual jobs, when needed, we added additional privileges. These changes were generated by the recommended OSSF tool This PR changes those workflows created/owned by intel/llvm repo. Will do seperate PR for issues found in llvm/llvm-project inherited workflows.
1 parent db6a05d commit 1e894d1

17 files changed

+57
-0
lines changed

.github/workflows/sycl-aws.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Start/Stop AWS instance
22

3+
permissions: read-all
4+
35
on:
46
workflow_call:
57
inputs:

.github/workflows/sycl-containers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ on:
2121
- 'devops/scripts/install_build_tools.sh'
2222
- '.github/workflows/sycl-containers.yaml'
2323

24+
permissions: read-all
25+
2426
jobs:
2527
base_image_ubuntu2204:
2628
if: github.repository == 'intel/llvm'

.github/workflows/sycl-detect-changes.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
description: Matched filters
88
value: ${{ jobs.need_check.outputs.filters }}
99

10+
permissions: read-all
11+
1012
jobs:
1113
need_check:
1214
name: Decide which tests could be affected by the changes

.github/workflows/sycl-docs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ on:
1111
- 'clang/docs/**'
1212
- 'sycl/doc/**'
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
build:
19+
permissions:
20+
contents: write # for Git to git push
1621
runs-on: ubuntu-latest
1722
if: github.repository == 'intel/llvm'
1823
steps:

.github/workflows/sycl-linux-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ on:
103103
options:
104104
- 3
105105

106+
permissions:
107+
contents: read
108+
106109
jobs:
107110
build:
108111
name: Build + LIT

.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
Format: '{"VAR1":"VAL1","VAR2":"VAL2",...}'
1111
default: '{"LIT_FILTER":""}'
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
linux_e2e_on_nightly:
1518
name: E2E on Nightly

.github/workflows/sycl-linux-precommit-aws.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
types:
1515
- completed
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
create-check:
1922
runs-on: [Linux, build]

.github/workflows/sycl-linux-precommit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ concurrency:
2929
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
3030
cancel-in-progress: true
3131

32+
permissions:
33+
contents: read
34+
3235
jobs:
3336
detect_changes:
3437
uses: ./.github/workflows/sycl-detect-changes.yml

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ on:
132132
- false
133133
- true
134134

135+
permissions:
136+
contents: read
137+
135138
jobs:
136139
run:
137140
name: ${{ inputs.name }}

.github/workflows/sycl-macos-build-and-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
required: false
2020
default: ""
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
build:
2427
name: Build

.github/workflows/sycl-nightly.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
schedule:
66
- cron: '0 3 * * *'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
ubuntu2204_build:
1013
if: github.repository == 'intel/llvm'

.github/workflows/sycl-post-commit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- ./devops/actions/cleanup
2020
- ./devops/actions/cached_checkout
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
build-lin:
2427
name: Linux (Self build + shared libraries + no-assertions)

.github/workflows/sycl-stale-issues.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ on:
44
schedule:
55
- cron: '30 1 * * *'
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
close-issues:
12+
permissions:
13+
issues: write # for actions/stale to close stale issues
14+
pull-requests: write # for actions/stale to close stale PRs
915
runs-on: ubuntu-20.04
1016
steps:
1117
- uses: actions/stale@v9

.github/workflows/sycl-sync-main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ name: main branch sync
33
on:
44
workflow_dispatch:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
sync:
11+
permissions:
12+
contents: write # for Git to git push
813
runs-on: ubuntu-20.04
914
if: github.repository == 'intel/llvm'
1015
steps:

.github/workflows/sycl-update-gpu-driver.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ on:
55
- cron: '0 3 * * 2'
66
workflow_dispatch:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
update_driver_linux:
13+
permissions:
14+
contents: write # for Git to git push
1015
runs-on: ubuntu-20.04
1116
if: github.repository == 'intel/llvm'
1217
steps:

.github/workflows/sycl-windows-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ on:
5050
type: choice
5151
options:
5252
- 3
53+
permissions:
54+
contents: read
5355

5456
jobs:
5557
build:

.github/workflows/sycl-windows-run-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ on:
3232
type: string
3333
default: '{}'
3434
required: False
35+
36+
permissions:
37+
contents: read
38+
3539
jobs:
3640
run:
3741
name: ${{ inputs.name }}

0 commit comments

Comments
 (0)