Repository navigation
57 lines (50 loc) · 1.98 KB
/
Copy pathcodeql.yml
File metadata and controls
57 lines (50 loc) · 1.98 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
name: CodeQL
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
schedule:
# A weekly run catches a query that is added after a change merged.
- cron: "23 4 * * 1"
workflow_dispatch:
permissions: {}
jobs:
analyze:
name: Analyze Python
runs-on: ubuntu-latest
permissions:
# Uploading the analysis result as code scanning alerts
security-events: write
contents: read
# Reading the workflow run metadata the analysis reports alongside the result
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The analysis never pushes, so the checkout token is not left behind in the runner
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
languages: python
# Python needs no compilation, so nothing is built before the database is created
build-mode: none
# The extended suite adds security queries that the default suite leaves out
queries: security-extended
# Mark results covered by source suppression comments for the upload filter
packs: codeql/python-queries:AlertSuppression.ql
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
category: "/language:python"
output: sarif-results
upload: failure-only
- name: Apply source suppressions
run: python .github/scripts/filter_codeql_sarif.py sarif-results/python.sarif sarif-results/python-filtered.sarif
- name: Upload CodeQL results
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with:
sarif_file: sarif-results/python-filtered.sarif
category: "/language:python"