Skip to content

chore(deps)(deps): bump the github-actions group with 12 updates #301

chore(deps)(deps): bump the github-actions group with 12 updates

chore(deps)(deps): bump the github-actions group with 12 updates #301

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'
concurrency:
group: security-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: gearbox/go.mod
cache-dependency-path: |
gearbox/go.sum
gearbox-agent/go.sum
- name: Run gosec for gearbox
uses: securego/gosec@9e6a9843d7a4a6e3e9a8539b02612c8a4aa3f889 # v2.27.1
with:
args: '-no-fail -fmt sarif -out gosec-gearbox.sarif ./gearbox/...'
- name: Run gosec for gearbox-agent
uses: securego/gosec@9e6a9843d7a4a6e3e9a8539b02612c8a4aa3f889 # v2.27.1
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@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # 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@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # 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@9af89fc71515a100421586dfdb3dc9c984fbf411 # 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@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
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@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # 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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Dependency Review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # 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@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
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."