Skip to content

Commit 8a9e637

Browse files
authored
Merge pull request #97 from eclipse-esmf/96-add-leverage-sast-for-github-action-code
Add zizmor.yml for SAST
2 parents cdbc507 + 6ec0148 commit 8a9e637

File tree

4 files changed

+88
-40
lines changed

4 files changed

+88
-40
lines changed

.github/workflows/codeql-scanning.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
schedule:
99
- cron: '30 0 * * *'
1010

11+
permissions: {}
12+
1113
jobs:
1214
analyze:
1315
name: Analyze
@@ -25,23 +27,23 @@ jobs:
2527

2628
steps:
2729
- name: Checkout repository
28-
uses: actions/checkout@v3
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
2931

3032
- name: Set up JDK ${{ matrix.java }}
31-
uses: actions/setup-java@v2
33+
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e #v5.1.0
3234
with:
3335
java-version: ${{ matrix.java }}
3436
distribution: 'adopt'
3537

3638
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v2
39+
uses: github/codeql-action/init@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
3840
with:
3941
languages: ${{ matrix.language }}
4042

4143
- name: Autobuild
42-
uses: github/codeql-action/autobuild@v2
44+
uses: github/codeql-action/autobuild@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
4345

4446
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@v2
47+
uses: github/codeql-action/analyze@6bc82e05fd0ea64601dd4b465378bbcf57de0314 # v4.32.1
4648
with:
4749
category: "/language:${{matrix.language}}"

.github/workflows/pull_request_check.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
pull_request:
77
branches: [ '**' ]
88

9+
permissions: {}
10+
911
jobs:
1012
build:
1113
name: Check if passes all requirements
@@ -17,29 +19,29 @@ jobs:
1719

1820
steps:
1921
- name: Checkout project
20-
uses: actions/checkout@v3
22+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
2123

2224
- name: Configure Pagefile
2325
if: matrix.os == 'windows-latest'
2426
# Fix for "LINK : fatal error LNK1171: unable to load mspdbcore.dll (error code: 1455)":
2527
# This seems to be caused by running out of memory; increasing page file
2628
# size suggested here:
2729
# https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418
28-
uses: al-cheb/configure-pagefile-action@v1.2
30+
uses: al-cheb/configure-pagefile-action@9b6da52fb72a3c6147c1aad2df22d8d905681adc # v1.5
2931
with:
3032
minimum-size: 16GB
3133
maximum-size: 16GB
3234
disk-root: "C:"
3335

3436
- name: Setup graalvm ce
35-
uses: graalvm/setup-graalvm@v1
37+
uses: graalvm/setup-graalvm@54b4f5a65c1a84b2fdfdc2078fe43df32819e4b1 # v1.4.5
3638
with:
3739
java-version: '21'
3840
distribution: 'graalvm'
3941
github-token: ${{ secrets.GITHUB_TOKEN }}
4042

4143
- name: Cache maven packages
42-
uses: actions/cache@v3
44+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb #v5.0.1
4345
with:
4446
path: ~/.m2/repository
4547
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -60,7 +62,7 @@ jobs:
6062

6163
- name: Set up MSVC
6264
if: matrix.os == 'windows-latest'
63-
uses: ilammy/msvc-dev-cmd@v1
65+
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
6466

6567
- name: Creating native image (Win)
6668
if: matrix.os == 'windows-latest'
@@ -88,7 +90,7 @@ jobs:
8890

8991
- name: Upload binary (Windows)
9092
if: matrix.os == 'windows-latest'
91-
uses: actions/upload-artifact@v4
93+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
9294
with:
9395
name: ame-backend-win
9496
path: |
@@ -99,7 +101,7 @@ jobs:
99101
100102
- name: Upload binary (Linux)
101103
if: matrix.os == 'ubuntu-latest'
102-
uses: actions/upload-artifact@v4
104+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
103105
with:
104106
name: ame-backend-linux
105107
path: |
@@ -108,7 +110,7 @@ jobs:
108110
109111
- name: Upload binary (Mac)
110112
if: matrix.os == 'macos-15-intel'
111-
uses: actions/upload-artifact@v4
113+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
112114
with:
113115
name: ame-backend-mac
114116
path: aspect-model-editor-runtime/target/ame-backend-DEV-SNAPSHOT-mac

.github/workflows/tagged_release.yml

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: 'Version number of the release'
88
required: true
99

