-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider sub-crate feature exclusions for audits #380
Comments
In terms of how difficult This has a slightly awkward interaction with the evolution of crates over time, as a given feature could e.g. no longer exist in a newer version (as all checks are done against the current version in the dependency graph, as we don't know e.g. "what features would be enabled on a previous version X of this crate"), or the feature could be renamed. The |
We'd also benefit from this on Fuchsia. There are a number of crates with features that we don't review code for, since we don't ever enable it. |
Chromium will also benefit from this as we attempt to adopt vet. |
I note that audits that ignore a particular crate feature are just one kind of a partial audit. Another example of a partial audit is ignoring target platforms / OS-es that are irrelevant to the auditor - e.g. Chromium may want to ignore I guess the observation above doesn't necessarily mean that "sub-crate feature exclusions for audits" wouldn't be useful to have in Just my 2 cents... |
Generally speaking cargo-vet always operates at crate granularity, and we've resisted anything finer-grained on the grounds that it's difficult to reason about, difficult to implement, and of questionable utility in practice.
Earlier today, @selenography was describing his in-progress audit of
reqwest
, and asking whether there was a way to exclude thesocks
feature, which was a lot of unfamiliar code which we aren't using anyway. This led @mystor to formulate a feature description that I thought was interesting enough to at least document and discuss further.The key insight is that
cargo-vet
already assumes that any code not reachable by enabling all features on the top-level crates (i.e., passing--all-features
tocargo-metadata
) can be excluded from analysis. At the moment this happens by dropping conditional dependencies which can never be built, because that's all cargo-vet knows how to do. However, we could also apply this same conditionality to the inclusion/exclusion of audits.A rough sketch of this would be an optional
exclude-features = [...]
field on audit entries. Cargo-vet would only consider the audit if it were able to verify that none of the features in the list could ever be enabled on that node in the crate graph. Getting this information out ofcargo-metadata
might be anywhere between trivial and impossible, I haven't investigated.You could then imagine an additional
add-features = [...]
field, which would allow you to patch in coverage to an existing audit. So if @selenography auditedreqwest-x.y.z
withoutsocks
, and somebody comes along and wants to usesocks
, they could just audit thesocks
part, and cargo-vet could combine the two.The text was updated successfully, but these errors were encountered: