|
1 | | -name: Security |
| 1 | +name: security |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request: |
5 | | - branches: [main] |
6 | 4 | push: |
7 | 5 | branches: [main] |
| 6 | + pull_request: |
8 | 7 | schedule: |
9 | | - - cron: "0 6 * * 1" # Monday 6am UTC |
| 8 | + - cron: "0 6 * * 1" |
10 | 9 | workflow_dispatch: |
11 | 10 |
|
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
12 | 14 | concurrency: |
13 | 15 | group: security-${{ github.ref }} |
14 | 16 | cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
15 | 17 |
|
16 | | -permissions: |
17 | | - contents: read |
18 | | - |
19 | 18 | jobs: |
| 19 | + gitleaks: |
| 20 | + name: Secret detection |
| 21 | + runs-on: ubuntu-latest |
| 22 | + timeout-minutes: 5 |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v6 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - name: Gitleaks |
| 30 | + uses: gitleaks/gitleaks-action@v2 |
| 31 | + env: |
| 32 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + |
20 | 34 | trivy: |
21 | | - name: Trivy |
22 | | - runs-on: |
23 | | - - self-hosted |
24 | | - - macOS |
25 | | - - ARM64 |
26 | | - - patchloom-vscode |
| 35 | + name: Vulnerability scan |
| 36 | + runs-on: ubuntu-latest |
27 | 37 | timeout-minutes: 10 |
28 | 38 | steps: |
29 | | - - name: Harden Runner |
30 | | - uses: step-security/harden-runner@v2 |
| 39 | + - name: Checkout |
| 40 | + uses: actions/checkout@v6 |
| 41 | + |
| 42 | + - name: Setup Node.js |
| 43 | + uses: actions/setup-node@v6 |
31 | 44 | with: |
32 | | - egress-policy: audit |
33 | | - - uses: actions/checkout@v6 |
34 | | - - name: Install Trivy |
35 | | - run: | |
36 | | - if ! command -v trivy &>/dev/null; then |
37 | | - brew install trivy |
38 | | - fi |
| 45 | + node-version-file: .nvmrc |
| 46 | + cache: npm |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + run: npm ci |
| 50 | + |
39 | 51 | - name: Trivy filesystem scan |
40 | | - run: trivy fs --scanners vuln --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed . |
| 52 | + uses: aquasecurity/trivy-action@master |
| 53 | + with: |
| 54 | + scan-type: fs |
| 55 | + severity: HIGH,CRITICAL |
| 56 | + exit-code: 1 |
41 | 57 |
|
42 | | - gitleaks: |
43 | | - name: Gitleaks |
44 | | - runs-on: |
45 | | - - self-hosted |
46 | | - - macOS |
47 | | - - ARM64 |
48 | | - - patchloom-vscode |
| 58 | + npm-audit: |
| 59 | + name: npm audit |
| 60 | + runs-on: ubuntu-latest |
49 | 61 | timeout-minutes: 5 |
50 | 62 | steps: |
51 | | - - name: Harden Runner |
52 | | - uses: step-security/harden-runner@v2 |
53 | | - with: |
54 | | - egress-policy: audit |
55 | | - - uses: actions/checkout@v6 |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v6 |
| 65 | + |
| 66 | + - name: Setup Node.js |
| 67 | + uses: actions/setup-node@v6 |
56 | 68 | with: |
57 | | - fetch-depth: 0 |
58 | | - - name: Install gitleaks |
59 | | - env: |
60 | | - GITLEAKS_VERSION: "8.30.1" |
61 | | - run: | |
62 | | - if command -v gitleaks &>/dev/null; then |
63 | | - echo "gitleaks already installed" |
64 | | - exit 0 |
65 | | - fi |
66 | | - archive="${RUNNER_TEMP}/gitleaks.tar.gz" |
67 | | - bindir="${RUNNER_TEMP}/gitleaks-bin" |
68 | | - mkdir -p "$bindir" |
69 | | - case "$(uname -s)-$(uname -m)" in |
70 | | - Linux-x86_64) platform="linux_x64" ;; |
71 | | - Linux-aarch64) platform="linux_arm64" ;; |
72 | | - Darwin-x86_64) platform="darwin_x64" ;; |
73 | | - Darwin-arm64) platform="darwin_arm64" ;; |
74 | | - *) echo "Unsupported platform: $(uname -s)-$(uname -m)" >&2; exit 1 ;; |
75 | | - esac |
76 | | - curl --retry 5 --retry-all-errors --retry-delay 2 -sSfL \ |
77 | | - -o "$archive" \ |
78 | | - "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_${platform}.tar.gz" |
79 | | - tar -xzf "$archive" -C "$bindir" gitleaks |
80 | | - printf '%s\n' "$bindir" >> "$GITHUB_PATH" |
81 | | - - run: gitleaks detect --source . --exit-code 1 |
| 69 | + node-version-file: .nvmrc |
| 70 | + cache: npm |
| 71 | + |
| 72 | + - name: Install dependencies |
| 73 | + run: npm ci |
| 74 | + |
| 75 | + - name: Audit production dependencies |
| 76 | + run: npm audit --audit-level=high --omit=dev |
0 commit comments