Skip to content

Commit b481757

Browse files
authored
Add security audit and SAST workflow
1 parent 3601ff9 commit b481757

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Security Audit and SAST"
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
schedule:
9+
- cron: '0 2 * * 1' # Executes every Monday at 02:00 UTC
10+
11+
permissions:
12+
contents: read
13+
security-events: write
14+
15+
jobs:
16+
python-security-scan:
17+
name: Source Code and Dependency Analysis
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Repository Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Python Environment Initialization
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
cache: 'pip'
29+
30+
- name: Security Tooling Installation
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install bandit safety
34+
35+
- name: Application Dependency Installation
36+
run: |
37+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
38+
39+
- name: Bandit Static Application Security Testing (SAST)
40+
run: |
41+
bandit -r . -ll -ii -x ./tests,./venv
42+
43+
- name: Safety Dependency Vulnerability Check
44+
run: |
45+
if [ -f requirements.txt ]; then safety check -r requirements.txt --full-report; fi
46+
47+
- name: Secret Scanning Initialization
48+
uses: trufflesecurity/trufflehog@main
49+
with:
50+
path: ./
51+
base: ${{ github.event.repository.default_branch }}
52+
head: HEAD
53+
extra_args: --debug --only-verified

0 commit comments

Comments
 (0)