name: Security on: push: branches: [main] pull_request: branches: [main] schedule: - cron: '0 6 * * 1' permissions: contents: read jobs: dependency-audit: name: Dependency Audit runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: '20' cache: 'npm' - run: npm ci - name: Run npm audit run: npm audit --audit-level=moderate || true - name: Check for critical vulnerabilities run: | CRITICAL=$(npm audit --json 2>/dev/null | jq '[.vulnerabilities | to_entries[] | select(.value.severity == "critical")] | length' 2>/dev/null || echo "0") if [ "$CRITICAL" -gt 0 ]; then echo "::error::Found $CRITICAL critical vulnerabilities" exit 1 fi dependency-review: name: Dependency Review runs-on: ubuntu-latest if: github.event_name == 'pull_request' steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Dependency Review uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 with: fail-on-severity: high deny-licenses: GPL-3.0, AGPL-3.0 # TruffleHog (AGPL-3.0) is the secret scanner this workflow runs; it # executes in CI and is never shipped, served or distributed. allow-dependencies-licenses: pkg:githubactions/trufflesecurity/trufflehog secret-scan: name: Secret Scan runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: TruffleHog Secret Scan uses: trufflesecurity/trufflehog@31ce31ee1abbcc7dc8eee5764c17121c3044c8b2 # v3.99.7 with: path: ./ base: ${{ github.event.repository.default_branch }} extra_args: --only-verified