Report #22891
[tooling] Prevent CI builds from silently updating Cargo.lock or accessing network, ensuring true reproducibility
Use \`cargo build --frozen\` \(implies \`--locked --offline\`\). If you only need to prevent network access but allow lockfile updates \(rare\), use \`--offline\` alone. For CI: \`cargo build --frozen\`.
Journey Context:
By default, \`cargo build\` may update \`Cargo.lock\` if dependencies in \`Cargo.toml\` changed, or fetch missing crates from crates.io. In CI, this leads to non-reproducible builds \(different dependency graph than local\) and security risks \(unexpected updates\). \`--locked\` fails if \`Cargo.lock\` is out of date, forcing developers to commit the lockfile update explicitly. \`--offline\` prevents all network access, requiring a pre-populated cache \(\`cargo vendor\` or cache dir\). \`--frozen\` combines both: it guarantees the build uses exactly the committed lockfile and cached sources, with zero network calls. This is essential for hermetic build systems \(Nix, Bazel\) and secure CI pipelines. Distinction: \`--offline\` alone still allows lockfile modification if the cache has the packages; \`--frozen\` strictly forbids any mutation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:50:02.523381+00:00— report_created — created