10+
env:
11+
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
12+
13+
permissions: {}
14+
1015
jobs:
1116
build:
1217
name: Create tagged release
@@ -16,9 +21,13 @@ jobs:
1621
matrix:
1722
os: [ macos-15-intel, windows-latest, ubuntu-latest ]
1823

24+
permissions:
25+
contents: write
26+
actions: read
27+
1928
steps:
2029
- name: Checkout project
21-
uses: actions/checkout@v3
30+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
2231

2332
- name: Setup Git
2433
run: |
@@ -31,21 +40,21 @@ jobs:
3140
# This seems to be caused by running out of memory; increasing page file
3241
# size suggested here:
3342
# https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418
34-
uses: al-cheb/configure-pagefile-action@v1.2
43+
uses: al-cheb/configure-pagefile-action@9b6da52fb72a3c6147c1aad2df22d8d905681adc # v1.5
3544
with:
3645
minimum-size: 16GB
3746
maximum-size: 16GB
3847
disk-root: "C:"
3948

4049
- name: Setup graalvm ce
41-
uses: graalvm/setup-graalvm@v1
50+
uses: graalvm/setup-graalvm@54b4f5a65c1a84b2fdfdc2078fe43df32819e4b1 # v1.4.5
4251
with:
4352
java-version: '21'
4453
distribution: 'graalvm'
4554
github-token: ${{ secrets.GITHUB_TOKEN }}
4655

4756
- name: Cache maven packages
48-
uses: actions/cache@v3
57+
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb #v5.0.1
4958
with:
5059
path: ~/.m2/repository
5160
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -55,8 +64,7 @@ jobs:
5564
- name: Set versions
5665
if: matrix.os == 'ubuntu-latest'
5766
run: |
58-
release_version=${{ github.event.inputs.release_version }}
59-
release_branch_name=${release_version%.*}.x
67+
release_branch_name=${RELEASE_VERSION%.*}.x
6068
echo "release_branch_name=$release_branch_name" >> $GITHUB_ENV
6169
6270
- name: Create Release branch
@@ -69,13 +77,13 @@ jobs:
6977
7078
- name: Set maven version
7179
if: matrix.os == 'macos-15-intel' || matrix.os == 'ubuntu-latest'
72-
run: mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
80+
run: mvn versions:set -DnewVersion=${RELEASE_VERSION}
7381
env:
7482
TOKEN: ${{ secrets.GITHUB_TOKEN }}
7583

7684
- name: Set maven version on Windows
7785
if: matrix.os == 'windows-latest'
78-
run: mvn versions:set -DnewVersion="${{ github.event.inputs.release_version }}"
86+
run: mvn versions:set -DnewVersion="${RELEASE_VERSION}"
7987
env:
8088
TOKEN: ${{ secrets.GITHUB_TOKEN }}
8189

@@ -94,7 +102,7 @@ jobs:
94102

95103
- name: Set up MSVC
96104
if: matrix.os == 'windows-latest'
97-
uses: ilammy/msvc-dev-cmd@v1
105+
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
98106

99107
- name: Creating native image (Win)
100108
if: matrix.os == 'windows-latest'
@@ -106,7 +114,7 @@ jobs:
106114
if: matrix.os == 'windows-latest'
107115
run: |
108116
$sourceFolder = "aspect-model-editor-runtime/target"
109-
$zipFile = "aspect-model-editor-v${{ github.event.inputs.release_version }}-win.zip"
117+
$zipFile = "aspect-model-editor-v${{ env.RELEASE_VERSION }}-win.zip"
110118
$tempDir = New-Item -ItemType Directory -Force -Path "$Env:TEMP\zip_temp"
111119
Get-ChildItem "$sourceFolder" -Filter "*.exe" | Copy-Item -Destination $tempDir
112120
Get-ChildItem "$sourceFolder" -Filter "*.dll" | Copy-Item -Destination $tempDir
@@ -116,58 +124,61 @@ jobs:
116124

