Skip to content

Commit 82fa6b1

Browse files
Copilotjkowalleck
andauthored
chore: harden all GitHub workflows using zizmor (#1054)
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jkowalleck <2765863+jkowalleck@users.noreply.github.com> Co-authored-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 3d97dee commit 82fa6b1

5 files changed

Lines changed: 93 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ updates:
1212
prefix: 'chore' ## prefix maximum string length of 15
1313
include: 'scope'
1414
open-pull-requests-limit: 999
15+
cooldown:
16+
default-days: 7
1517
- package-ecosystem: 'docker'
1618
directory: '/'
1719
schedule:
@@ -24,6 +26,8 @@ updates:
2426
prefix: 'chore' ## prefix maximum string length of 15
2527
include: 'scope'
2628
open-pull-requests-limit: 999
29+
cooldown:
30+
default-days: 7
2731
- package-ecosystem: 'pip'
2832
directory: '/'
2933
schedule:
@@ -37,3 +41,5 @@ updates:
3741
prefix: 'chore' ## prefix maximum string length of 15
3842
include: 'scope'
3943
open-pull-requests-limit: 999
44+
cooldown:
45+
default-days: 7

.github/workflows/docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
# see https://github.com/actions/checkout
5151
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5252
with:
53+
persist-credentials: false
5354
fetch-depth: 0
5455
- name: setup reports-dir
5556
run: mkdir "$REPORTS_DIR"

.github/workflows/python.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ jobs:
5353
- name: Checkout
5454
# see https://github.com/actions/checkout
5555
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
56+
with:
57+
persist-credentials: false
5658
- name: Setup Python Environment
5759
# see https://github.com/actions/setup-python
5860
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -76,6 +78,8 @@ jobs:
7678
- name: Checkout
7779
# see https://github.com/actions/checkout
7880
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
81+
with:
82+
persist-credentials: false
7983
- name: Setup Python Environment
8084
# see https://github.com/actions/setup-python
8185
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -99,6 +103,8 @@ jobs:
99103
- name: Checkout
100104
# see https://github.com/actions/checkout
101105
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
106+
with:
107+
persist-credentials: false
102108
- name: Setup Python Environment
103109
# see https://github.com/actions/setup-python
104110
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -132,6 +138,8 @@ jobs:
132138
- name: Checkout
133139
# see https://github.com/actions/checkout
134140
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
141+
with:
142+
persist-credentials: false
135143
- name: Setup Python Environment
136144
# see https://github.com/actions/setup-python
137145
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -155,6 +163,8 @@ jobs:
155163
- name: Checkout
156164
# see https://github.com/actions/checkout
157165
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
166+
with:
167+
persist-credentials: false
158168
- name: Setup Python Environment
159169
# see https://github.com/actions/setup-python
160170
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -188,6 +198,8 @@ jobs:
188198
- name: Checkout
189199
# see https://github.com/actions/checkout
190200
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
201+
with:
202+
persist-credentials: false
191203
- name: Setup Python Environment
192204
# see https://github.com/actions/setup-python
193205
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -225,6 +237,8 @@ jobs:
225237
- name: Checkout
226238
# see https://github.com/actions/checkout
227239
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
240+
with:
241+
persist-credentials: false
228242
- name: Create reports directory
229243
run: mkdir ${{ env.REPORTS_DIR }}
230244
- name: Setup Python Environment

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ jobs:
7272
- name: Checkout code
7373
# see https://github.com/actions/checkout
7474
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
75+
with:
76+
persist-credentials: false
7577
- name: Setup Python Environment
7678
# see https://github.com/actions/setup-python
7779
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -95,6 +97,8 @@ jobs:
9597
- name: Checkout
9698
# see https://github.com/actions/checkout
9799
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
100+
with:
101+
persist-credentials: false
98102
- name: Setup Python Environment
99103
# see https://github.com/actions/setup-python
100104
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
@@ -134,6 +138,7 @@ jobs:
134138
# see https://github.com/actions/checkout
135139
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
136140
with:
141+
persist-credentials: false
137142
fetch-depth: 0
138143
- name: Setup python
139144
# see https://github.com/actions/setup-python
@@ -222,6 +227,7 @@ jobs:
222227
# see https://github.com/actions/checkout
223228
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
224229
with:
230+
persist-credentials: false
225231
ref: ${{ needs.release-PyPI.outputs.tag }}
226232
- name: setup dirs
227233
run: |

.github/workflows/zizmor.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This file is part of CycloneDX Python
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
# Copyright (c) OWASP Foundation. All Rights Reserved.
17+
18+
# For details of what checks are run for PRs please refer below
19+
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
20+
21+
name: Workflow Security Analysis
22+
23+
on:
24+
pull_request:
25+
paths:
26+
- '.github/workflows/**'
27+
- '.github/dependabot.yml'
28+
push:
29+
paths:
30+
- ".github/workflows/**"
31+
- ".github/dependabot.yml"
32+
schedule:
33+
# weekly scan: every Saturday at 00:00 UTC
34+
- cron: '0 0 * * 6'
35+
36+
concurrency:
37+
group: '${{ github.workflow }}-${{ github.ref }}'
38+
cancel-in-progress: true
39+
40+
permissions: {}
41+
42+
jobs:
43+
zizmor:
44+
name: Harden GitHub Workflows (zizmor)
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 10
47+
permissions:
48+
contents: read
49+
steps:
50+
- name: Checkout
51+
# see https://github.com/actions/checkout
52+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
53+
with:
54+
persist-credentials: false
55+
- name: Run zizmor 🌈
56+
# see https://github.com/zizmorcore/zizmor-action
57+
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3
58+
with:
59+
# advanced-security: false => emit findings as workflow-command annotations (::error file=…) rather than
60+
# uploading a SARIF report to GitHub's Security tab.
61+
# Uploading SARIF requires `security-events: write` and GitHub Advanced Security (GHAS),
62+
# both of which are unnecessary here and would violate the least-privilege policy.
63+
# The two modes are mutually exclusive: advanced-security must be false for
64+
# annotations to take effect.
65+
advanced-security: false
66+
annotations: true

0 commit comments

Comments
 (0)