Rust Converter — Testing & Security Guide
Quick reference for building, testing, and auditing the Rust converter in converters/rust/.
Prerequisites
rustc --version
cargo --version
# If not available:
source ~/.cargo/envQuick Commands
| Command | Purpose |
|---|---|
cargo build | Compile the project |
cargo test --lib | Run unit tests only |
cargo test --all-features | Run all tests |
cargo check --all-features | Fast validation (no link) |
cargo clippy --all-features -- -D warnings | Lint with Clippy |
cargo fmt | Format code |
cargo doc --open | Generate and view docs |
cargo clean | Remove build artifacts |
Security Testing
Full Security Audit
# From project root:
./scripts/rust-security-audit.shThis runs:
cargo check— compilation validationcargo audit— dependency vulnerability scancargo geiger— unsafe code detectioncargo deny— license and security compliance
Reports are saved to converters/rust/security-reports/.
Manual Commands
cd converters/rust
cargo audit # Vulnerability scan
cargo geiger --all-features # Unsafe code detection
cargo deny check # License checking (requires deny.toml)Installing Security Tools (one-time)
cargo install cargo-audit
cargo install cargo-geiger
cargo install cargo-deny
cargo install cargo-fuzz # optionalDevelopment Workflow
Before Every Commit
cargo fmt
cargo clippy --all-features -- -D warnings
cargo test --all-features
cargo audit
cargo geiger --all-featuresCI Pipeline
The .github/workflows/ci.yml runs all of the above automatically on every push, plus:
- Rust stable and beta channels
- Tarpaulin coverage (cobertura format → Codecov)
Advanced Testing
Fuzzing
cargo fuzz init
cargo fuzz add json_to_graphql
cargo fuzz run json_to_graphqlCode Coverage
cargo install cargo-tarpaulin
cargo tarpaulin --out HtmlBenchmarks
cargo benchCommon Issues
| Problem | Solution |
|---|---|
rustc: command not found | source ~/.cargo/env |
| Security tools not found | cargo install cargo-audit cargo-geiger cargo-deny |
| Tests fail to compile | cd converters/rust && cargo clean && cargo build |
Related
- Converter README
- CI workflow — automated test/audit pipeline
- Security Audit script