Skip to content

Commit

Permalink
ci: security checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dantetemplar committed Dec 10, 2024
1 parent a1a8187 commit 3416b8f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/bandit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Bandit Scan

on: [push]

jobs:
bandit:
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
run: bandit -ll -ii -r . -f json -o bandit-report.json

- name: Upload Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: bandit-findings.json
path: bandit-report.json
21 changes: 21 additions & 0 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
permissions: # Permissions granted to the 'GITHUB_TOKEN'
contents: read
packages: write
pull-requests: write

outputs:
imageid: ${{ steps.build.outputs.imageid }}
steps:
Expand Down Expand Up @@ -57,6 +59,25 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Docker Scout
id: docker-scout
uses: docker/scout-action@v1
with:
command: cves
image: ${{ steps.meta.outputs.tags }}
only-severities: critical,high
write-comment: true
github-token: ${{ secrets.GITHUB_TOKEN }} # to be able to write the comment
sarif-file: sarif.output.json
summary: true

- name: Upload SARIF result
id: upload-sarif
if: ${{ github.event_name != 'pull_request_target' }}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif.output.json

deploy:
# Only on manual trigger or push to main
if: github.repository_owner == 'one-zero-eight' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main'))
Expand Down

0 comments on commit 3416b8f

Please sign in to comment.