Skip to content

Add user-drawn bounding box annotations, collections, and review workflow #303

Add user-drawn bounding box annotations, collections, and review workflow

Add user-drawn bounding box annotations, collections, and review workflow #303

name: "Security Scanning"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 2 * * 1' # Weekly on Mondays at 2 AM
permissions:
contents: read
security-events: write
jobs:
container-scan:
name: Container Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image for scanning
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: security-scan:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@v0.35.0
with:
image-ref: 'security-scan:latest'
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'
exit-code: 0
ignore-unfixed: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: 'trivy-results.sarif'
category: 'container-scan'
dependency-scan:
name: Dependency Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install safety bandit semgrep
- name: Run Safety (Python dependency vulnerability scanner)
run: |
uv export --no-hashes > /tmp/requirements.txt
safety check -r /tmp/requirements.txt --json --output safety-results.json || true
- name: Run Bandit (Python security linter)
working-directory: ./backend
run: |
bandit -r . -f json -o bandit-results.json || true
- name: Run Semgrep (Static analysis for security bugs)
run: |
semgrep --config=auto --json --output=semgrep-results.json . || true
- name: Upload scan artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: security-scan-results
path: |
safety-results.json
backend/bandit-results.json
semgrep-results.json