ci: fix security workflow — drop CodeQL, fix ShellCheck severity
- 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)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: "CodeQL & Security Audit"
|
name: "Security Audit"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -10,55 +10,34 @@ on:
|
|||||||
- cron: "0 8 * * 1"
|
- cron: "0 8 * * 1"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── CodeQL analysis ──────────────────────────────────────────────────────────
|
# ── Rust dependency audit (cargo-audit) ──────────────────────────────────────
|
||||||
codeql:
|
# Skipped automatically when no Cargo.toml is present at repo root.
|
||||||
name: CodeQL
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: ["javascript-typescript"]
|
|
||||||
# Rust is not yet supported by CodeQL; covered by cargo-audit below.
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v3
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
queries: security-extended,security-and-quality
|
|
||||||
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v3
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v3
|
|
||||||
with:
|
|
||||||
category: "/language:${{ matrix.language }}"
|
|
||||||
|
|
||||||
# ── Rust security audit (cargo-audit) ────────────────────────────────────────
|
|
||||||
rust-audit:
|
rust-audit:
|
||||||
name: Rust Security Audit
|
name: Rust Security Audit
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Install Rust stable
|
||||||
|
if: steps.has_cargo.outputs.present == 'true'
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Cache cargo registry
|
- name: Cache cargo registry
|
||||||
|
if: steps.has_cargo.outputs.present == 'true'
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -66,33 +45,28 @@ jobs:
|
|||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
key: ${{ runner.os }}-cargo-audit-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-audit-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Install cargo-audit
|
- name: Install and run cargo-audit
|
||||||
run: cargo install cargo-audit --locked
|
if: steps.has_cargo.outputs.present == 'true'
|
||||||
|
|
||||||
- name: Run cargo audit
|
|
||||||
# --deny warnings treats advisories as errors so the job fails on CVEs
|
|
||||||
run: |
|
run: |
|
||||||
if [ -f Cargo.toml ]; then
|
cargo install cargo-audit --locked
|
||||||
cargo audit --deny warnings
|
cargo audit --deny warnings
|
||||||
else
|
|
||||||
echo "No Cargo.toml at repo root — skipping rust audit"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── Shell script lint (ShellCheck) ───────────────────────────────────────────
|
# ── 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:
|
shellcheck:
|
||||||
name: ShellCheck
|
name: ShellCheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run ShellCheck
|
- name: Run ShellCheck
|
||||||
uses: ludeeus/action-shellcheck@master
|
uses: ludeeus/action-shellcheck@2.0.0
|
||||||
with:
|
with:
|
||||||
severity: warning
|
severity: error
|
||||||
scandir: "."
|
scandir: "."
|
||||||
ignore_paths: ".git"
|
ignore_paths: ".git"
|
||||||
|
|||||||
Reference in New Issue
Block a user