-
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 2.95 KB
/
codeql.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: "Code Analysis"
on:
push:
branches: [ "master" ]
paths:
- '.github/workflows/codeql.yml'
- 'api/*.py'
pull_request:
branches: [ "master" ]
jobs:
codeql-analysis:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: python
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-extended
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
- name: Upload CodeQL Results
if: always()
uses: actions/upload-artifact@v4
with:
name: codeql-results
path: codeql-report.sarif
pylint:
name: Pylint
runs-on: ubuntu-latest
needs: codeql-analysis
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Pylint Scan & Badge
uses: Silleellie/pylint-github-action@v2
with:
lint-path: api
python-version: 3.x
requirements-path: requirements.txt
readme-path: README.md
badge-text: PyLint
color-bad-score: red
color-ok-score: orange
color-good-score: yellow
color-perfect-score: brightgreen
sast_scan: # Static Application Security Testing
name: Run Bandit Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Bandit
run: pip install bandit
- name: Run Bandit Scan
# Ignore Low Severity Issues
run: bandit -ll -ii -r . -f json -o bandit-report.json
- name: Upload Bandit Scan Results
if: always()
uses: actions/upload-artifact@v4
with:
name: bandit-scan-results
path: bandit-report.json