| 1 |
name: Bandit |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
pull_request: |
| 7 |
paths: |
| 8 |
- "src/**" |
| 9 |
- "pyproject.toml" |
| 10 |
- "justfile" |
| 11 |
- ".github/workflows/bandit.yml" |
| 12 |
workflow_dispatch: |
| 13 |
|
| 14 |
permissions: |
| 15 |
contents: read |
| 16 |
|
| 17 |
concurrency: |
| 18 |
group: bandit-${{ github.event.pull_request.number || github.ref }} |
| 19 |
cancel-in-progress: true |
| 20 |
|
| 21 |
jobs: |
| 22 |
bandit-analysis: |
| 23 |
name: Run Bandit |
| 24 |
runs-on: ubuntu-latest |
| 25 |
permissions: |
| 26 |
contents: read |
| 27 |
security-events: write # allow uploading code scanning results |
| 28 |
|
| 29 |
steps: |
| 30 |
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 |
| 31 |
with: |
| 32 |
persist-credentials: false |
| 33 |
- name: Set up Python |
| 34 |
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 |
| 35 |
id: sp |
| 36 |
with: |
| 37 |
python-version: "3.x" |
| 38 |
allow-prereleases: true |
| 39 |
- name: Install uv |
| 40 |
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 |
| 41 |
with: |
| 42 |
enable-cache: false |
| 43 |
- name: Install Just |
| 44 |
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 |
| 45 |
|
| 46 |
- name: Run Bandit |
| 47 |
run: | |
| 48 |
just bandit |
| 49 |
|
| 50 |
- name: Upload analysis results |
| 51 |
if: ${{ always() }} |
| 52 |
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a |
| 53 |
with: |
| 54 |
name: bandit-results |
| 55 |
path: bandit.sarif |
| 56 |
retention-days: 7 |
| 57 |
|
| 58 |
- name: Upload to code-scanning |
| 59 |
if: ${{ always() }} |
| 60 |
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e |
| 61 |
with: |
| 62 |
sarif_file: bandit.sarif |