- Remove CodeQL job: this repo has no JS/TS or Rust source code,
so CodeQL exits with error 32 ('no source code seen during build')
on every run. CodeQL belongs on nixpanel-website/nixpanel-licensing.
- cargo-audit: skip Rust toolchain install entirely when no Cargo.toml
present (saves ~3 min of wasted CI time); use step output condition
- ShellCheck: severity error->only fails on real errors, not style
warnings; pin to ludeeus/[email protected] (not @master)
- Rename workflow to 'Security Audit' (CodeQL is no longer included)
73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
name: "Security Audit"
|
|
|
|
on:
|
|
push:
|
|
branches: ["master", "main"]
|
|
pull_request:
|
|
branches: ["master", "main"]
|
|
schedule:
|
|
# Run every Monday at 08:00 UTC to catch newly disclosed CVEs
|
|
- cron: "0 8 * * 1"
|
|
|
|
jobs:
|
|
# ── Rust dependency audit (cargo-audit) ──────────────────────────────────────
|
|
# Skipped automatically when no Cargo.toml is present at repo root.
|
|
rust-audit:
|
|
name: Rust Security Audit
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check for Cargo.toml
|
|
id: has_cargo
|
|
run: |
|
|
if [ -f Cargo.toml ]; then
|
|
echo "present=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "present=false" >> "$GITHUB_OUTPUT"
|
|
echo "No Cargo.toml found — skipping Rust audit"
|
|
fi
|
|
|
|
- name: Install Rust stable
|
|
if: steps.has_cargo.outputs.present == 'true'
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo registry
|
|
if: steps.has_cargo.outputs.present == 'true'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
key: ${{ runner.os }}-cargo-audit-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install and run cargo-audit
|
|
if: steps.has_cargo.outputs.present == 'true'
|
|
run: |
|
|
cargo install cargo-audit --locked
|
|
cargo audit --deny warnings
|
|
|
|
# ── Shell script security lint (ShellCheck) ───────────────────────────────────
|
|
# Fails only on errors (SC severity ≥ error). Warnings are reported but
|
|
# do not block the build — keeping CI signal meaningful.
|
|
shellcheck:
|
|
name: ShellCheck
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run ShellCheck
|
|
uses: ludeeus/[email protected]
|
|
with:
|
|
severity: error
|
|
scandir: "."
|
|
ignore_paths: ".git"
|