Files
craft-common-actions/.github/workflows/nix.yml
T
Dylan M. Taylor 644a5d76b9 ci: harden workflows with credential isolation, template injection defenses, and dependabot cooldown (#191)
* ci: harden workflows with credential isolation, template injection defenses, and dependabot cooldown

- Add persist-credentials: false across all actions/checkout invocations
- Eliminate template injection by mapping matrix and input variables to env: in freebsd.yml, release.yml, and sonarcloud.yml
- Add 7-day cooldown to dependabot.yml to protect against supply-chain compromise of recently published releases
- Update test suite to validate hardened environment mappings

* ci: allow static.crates.io and registry endpoints in gate and windows-arm64 runners
2026-11-10 18:07:38 -05:00

44 lines
1.2 KiB
YAML

name: "Nix"
on:
workflow_call:
inputs:
extra-args:
description: "Extra arguments to pass to nix flake check (shell-style quoting, no shell expansion)"
type: string
required: false
default: "--no-build --all-systems"
permissions:
contents: read
jobs:
eval:
name: eval
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- 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
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