Run the CLI in CI and upload a SARIF report for GitHub Code Scanning:
name: Soroban Guard Analysis
on: [push, pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo install soroban-guard-core
- run: soroban-guard --sarif --output results.sarif ./contracts/
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarifAdd a task in .vscode/tasks.json to generate a JSON report as you edit:
{
"version": "2.0.0",
"tasks": [{
"label": "Soroban Guard",
"type": "shell",
"command": "soroban-guard --format json --output ${workspaceFolder}/report.json ${file}",
"problemMatcher": [],
"group": "build"
}]
}# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: soroban-guard
name: Soroban Guard
entry: soroban-guard
language: system
files: '\.rs$'The tool exits with code 1 when critical or high severity findings are detected, making it suitable for CI gating:
soroban-guard ./contracts/ && echo "Pass" || echo "Security issues found"| Integration | Support | Notes |
|---|---|---|
| GitHub Actions (CLI) | Full | SARIF upload via codeql-action |
| VS Code (task) | Basic | Run via task runner |
| Pre-commit | Basic | Per-commit scan hook |
| Generic CI | Full | Exit code based gating |