Skip to content

Commit 1a17bdf

Browse files
committed
fix(ci): Sanitize workflow inputs with an env var
Use an intermediate env var, sanitized by GitHub, to prevent exploitation from untrusted user-provided input. Reported-By: Alessandro Braccio <[email protected]> Signed-off-by: Loïc Minier <[email protected]>
1 parent f1d93be commit 1a17bdf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/build-overlay-deb.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
required: true
99
type: string
1010

11+
env:
12+
- CONFIG: ${{ inputs.config }}
13+
1114
jobs:
1215
build:
1316
strategy:
@@ -51,7 +54,7 @@ jobs:
5154
DEBIAN_FRONTEND=noninteractive \
5255
apt -y install --no-install-recommends python3 python3-yaml
5356
# read suite from yaml
54-
suite="$(python3 -c "import yaml; print(yaml.safe_load(open('${{ inputs.config }}'))['suite'])")"
57+
suite="$(python3 -c "import os, yaml; print(yaml.safe_load(open(os.environ['CONFIG']))['suite'])")"
5558
# defaults args
5659
extra_repo=""
5760
debootstrap_suite="${suite}"
@@ -87,7 +90,7 @@ jobs:
8790
mkdir -v upload
8891
chmod a+rw upload
8992
sudo -u builder python3 scripts/build-deb.py \
90-
--config "${{ inputs.config }}" --output-dir upload
93+
--config "$CONFIG" --output-dir upload
9194
9295
- name: Upload as private artifacts
9396
uses: qualcomm-linux/upload-private-artifact-action@v1

0 commit comments

Comments
 (0)