-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.4 KB
/
security-scan.yml
File metadata and controls
53 lines (43 loc) · 1.4 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
name: "Security Audit and SAST"
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
schedule:
- cron: '0 2 * * 1' # Executes every Monday at 02:00 UTC
permissions:
contents: read
security-events: write
jobs:
python-security-scan:
name: Source Code and Dependency Analysis
runs-on: ubuntu-latest
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Python Environment Initialization
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Security Tooling Installation
run: |
python -m pip install --upgrade pip
pip install bandit safety
- name: Application Dependency Installation
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Bandit Static Application Security Testing (SAST)
run: |
bandit -r . -ll -ii -x ./tests,./venv
- name: Safety Dependency Vulnerability Check
run: |
if [ -f requirements.txt ]; then safety check -r requirements.txt --full-report; fi
- name: Secret Scanning Initialization
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified