Skip to content

Security

Security #72

Workflow file for this run

name: Security
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 6 * * 1" # Weekly on Monday at 6 AM UTC
permissions:
contents: read
security-events: write
jobs:
dependency-scan:
name: Dependency Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.11
- name: Export requirements (no hashes to allow local editable)
run: uv export --no-dev --format requirements-txt --no-hashes > requirements.txt
- name: Run pip-audit
uses: pypa/gh-action-pip-audit@v1.1.0
with:
inputs: requirements.txt
docker-scan:
name: Docker Scan
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v6
- name: Build Docker image
run: docker build -t libmbus2mqtt:scan .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: "libmbus2mqtt:scan"
format: "sarif"
output: "trivy-results.sarif"
- name: Upload Trivy scan results
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: "trivy-results.sarif"