Skip to content

Commit 1aa0deb

Browse files
Add Bandit workflow to check for potential security issues (#4)
1 parent 403b5d6 commit 1aa0deb

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/bandit.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# Bandit is a security linter designed to find common security issues in Python code.
7+
# This action will run Bandit on your codebase.
8+
# The results of the scan will be found under the Security tab of your repository.
9+
10+
# https://github.com/marketplace/actions/bandit-scan is ISC licensed, by abirismyname
11+
# https://pypi.org/project/bandit/ is Apache v2.0 licensed, by PyCQA
12+
13+
name: Bandit
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '38 6 * * 2' # At 06:38 UTC on Tuesdays
22+
permissions: {}
23+
jobs:
24+
bandit:
25+
permissions:
26+
actions: read
27+
contents: read # for actions/checkout to fetch code
28+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
29+
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
34+
- name: Bandit Scan
35+
uses: shundor/python-bandit-scan@ab1d87dfccc5a0ffab88be3aaac6ffe35c10d6cd
36+
with: # optional arguments
37+
# exit with 0, even with results found
38+
exit_zero: true # optional, default is DEFAULT
39+
40+
# Github token of the repository (automatically created by Github)
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information.
42+
43+
# File or directory to run bandit on
44+
# path: # optional, default is .
45+
# Report only issues of a given severity level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
46+
# level: # optional, default is UNDEFINED
47+
# Report only issues of a given confidence level or higher. Can be LOW, MEDIUM or HIGH. Default is UNDEFINED (everything)
48+
# confidence: # optional, default is UNDEFINED
49+
# comma-separated list of paths (glob patterns supported) to exclude from scan (note that these are in addition to the excluded paths provided in the config file) (default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)
50+
excluded_paths: tests,.venv
51+
52+
# comma-separated list of test IDs to skip
53+
# skips: # optional, default is DEFAULT
54+
# path to a .bandit file that supplies command line arguments
55+
# ini_path: # optional, default is DEFAULT

0 commit comments

Comments
 (0)