- drop permissions block from reusable build workflow so callers set token scope (fixes PR-checks startup failure: ci.yml grants only contents:read while the reusable demanded packages:write) - remove codeql.yml: repo already uses CodeQL default setup, which conflicts with an advanced configuration - pin trivy-action to 0.36.0 (0.28.0 tag does not exist; <0.35.0 is the compromised supply-chain release flagged by dependency-review) - make pip-audit and npm audit informational (continue-on-error); they flag upstream/transitive advisories, dependency-review stays the PR gate
97 lines
2.4 KiB
YAML
97 lines
2.4 KiB
YAML
name: Security
|
|
|
|
# Audits the full dependency set (pip-audit, npm audit) and runs a Trivy
|
|
# filesystem scan (dependencies + Dockerfile/IaC misconfig). Trivy results are
|
|
# uploaded to the Security -> Code scanning tab.
|
|
#
|
|
# pip-audit / npm audit are informational (continue-on-error): they surface
|
|
# upstream/transitive advisories that aren't necessarily fixable in a given PR,
|
|
# so they report in the logs without blocking merges. The PR gate for newly
|
|
# introduced vulnerable deps is dependency-review.yml.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, dev]
|
|
push:
|
|
branches: [main, dev]
|
|
schedule:
|
|
- cron: "27 4 * * 1" # weekly, Monday 04:27 UTC
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: security-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
python-audit:
|
|
name: pip-audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install pip-audit
|
|
run: pip install pip-audit
|
|
|
|
- name: Audit Python dependencies
|
|
continue-on-error: true
|
|
run: pip-audit -r backend/requirements.txt
|
|
|
|
npm-audit:
|
|
name: npm audit
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Install frontend deps
|
|
run: npm ci
|
|
working-directory: frontend
|
|
|
|
- name: Audit npm dependencies
|
|
continue-on-error: true
|
|
run: npm audit --audit-level=high
|
|
working-directory: frontend
|
|
|
|
trivy:
|
|
name: Trivy filesystem scan
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
security-events: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run Trivy
|
|
uses: aquasecurity/trivy-action@0.36.0
|
|
with:
|
|
scan-type: fs
|
|
scan-ref: .
|
|
format: sarif
|
|
output: trivy-results.sarif
|
|
severity: CRITICAL,HIGH
|
|
ignore-unfixed: true
|
|
|
|
- name: Upload Trivy results
|
|
uses: github/codeql-action/upload-sarif@v3
|
|
if: always()
|
|
with:
|
|
sarif_file: trivy-results.sarif
|
|
category: trivy-fs
|