-
Notifications
You must be signed in to change notification settings - Fork 83
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
Add fix
subcommand
#262
Merged
Merged
Add fix
subcommand
#262
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jake-Shadle
force-pushed
the
advisory-fix
branch
from
September 16, 2020 17:23
002e4b9
to
221b59c
Compare
Jake-Shadle
force-pushed
the
advisory-fix
branch
from
September 28, 2020 08:42
d1bdefd
to
df187f6
Compare
Stupremee
suggested changes
Sep 28, 2020
- Fixup #244 - Use a single root path, under which multiple databases can be stored - Refactor config diagnostics to report non-fatal diagnostics - Add ability to lint unsound advisories
Jake-Shadle
force-pushed
the
advisory-fix
branch
from
October 6, 2020 21:22
21a5d5c
to
3e9a3cb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds a
fix
subcommand, which attempts to automatically update cargo manifests to use versions of a crate that are unaffected by advisories.The algorithm we use differs from the one currently used in
cargo audit
, as that one only allows patching of direct dependencies, but it's much more likely (especially in larger projects) that the crate which an advisory applies to is a transitive dependency, potentially multiple times, so we instead start at each vulnerable crate and walk up the crate graph until all local/workspace crates have been reached, gathering the set of versions that include 1 or more of the "good" versions of the dependent crate.Due to the nature of crate graphs, this fix command is basically a best effort of trying to patch as many crates as it can, and printing warnings when it is unable to do so as there are a number of reasons a patch can't be (fully) applied.
--allow-incompatible
.This is what a dry run currently looks like, displaying the patch that would be applied by the fix subcommand
Additional changes:
unsound
advisories~/.cargo/advisory-dbs
) under which each db is placed in a directory with canonicalized format, similar to how cargo places registry indexesTODO:
Need to fixup error reporting so that it's clear where and why an advisory can't be patched.
Resolves: #242