cargo-deny icon indicating copy to clipboard operation
cargo-deny copied to clipboard

Wildcard version warnings generated for local file dependencies

Open repi opened this issue 4 years ago • 5 comments

PR #227 seems to generate wildcard warnings when using standard path dependencies and specifying no version (as one is using the local file version), don't think that should generate warnings.

Such as:

[dependencies]
telemetry = { path = "../telemetry" }

Think we should only generate wildcard warnings when one is explicitly using the version field for the crates.io version.

Note that one can also use both a path depependency and a version dependency, where building locally uses the path dependency and building from a crates.io published dependency uses the specific version, then the wildcard warning should still trigger if using wildcard version:

[dependencies]
telemetry = { path = "../telemetry", version = "*" }

cc @khodzha @Jake-Shadle

repi avatar Aug 10 '20 09:08 repi

i dug around a bit and couldnt find a way to distinguish { path = "../telemetry", version = "*" } and { path = "../telemetry" } based on cargo metadata output :disappointed:

khodzha avatar Aug 18 '20 15:08 khodzha

Ouch that is unfortunate, this we do have to have some solution for as it is very common, hmm. Maybe one have to extend cargo-metadata to distinguish it there (if possible) and expose that?

repi avatar Aug 18 '20 15:08 repi

I don't think that's possible because not even cargo knows that. (At least their metadata output)

Stupremee avatar Aug 18 '20 15:08 Stupremee

This relates a bit to #136, where the intention would be to actual properly parse Cargo.toml manifests for doing error reporting, so having that utility (probably in a separate crate eg krates probably) would mean you could query both the cargo metadata, but also the actual entry in the manifest to distinguish between them for special cases such as this.

Jake-Shadle avatar Aug 18 '20 15:08 Jake-Shadle

It would be nice if I could configure cargo-deny to only warn on / error on wildcard registry dependencies (not git or path dependencies), regardless of whether it was specified explicitly or not.

jplatte avatar Feb 15 '21 16:02 jplatte