Skip to content

Security

Security #23

Workflow file for this run

# ReasonKit Web - Security Scanning
# Dependency audits, license checks, secret scanning
name: Security
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# Override .cargo/config.toml target-cpu=native to prevent SIGILL on different runners
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: ""
jobs:
cargo-audit:
name: "Cargo Audit"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable
with:
toolchain: stable
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run security audit
run: cargo audit --deny warnings
cargo-deny:
name: "Cargo Deny"
runs-on: ubuntu-latest
strategy:
matrix:
checks: [advisories, licenses, bans, sources]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Run cargo-deny (${{ matrix.checks }})
uses: EmbarkStudios/cargo-deny-action@ef301417264190a1eb9f26fcf171642070085c5b # v1
with:
log-level: warn
command: check ${{ matrix.checks }}
gitleaks:
name: "Secret Scanning"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@dcedce43c6f43de0b836d1fe38946645c9c638dc # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dependency-review:
name: "Dependency Review"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Dependency Review
uses: actions/dependency-review-action@46a3c492319c890177366b6ef46d6b4f89743ed4 # v4
with:
fail-on-severity: moderate
deny-licenses: GPL-3.0, AGPL-3.0
security-summary:
name: "Security Summary"
runs-on: ubuntu-latest
needs: [cargo-audit, cargo-deny, gitleaks]
if: always()
steps:
- name: Generate summary
run: |
echo "## 🔒 Security Scan Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Check | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Cargo Audit | ${{ needs.cargo-audit.result == 'success' && '✅ Pass' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Cargo Deny | ${{ needs.cargo-deny.result == 'success' && '✅ Pass' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Secret Scanning | ${{ needs.gitleaks.result == 'success' && '✅ Pass' || '❌ Fail' }} |" >> $GITHUB_STEP_SUMMARY