117125
- name: Upload binary (Windows)
118126
if: matrix.os == 'windows-latest'
119-
uses: actions/upload-artifact@v4
127+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
120128
with:
121-
name: ame-backend-v${{ github.event.inputs.release_version }}-win
129+
name: ame-backend-v${{ env.RELEASE_VERSION }}-win
122130
path: |
123-
aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-win.exe
131+
aspect-model-editor-runtime/target/ame-backend-${{ env.RELEASE_VERSION }}-win.exe
124132
aspect-model-editor-runtime/target/*.dll
125133
aspect-model-editor-runtime/target/*.bat
126134
aspect-model-editor-runtime/target/lib/
127135
128136
- name: Upload binary (Mac)
129137
if: matrix.os == 'macos-15-intel'
130-
uses: actions/upload-artifact@v4
138+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
131139
with:
132-
name: ame-backend-v${{ github.event.inputs.release_version }}-mac
133-
path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-mac
140+
name: ame-backend-v${{ env.RELEASE_VERSION }}-mac
141+
path: aspect-model-editor-runtime/target/ame-backend-${{ env.RELEASE_VERSION }}-mac
134142

135143
- name: Upload binary (Linux)
136144
if: matrix.os == 'ubuntu-latest'
137-
uses: actions/upload-artifact@v4
145+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f #v6.0.0
138146
with:
139-
name: ame-backend-v${{ github.event.inputs.release_version }}-linux
140-
path: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux
147+
name: ame-backend-v${{ env.RELEASE_VERSION }}-linux
148+
path: aspect-model-editor-runtime/target/ame-backend-${{ env.RELEASE_VERSION }}-linux
141149

142150
# Release Linux executables
143151
- name: Create GitHub release (Linux)
144152
if: ${{ (matrix.os == 'ubuntu-latest') && (!contains( github.ref, '-M' )) }}
145-
uses: svenstaro/upload-release-action@latest
153+
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2.11.3
146154
with:
147155
file_glob: true
148156
overwrite: true
149157
prerelease: false
150158
repo_token: ${{ secrets.GITHUB_TOKEN }}
151-
file: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux
152-
tag: v${{ github.event.inputs.release_version }}
159+
file: aspect-model-editor-runtime/target/ame-backend-${{ env.RELEASE_VERSION }}-linux
160+
tag: v${{ env.RELEASE_VERSION }}
153161

154162
- name: Create GitHub pre-release (Linux)
155163
if: ${{ (matrix.os == 'ubuntu-latest') && (contains( github.ref, '-M' )) }}
156-
uses: svenstaro/upload-release-action@latest
164+
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2.11.3
157165
with:
158166
file_glob: true
159167
overwrite: true
160168
prerelease: true
161169
repo_token: ${{ secrets.GITHUB_TOKEN }}
162-
file: aspect-model-editor-runtime/target/ame-backend-${{ github.event.inputs.release_version }}-linux
163-
tag: v${{ github.event.inputs.release_version }}
170+
file: aspect-model-editor-runtime/target/ame-backend-${{ env.RELEASE_VERSION }}-linux
171+
tag: v${{ env.RELEASE_VERSION }}
164172

165173
release:
166174
needs: build
167175
runs-on: ubuntu-latest
176+
permissions:
177+
contents: write
178+
actions: read
168179
steps:
169180
- name: Checkout project
170-
uses: actions/checkout@v3
181+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
171182

172183
# Sign (Windows & Mac) executable
173184
- name: Get Artifact ID (Windows & Mac)
@@ -195,7 +206,7 @@ jobs:
195206
196207
echo "artifact_url_win=$ARTIFACT_URL_WIN" > parameters.txt
197208
echo "artifact_url_mac=$ARTIFACT_URL_MAC" >> parameters.txt
198-
echo "version=${{ github.event.inputs.release_version }}" >> parameters.txt
209+
echo "version=${{ env.RELEASE_VERSION }}" >> parameters.txt
199210
200211
git config --global user.email "github-actions@github.com"
201212
git config --global user.name "github-actions"

.github/workflows/zizmor.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (c) 2026 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
3+
#
4+
name: GitHub Actions SAST (zizmor)
5+
6+
on:
7+
pull_request:
8+
branches: [ main ]
9+
push:
10+
branches: [ main ]
11+
12+
permissions: {}
13+
14+
jobs:
15+
zizmor:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
23+
with:
24+
persist-credentials: false
25+
26+
- name: Run zizmor (PR annotations)
27+
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0
28+
with:
29+
advanced-security: false
30+
version: v1.22.0
31+
annotations: true
32+
persona: auditor
33+
min-severity: medium

0 commit comments

Comments
 (0)