Skip to content

Commit 2915e48

Browse files
committed
ci: add read-only workflow token permissions and fix template injection
All four workflows lacked a top-level permissions block, so they inherited the repository default, which can be write-all on permissive settings. - build.yaml, coverity-scan.yml, doxygen.yml: add `permissions: read-all` at the workflow level. The doxygen deploy job retains its existing job-level `pages: write` and `id-token: write` overrides, which take precedence for that job only. - test-ssllib.yml: add `permissions: read-all` and replace seven direct `${{inputs.*}}` template expansions inside `run:` blocks with env-var references (LIB_CONFIGURE, LIB_MAKE, LIB_INSTALL, OVPN_LIBNAME, OVPN_CONFIGURE_FLAGS, OVPN_LIBDESC, OVPN_CONFIGURE_ENV) to eliminate the zizmor template-injection findings. The configure prefix that sets crypto-library env vars is now passed through `env -S` instead of direct interpolation, preserving behaviour while avoiding shell-injection risk. Verified with zizmor --min-severity medium: 0 high-severity findings after this patch (down from 9). Signed-off-by: Alb3e3 <tomaska.filip@gmail.com>
1 parent c9b5f9e commit 2915e48

4 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
pull_request:
66

7+
permissions: read-all
8+
79
jobs:
810
clang-format:
911
name: Check code style with clang-format

.github/workflows/coverity-scan.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
- cron: '0 20 * * *' # Daily at 20:00 UTC
55
workflow_dispatch:
66

7+
permissions: read-all
8+
79
jobs:
810
latest:
911
# Running coverity requires the secrets.COVERITY_SCAN_TOKEN token

.github/workflows/doxygen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches: ["master"]
55
workflow_dispatch:
6+
permissions: read-all
7+
68
concurrency:
79
group: "pages"
810
cancel-in-progress: false

.github/workflows/test-ssllib.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: test_ssllib
22

3+
permissions: read-all
4+
35
on:
46
workflow_call:
57
inputs:
@@ -65,6 +67,13 @@ jobs:
6567
CXX: ${{matrix.cxx}}
6668
UBSAN_OPTIONS: print_stacktrace=1
6769
LIBPREFIX: /opt/${{inputs.libname}}
70+
LIB_CONFIGURE: ${{inputs.libconfigure}}
71+
LIB_MAKE: ${{inputs.libmake}}
72+
LIB_INSTALL: ${{inputs.libinstall}}
73+
OVPN_LIBNAME: ${{inputs.ovpnlibname}}
74+
OVPN_CONFIGURE_FLAGS: ${{inputs.ovpnconfigureflags}}
75+
OVPN_LIBDESC: ${{inputs.ovpnlibdesc}}
76+
OVPN_CONFIGURE_ENV: ${{inputs.ovpnconfigureenv}}
6877

6978
steps:
7079
- name: Install dependencies
@@ -85,15 +94,15 @@ jobs:
8594
ref: ${{inputs.gitref}}
8695
- name: "${{inputs.libname}}: configure"
8796
if: steps.ssllib-cache.outputs.cache-hit != 'true'
88-
run: ${{inputs.libconfigure}}
97+
run: $LIB_CONFIGURE
8998
working-directory: ${{inputs.libname}}
9099
- name: "${{inputs.libname}}: build"
91100
if: steps.ssllib-cache.outputs.cache-hit != 'true'
92-
run: ${{inputs.libmake}}
101+
run: $LIB_MAKE
93102
working-directory: ${{inputs.libname}}
94103
- name: "${{inputs.libname}}: install"
95104
if: steps.ssllib-cache.outputs.cache-hit != 'true'
96-
run: ${{inputs.libinstall}}
105+
run: $LIB_INSTALL
97106
working-directory: ${{inputs.libname}}
98107
- name: Run ldconfig
99108
run: sudo ldconfig
@@ -103,14 +112,14 @@ jobs:
103112
run: autoreconf -fvi
104113
- name: "OpenVPN: configure"
105114
run: |
106-
${{inputs.ovpnconfigureenv}} \
107-
./configure --with-crypto-library=${{inputs.ovpnlibname}} ${{inputs.ovpnconfigureflags}}
115+
env -S "$OVPN_CONFIGURE_ENV" \
116+
./configure --with-crypto-library=$OVPN_LIBNAME $OVPN_CONFIGURE_FLAGS
108117
- name: "OpenVPN: build"
109118
run: make -j3
110119
- name: Ensure the build uses ${{inputs.libname}}
111120
run: |
112121
./src/openvpn/openvpn --version
113-
./src/openvpn/openvpn --version | grep -q "library versions: ${{inputs.ovpnlibdesc}}"
122+
./src/openvpn/openvpn --version | grep -q "library versions: $OVPN_LIBDESC"
114123
- name: "OpenVPN: configure checks"
115124
run: echo 'RUN_SUDO="sudo -E"' >tests/t_server_null.rc
116125
- name: "OpenVPN: make check"

0 commit comments

Comments
 (0)