Skip to content

chore(deps)(deps): bump the github-actions group across 1 directory with 6 updates #20

chore(deps)(deps): bump the github-actions group across 1 directory with 6 updates

chore(deps)(deps): bump the github-actions group across 1 directory with 6 updates #20

Workflow file for this run

name: Security Scanning
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Run security scans weekly on Monday at 9 AM UTC
- cron: '0 9 * * 1'
permissions: {}
jobs:
gosec:
name: Go Security Scan (gosec)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Harden runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
with:
go-version-file: gearbox/go.mod
- name: Run gosec for gearbox
uses: securego/gosec@424fc4cd9c82ea0fd6bee9cd49c2db2c3cc0c93f # v2.22.11
with:
args: '-no-fail -fmt sarif -out gosec-gearbox.sarif ./gearbox/...'
- name: Run gosec for gearbox-agent
uses: securego/gosec@424fc4cd9c82ea0fd6bee9cd49c2db2c3cc0c93f # v2.22.11
with:
args: '-no-fail -fmt sarif -out gosec-agent.sarif ./gearbox-agent/...'
- name: Upload gosec results to GitHub Security
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4
if: always()
with:
sarif_file: gosec-gearbox.sarif
category: gosec-gearbox
- name: Upload gosec agent results to GitHub Security
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4
if: always()
with:
sarif_file: gosec-agent.sarif
category: gosec-agent
trivy-repo:
name: Trivy Repository Scan
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Harden runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH,MEDIUM'
- name: Upload Trivy results to GitHub Security
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4
if: always()
with:
sarif_file: 'trivy-results.sarif'
category: trivy-repo
npm-audit:
name: NPM Security Audit
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: ./gearbox
steps:
- name: Harden runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: '20'
- name: Run npm audit
run: |
# Run audit and capture exit code
npm audit --json > npm-audit.json || true
# Check for high/critical vulnerabilities
CRITICAL=$(cat npm-audit.json | jq '.metadata.vulnerabilities.critical // 0')
HIGH=$(cat npm-audit.json | jq '.metadata.vulnerabilities.high // 0')
echo "Critical vulnerabilities: $CRITICAL"
echo "High vulnerabilities: $HIGH"
# Fail if critical or high vulnerabilities found
if [ "$CRITICAL" -gt 0 ] || [ "$HIGH" -gt 0 ]; then
echo "::error::Found $CRITICAL critical and $HIGH high severity vulnerabilities"
npm audit
exit 1
fi
- name: Upload npm audit results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: always()
with:
name: npm-audit-results
path: gearbox/npm-audit.json
retention-days: 30
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event_name == 'pull_request'
steps:
- name: Harden runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Dependency Review
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4
with:
fail-on-severity: moderate
deny-licenses: GPL-3.0, AGPL-3.0
gitleaks:
name: Secret Scanning (gitleaks)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden runner
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
security-summary:
name: Security Scan Summary
runs-on: ubuntu-latest
permissions:
contents: read
needs: [gosec, trivy-repo, npm-audit, gitleaks]
if: always()
steps:
- name: Security scan results
run: |
echo "Security scanning completed!"
echo "Check the Security tab for detailed results."