name: security
on:
push:
branches:
- master
- main
- 'release/**'
paths-ignore:
- "**.md"
- "docs/**"
pull_request:
paths-ignore:
- "**.md"
- "docs/**"
schedule:
- cron: "0 7 * * 1"
workflow_dispatch:
concurrency:
group: security-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads/master') && !startsWith(github.ref, 'refs/heads/main') && !startsWith(github.ref, 'refs/heads/release/') }}
jobs:
runner:
uses: zakuro-ai/zakuro-infra/.github/workflows/pick-runner.yml@main
permissions: { actions: read }
secrets: inherit
cargo-audit:
needs: runner
runs-on: ${{ needs.runner.outputs.runner }}
timeout-minutes: 10
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 with:
toolchain: "stable"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32
- name: Install cargo-audit + cargo-deny
uses: taiki-e/install-action@9e1e5806d4a4822de933115878265be9aaa786d9 with:
tool: cargo-audit,cargo-deny
- name: cargo audit
run: cargo audit --ignore RUSTSEC-0000-0000
- name: cargo deny check advisories
run: cargo deny check advisories
continue-on-error: true
- name: cargo deny check bans + licenses + sources
run: cargo deny check bans licenses sources
continue-on-error: true
gitleaks:
needs: runner
runs-on: ${{ needs.runner.outputs.runner }}
timeout-minutes: 10
continue-on-error: true
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with:
fetch-depth: 0
- name: gitleaks
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e with:
args: detect --source . --report-format sarif --report-path gitleaks.sarif
continue-on-error: true
- name: Upload gitleaks SARIF
if: always()
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with:
sarif_file: gitleaks.sarif
category: gitleaks
continue-on-error: true
trivy-fs:
needs: runner
runs-on: ${{ needs.runner.outputs.runner }}
timeout-minutes: 10
continue-on-error: true
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
- name: Trivy filesystem scan
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 with:
scan-type: fs
scan-ref: .
format: sarif
output: trivy.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
- name: Upload Trivy SARIF
if: always()
uses: github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with:
sarif_file: trivy.sarif
category: trivy-fs
continue-on-error: true