mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-19 17:05:11 +00:00
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:
1 parent
3fcccd5573
commit
58d4f80bc3
3 files changed
+125
-2
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user