How to fix: Rust Cargo.toml exposed
The response is a Rust crate manifest: a [package] table with an edition key and a [dependencies] table.
Why it matters
The manifest names every direct dependency and the feature flags each is built with, which matters in Rust because features change what code is compiled in. It also exposes any git or path dependency, and a git dependency pointing at a private repository discloses an internal host and the fact that unpublished crates are in the build.
Distinct from a served Cargo.lock, which gives the full resolved transitive tree: the manifest gives the author's intent, including version ranges that will resolve differently on the next build and the feature set that decides which code paths exist. Both are build inputs and neither should be reachable from a compiled binary's deployment.
How to fix it
- 1Deploy the compiled binary and its runtime assets only, not the crate source directory.
- 2If the manifest named a private git dependency, confirm that repository is not publicly readable.
- 3Audit the dependency set with cargo audit now that the list is public.
Code examples
Multi-stage build that ships only the binary
FROM rust:1-slim AS build
WORKDIR /src
COPY . .
RUN cargo build --release
FROM debian:stable-slim
COPY --from=build /src/target/release/app /usr/local/bin/app
CMD ["app"]Audit the dependency set
cargo auditReferences
Detected automatically by VulnRadar. The check id is supply-chain-cargo-toml-exposed, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
Questions
- How severe is Rust Cargo.toml exposed?
- VulnRadar rates this low severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id supply-chain-cargo-toml-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Rust Cargo.toml exposed map to?
- It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.