rustorch 0.6.29

Production-ready PyTorch-compatible deep learning library in Rust with special mathematical functions (gamma, Bessel, error functions), statistical distributions, Fourier transforms (FFT/RFFT), matrix decomposition (SVD/QR/LU/eigenvalue), automatic differentiation, neural networks, computer vision transforms, complete GPU acceleration (CUDA/Metal/OpenCL), SIMD optimizations, parallel processing, WebAssembly browser support, comprehensive distributed learning support, and performance validation
Documentation
name: Security Audit

on:
  schedule:
    # Run security audit weekly on Sundays
    - cron: '0 6 * * 0'
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  audit:
    name: Security Audit
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable

      - name: Install audit tools
        run: |
          cargo install cargo-audit
          cargo install cargo-deny --locked
        shell: bash

      - name: Run cargo audit
        run: cargo audit

      - name: Run cargo deny check
        run: |
          # Ensure cargo-deny is in PATH
          export PATH="$HOME/.cargo/bin:$PATH"
          cargo deny check --config config/deny.toml
        shell: bash

      - name: Check for known vulnerabilities
        run: |
          cargo audit --json > audit-report.json
          echo "Security audit completed"
        shell: bash

      - name: Upload audit results
        uses: actions/upload-artifact@v4
        with:
          name: security-audit
          path: audit-report.json

  # dependency-review:
  #   name: Dependency Review
  #   runs-on: macos-latest
  #   if: github.event_name == 'pull_request'
  #   steps:
  #     - name: Checkout code
  #       uses: actions/checkout@v4

  #     - name: Dependency Review
  #       uses: actions/dependency-review-action@v3
  #       with:
  #         fail-on-severity: moderate
  
  # Alternative dependency checking using cargo-audit and cargo-deny
  enhanced-dependency-check:
    name: Enhanced Dependency Security Check
    runs-on: macos-latest
    if: github.event_name == 'pull_request'
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install system dependencies (macOS)
        run: |
          # Ensure Xcode Command Line Tools are properly installed
          sudo xcode-select --install 2>/dev/null || echo "Command Line Tools already installed"
          # Install required tools via Homebrew
          brew install pkg-config
          brew install openblas
        shell: bash

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable

      - name: Install security tools
        run: |
          cargo install cargo-audit --locked
          cargo install cargo-deny --locked
          cargo install cargo-outdated --locked
        shell: bash

      - name: Run comprehensive dependency audit
        run: |
          echo "=== Running cargo audit ==="
          cargo audit --json > pr-audit-report.json
          cargo audit
          
          echo "=== Running cargo deny ==="
          cargo deny check --config config/deny.toml || echo "Cargo deny check completed with warnings"
          
          echo "=== Checking for outdated dependencies ==="
          cargo outdated || echo "Some dependencies are outdated - this is acceptable"
          
          echo "=== Running lightweight build check ==="
          # Test basic compilation without MPI/metal/objc issues
          cargo check --no-default-features --verbose
        shell: bash
          
      - name: Upload PR audit results
        uses: actions/upload-artifact@v4
        with:
          name: pr-security-audit
          path: pr-audit-report.json

  codeql:
    name: CodeQL Analysis
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            build-essential \
            libopenblas-dev \
            liblapack-dev \
            libblas-dev \
            pkg-config \
        shell: bash

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: 'rust'

      - name: Build for CodeQL
        run: cargo build --no-default-features

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3