dfns-sdk-rust 0.2.0

Dfns API SDK for Rust
Documentation
name: Rust Security Check

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read

env:
  TRIVY_VERSION: "v0.73.0"

jobs:
  sec-scan:
    timeout-minutes: 15
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

      - name: Install Rust
        uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable

      - name: Generate Cargo.lock
        # cargo audit and trivy both read Cargo.lock, which library crates don't commit
        run: cargo generate-lockfile

      - name: Install trivy
        uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
        with:
          version: ${{ env.TRIVY_VERSION }}

      - name: Run security scan with aquasecurity trivy
        run: trivy fs --exit-code 1 --no-progress --severity CRITICAL ./

      - name: Run security scan with cargo audit
        uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}