forked from rinafcode/teachLink_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (93 loc) · 2.8 KB
/
Copy pathsecurity.yml
File metadata and controls
118 lines (93 loc) · 2.8 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Security Scanning
on:
push:
branches: [main, develop]
pull_request:
workflow_dispatch:
jobs:
sast:
name: SAST (CodeQL)
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: typescript
- name: Autobuild
uses: github/codeql-action/autobuild@v4
- name: Analyze
uses: github/codeql-action/analyze@v4
dependency-scan:
name: Dependency Scan
runs-on: ubuntu-latest
if: hashFiles('package.json', 'pnpm-lock.yaml') != ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 11
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Audit dependencies (fail only on critical)
run: pnpm audit --audit-level=critical
secrets-scan:
name: Secrets Scan (Gitleaks)
runs-on: ubuntu-latest
steps:
- name: Checkout full history
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
container-scan:
name: Container Scan (Trivy)
runs-on: ubuntu-latest
if: hashFiles('Dockerfile') != ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t app:${{ github.sha }} .
- name: Run Trivy scan
uses: aquasecurity/trivy-action@v0.20.0
continue-on-error: true # ensures output is handled safely
with:
image-ref: app:${{ github.sha }}
severity: CRITICAL,HIGH
dast-scan:
name: DAST Scan (SQLMap)
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install SQLMap
run: pip install sqlmap
- name: Start Application Container
run: |
docker compose -f docker-compose.staging.yml up -d
# Wait for application to be healthy
sleep 15
- name: Run SQLMap Scan
run: |
# Scanning course search endpoint dynamically with SQLMap (non-blocking)
sqlmap -u "http://localhost:3000/search?q=test" --batch --crawl=2 --level=1 --risk=1
continue-on-error: true