security(nix): prevent shell injection through extra-args (#52)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
coderabbitai[bot] authored and GitHub committed 2026-10-22 14:37:49 -04:00
1 parent 3fcccd5573
commit 58d4f80bc3
3 files changed
+125 -2

No files matched your search

+9 -2
View File
@@ -4,7 +4,7 @@ on:
workflow_call:
inputs:
extra-args:
description: "Extra arguments to pass to nix flake check"
description: "Extra arguments to pass to nix flake check (shell-style quoting, no shell expansion)"
type: string
required: false
default: "--no-build --all-systems"
@@ -22,9 +22,16 @@ jobs:
- uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23
- name: Check flake evaluation
shell: bash
env:
NIX_EXTRA_ARGS: ${{ inputs.extra-args }}
run: |
if [ -f flake.nix ]; then
nix flake check ${{ inputs.extra-args }}
python3 - <<'PY'
import os
import shlex
os.execvp("nix", ["nix", "flake", "check", *shlex.split(os.environ["NIX_EXTRA_ARGS"])])
PY
else
echo "No flake.nix present in this repository; skipping check."
fi