| 1 | name: Security |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | push: |
| 6 | branches: |
| 7 | - main |
| 8 | workflow_dispatch: |
| 9 | |
| 10 | permissions: {} |
| 11 | |
| 12 | jobs: |
| 13 | dependency-audit: |
| 14 | name: Dependency audit |
| 15 | runs-on: ubuntu-latest |
| 16 | permissions: |
| 17 | contents: read |
| 18 | steps: |
| 19 | - name: Checkout |
| 20 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 21 | with: |
| 22 | persist-credentials: false |
| 23 | |
| 24 | - name: Install uv |
| 25 | uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 |
| 26 | |
| 27 | # Block known vulnerabilities in the locked Python dependency graph. |
| 28 | - name: Run uv audit against locked dependencies |
| 29 | run: uv audit --locked |
| 30 | |
| 31 | dependency-review: |
| 32 | name: Dependency review |
| 33 | if: github.event_name == 'pull_request' |
| 34 | runs-on: ubuntu-latest |
| 35 | permissions: |
| 36 | contents: read |
| 37 | steps: |
| 38 | - name: Checkout |
| 39 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 40 | with: |
| 41 | persist-credentials: false |
| 42 | |
| 43 | - name: Review dependency changes |
| 44 | uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 |
| 45 | |
| 46 | secret-scan: |
| 47 | name: Secret scan |
| 48 | runs-on: ubuntu-latest |
| 49 | permissions: |
| 50 | contents: read |
| 51 | steps: |
| 52 | - name: Checkout full history for diff-aware scanning |
| 53 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 54 | with: |
| 55 | fetch-depth: 0 |
| 56 | persist-credentials: false |
| 57 | |
| 58 | # The action derives the commit range from the GitHub event and fails on |
| 59 | # verified secrets. Keep output limited to verified findings to avoid noisy |
| 60 | # unverified annotations. |
| 61 | - name: Run TruffleHog OSS secret scan |
| 62 | uses: trufflesecurity/trufflehog@00155c9dc586f34d189adc83d3ac2698c2ec551f # v3.95.8 |
| 63 | with: |
| 64 | version: 3.95.5 |
| 65 | extra_args: --results=verified |
| 66 | |
| 67 | sast-scan: |
| 68 | name: SAST scan |
| 69 | runs-on: ubuntu-latest |
| 70 | permissions: |
| 71 | contents: read |
| 72 | container: |
| 73 | image: semgrep/semgrep@sha256:06938c1f365d3f67b8cedd8bc117607ae64253f88a0e768e9da9408548927dd6 # v1.167.0 |
| 74 | steps: |
| 75 | - name: Checkout |
| 76 | uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 77 | with: |
| 78 | persist-credentials: false |
| 79 | |
| 80 | # Advisory-first: visibility before enforcement. Semgrep CE scans |
| 81 | # the repository with the community rule set (Python, shell, YAML, |
| 82 | # JavaScript, Go) to catch source-level security bugs before they |
| 83 | # reach production. Set continue-on-error: false once a clean baseline |
| 84 | # is confirmed. |
| 85 | - name: Run Semgrep SAST scan |
| 86 | continue-on-error: true |
| 87 | env: |
| 88 | SEMGREP_SEND_METRICS: off |
| 89 | run: semgrep scan --config=auto |
| 90 |