Skip to content

Commit b34b2c8

Browse files
Add token permissions for CIs to fix issues reported by scorecard (#3867)
1 parent 3ad9530 commit b34b2c8

20 files changed

+164
-4
lines changed

.github/workflows/build_docker_images.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ on:
1515
type: string
1616
required: true
1717

18+
permissions:
19+
contents: read
20+
1821
jobs:
1922
build-and-push-images:
2023
runs-on: ubuntu-22.04
24+
permissions:
25+
contents: write # for uploading release artifacts
2126

2227
steps:
2328
- name: Checkout repository

.github/workflows/build_iwasm_release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ env:
8787
-DWAMR_BUILD_EXCE_HANDLING=1 \
8888
-DWAMR_BUILD_GC=1"
8989

90+
permissions:
91+
contents: read
92+
9093
jobs:
9194
build:
9295
runs-on: ${{ inputs.runner }}
@@ -97,6 +100,9 @@ jobs:
97100
suffix: ''
98101
- build_options: $GC_EH_BUILD_OPTIONS
99102
suffix: '-gc-eh'
103+
permissions:
104+
contents: write # for uploading release artifacts
105+
100106
steps:
101107
- uses: actions/checkout@v4
102108

.github/workflows/build_llvm_libraries.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ on:
2727
description: "A cached key of LLVM libraries"
2828
value: ${{ jobs.build_llvm_libraries.outputs.key}}
2929

30+
permissions:
31+
contents: read
32+
3033
jobs:
3134
build_llvm_libraries:
3235
runs-on: ${{ inputs.os }}
@@ -36,6 +39,9 @@ jobs:
3639
image: ${{ inputs.container_image }}
3740
outputs:
3841
key: ${{ steps.create_lib_cache_key.outputs.key}}
42+
permissions:
43+
contents: read
44+
actions: write # for uploading cached artifact
3945

4046
steps:
4147
- name: checkout

.github/workflows/build_wamr_lldb.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ on:
2828
required: false
2929
default: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz"
3030

31+
permissions:
32+
contents: read
33+
3134
jobs:
3235
try_reuse:
36+
permissions:
37+
contents: write # for uploading release artifacts
3338
uses: ./.github/workflows/reuse_latest_release_binaries.yml
3439
with:
3540
binary_name_stem: "wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}"
@@ -46,6 +51,9 @@ jobs:
4651
PYTHON_VERSION: '3.10'
4752
PYTHON_UBUNTU_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz
4853
PYTHON_MACOS_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-apple-darwin-install_only.tar.gz
54+
permissions:
55+
contents: write # for uploading release artifacts
56+
4957
steps:
5058
- uses: actions/checkout@v4
5159

.github/workflows/build_wamr_sdk.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ on:
3535
type: string
3636
required: true
3737

38+
permissions:
39+
contents: read
40+
3841
jobs:
3942
build:
4043
runs-on: ${{ inputs.runner }}
44+
permissions:
45+
contents: write # for uploading release artifacts
46+
4147
steps:
4248
- uses: actions/checkout@v4
4349

.github/workflows/build_wamr_vscode_ext.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,15 @@ on:
1414
type: string
1515
required: true
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
build:
1922
runs-on: ubuntu-22.04
23+
permissions:
24+
contents: write # for uploading release artifacts
25+
2026
steps:
2127
- uses: actions/checkout@v4
2228

.github/workflows/build_wamrc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ on:
3131
type: string
3232
required: false
3333

34+
permissions:
35+
contents: read
36+
3437
jobs:
3538
build:
3639
runs-on: ${{ inputs.runner }}
40+
permissions:
41+
contents: write # for uploading release artifacts
42+
3743
steps:
3844
- uses: actions/checkout@v4
3945

.github/workflows/codeql.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
# allow to be triggered manually
2020
workflow_dispatch:
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
analyze:
2427
if: github.repository == 'bytecodealliance/wasm-micro-runtime'
@@ -30,17 +33,18 @@ jobs:
3033
# Consider using larger runners for possible analysis time improvements.
3134
runs-on: ${{ (matrix.language == 'swift' && 'macos-13') || 'ubuntu-22.04' }}
3235
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33-
permissions:
34-
actions: read
35-
contents: read
36-
security-events: write
3736

3837
strategy:
3938
fail-fast: false
4039
matrix:
4140
language: [ 'cpp' ]
4241
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
4342

43+
permissions:
44+
contents: read
45+
actions: read
46+
security-events: write
47+
4448
steps:
4549
- name: Checkout repository
4650
uses: actions/checkout@v3

.github/workflows/coding_guidelines.yml

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

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
compliance_job:
1922
runs-on: ubuntu-20.04

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ env:
7070
MEMORY64_TEST_OPTIONS: "-s spec -W -b -P"
7171
MULTI_MEMORY_TEST_OPTIONS: "-s spec -E -b -P"
7272

73+
permissions:
74+
contents: read
75+
7376
jobs:
7477
build_llvm_libraries_on_ubuntu_2204:
78+
permissions:
79+
contents: read
80+
actions: write
7581
uses: ./.github/workflows/build_llvm_libraries.yml
7682
with:
7783
os: "ubuntu-22.04"

.github/workflows/compilation_on_macos.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,22 @@ env:
5252
LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
5353
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
5454

55+
permissions:
56+
contents: read
57+
5558
jobs:
5659
build_llvm_libraries_on_intel_macos:
60+
permissions:
61+
contents: read
62+
actions: write
5763
uses: ./.github/workflows/build_llvm_libraries.yml
5864
with:
5965
os: "macos-13"
6066
arch: "X86"
6167
build_llvm_libraries_on_arm_macos:
68+
permissions:
69+
contents: read
70+
actions: write
6271
uses: ./.github/workflows/build_llvm_libraries.yml
6372
with:
6473
os: "macos-14"

.github/workflows/compilation_on_nuttx.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ concurrency:
4646
env:
4747
WASI_SDK_PATH: "/opt/wasi-sdk"
4848

49+
permissions:
50+
contents: read
51+
4952
jobs:
5053
build_iwasm_on_nuttx:
5154
runs-on: ubuntu-latest

.github/workflows/compilation_on_sgx.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ env:
5454
LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
5555
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
5656

57+
permissions:
58+
contents: read
59+
5760
jobs:
5861
build_llvm_libraries:
62+
permissions:
63+
contents: read
64+
actions: write
5965
uses: ./.github/workflows/build_llvm_libraries.yml
6066
with:
6167
os: "ubuntu-20.04"

.github/workflows/compilation_on_windows.yml

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

56+
permissions:
57+
contents: read
58+
5659
jobs:
5760
build:
5861
runs-on: windows-latest

.github/workflows/create_tag.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@ on:
1515
description: "the new tag just created"
1616
value: ${{ jobs.create_tag.outputs.new_tag}}
1717

18+
permissions:
19+
contents: read
20+
1821
jobs:
1922
create_tag:
2023
runs-on: ubuntu-latest
2124
outputs:
2225
minor_version: ${{ steps.preparation.outputs.minor_version }}
2326
new_ver: ${{ steps.preparation.outputs.new_ver }}
2427
new_tag: ${{ steps.preparation.outputs.new_tag }}
28+
permissions:
29+
contents: write # create and push tags
2530

2631
steps:
2732
- uses: actions/checkout@v4

.github/workflows/hadolint_dockerfiles.yml

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

31+
permissions:
32+
contents: read
33+
3134
jobs:
3235
run-hadolint-on-dockerfiles:
3336
runs-on: ubuntu-22.04

.github/workflows/nightly_run.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,22 @@ env:
4444
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
4545
WASI_TEST_OPTIONS: "-s wasi_certification -w"
4646

47+
permissions:
48+
contents: read
49+
4750
jobs:
4851
build_llvm_libraries_on_ubuntu_2004:
52+
permissions:
53+
contents: read
54+
actions: write
4955
uses: ./.github/workflows/build_llvm_libraries.yml
5056
with:
5157
os: "ubuntu-20.04"
5258
arch: "X86"
5359
build_llvm_libraries_on_ubuntu_2204:
60+
permissions:
61+
contents: read
62+
actions: write
5463
uses: ./.github/workflows/build_llvm_libraries.yml
5564
with:
5665
os: "ubuntu-22.04"

0 commit comments

Comments
 (0)