-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (81 loc) · 2.63 KB
/
security.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: CI Security Pipeline
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
security-checks:
name: Security Checks
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
fail-fast: false
permissions:
contents: read
security-events: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run Tests
run: npm run test
- name: OWASP Dependency Check
id: dependency-check
continue-on-error: true
uses: dependency-check/Dependency-Check_Action@main
with:
project: 'HyVueGantt'
path: '.'
format: 'HTML'
args: >
--failOnCVSS 7
--enableRetired
- name: Run Syft
uses: anchore/[email protected]
with:
format: spdx-json
output-file: sbom-${{ github.event.repository.name }}-${{ matrix.node-version }}.spdx.json
- name: Run Grype
uses: anchore/[email protected]
continue-on-error: true
with:
sbom: sbom-${{ github.event.repository.name }}-${{ matrix.node-version }}.spdx.json
fail-build: true
severity-cutoff: "high"
output-format: json
output-file: reports/grype-results.json
- name: Archive Security Results
uses: actions/[email protected]
if: always()
with:
name: security-scan-results-node-${{ matrix.node-version }}
path: |
dependency-check-report.html
sbom-${{ github.event.repository.name }}-${{ matrix.node-version }}.spdx.json
${{github.workspace}}/reports
retention-days: 2
#- name: Notify on Failure
# if: failure()
# uses: actions/github-script@v7
# with:
# script: |
# const nodeVersion = '${{ matrix.node }}';
# github.rest.issues.create({
# owner: context.repo.owner,
# repo: context.repo.repo,
# title: `Security Scan Failed - Node ${nodeVersion}`,
# body: `Security scan failed for Node.js ${nodeVersion} in workflow run: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
# labels: ['security', 'ci-failure']
# })