| name | dependency-management |
| description | Dependency Management guidance for Fortress Rollback. Use when Evaluating dependencies, supply chain security, cargo-deny. |
Dependency Management
Every dependency is a liability: compile time, binary size, attack surface, maintenance burden.
Evaluation Checklist
Before adding any dependency:
When Dependencies ARE Worth It
Complex domains (crypto, compression, parsing), battle-tested code (serde, tokio), security-sensitive implementations, expertise gaps.
Research Resources
Analysis Commands
cargo tree
cargo tree -d
cargo tree -f "{p} {f}"
cargo tree -i some_crate
cargo tree -e features
cargo +nightly udeps
cargo outdated
Version Management
serde = "1.0"
tokio = "1"
serde = "=1.0.152"
Pre-1.0 crates (0.x.y) can break in minor versions. Prefer 1.0+ when available.
cargo update
cargo update -p crate_name
cargo update -p crate_name --precise X
Feature Management
tokio = { version = "1", default-features = false, features = ["rt", "net"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
cargo tree -f "{p} {f}"
cargo tree -f "{p} {f}" -i tokio
Feature Propagation
[features]
default = ["std"]
std = ["serde/std", "dep-crate/std"]
serde = ["dep:serde"]
[dependencies]
serde = { version = "1.0", optional = true }
Security
cargo-audit
cargo audit
cargo audit fix
cargo-deny
cargo deny init
cargo deny check
[advisories]
vulnerability = "deny"
unmaintained = "warn"
yanked = "warn"
[licenses]
unlicensed = "deny"
allow = ["MIT", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "Zlib"]
[bans]
multiple-versions = "warn"
wildcards = "deny"
deny = [
{ name = "openssl" },
{ name = "openssl-sys" },
]
[sources]
unknown-registry = "deny"
unknown-git = "warn"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
License Compatibility
| Safe | Caution | Avoid |
|---|
| MIT, Apache-2.0, BSD, ISC, Zlib | MPL-2.0, LGPL | GPL, AGPL |
Unsafe Code Audit
cargo geiger
Supply Chain Security CI
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install cargo-audit cargo-deny
- run: cargo audit
- run: cargo deny check
Workspace Dependencies
[workspace.dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
my-core = { path = "crates/my-core" }
[dependencies]
serde = { workspace = true }
my-core = { workspace = true }
tracing = { workspace = true, features = ["log"] }
Benefits: consistent versions, single update point, cleaner manifests.
Git Dependencies
some-crate = { git = "https://github.com/org/repo", rev = "abc123" }
Replacement Strategies
Replace dependencies proactively when: deprecated, unmaintained (1+ year), unpatched vulnerabilities, better alternatives exist, too many transitive deps.
Fortress-Specific Requirements
All new dependencies must:
- Pass
cargo deny check
- Support
no_std (or be behind a feature flag)
- Be deterministic (no hidden randomness)
- Minimize features (only enable what's needed)
- Be documented in Cargo.toml with a comment
Recommended Crates
| Purpose | Crate | Notes |
|---|
| Serialization | serde, bincode | Network protocol, save states |
| Hashing | ahash, xxhash-rust | Deterministic, fast |
| Compression | lz4_flex | Fast, pure Rust |
| Networking | quinn, laminar | QUIC, game UDP |
Automated Updates
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule: { interval: "weekly" }
groups:
rust-dependencies:
patterns: ["*"]
update-types: ["minor", "patch"]
open-pull-requests-limit: 10
Agent Checklist
Adding a Dependency
After Updating