Skip to content
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 partial support for SSH known hosts markers #11635

Merged
merged 7 commits into from
Feb 1, 2023

Commits on Jan 27, 2023

  1. Add partial support for SSH known hosts markers

    The SSH `known_hosts` file parsing in Cargo did not previously support
    markers. Markers are modifiers on the lines (`@cert-authority` and
    `@revoked`) which denote special behavior for the details on that line.
    Lines were skipped entirely.
    
    This silent skipping of marker lines can be confusing to a user, who
    sees that their command line Git/SSH client works for some repository,
    but Cargo reports that no host key is found.
    
    This change adds support for the `@revoked` marker. This marker denotes
    that a key should be rejected outright. It is of limited use without
    `@cert-authority` marker support. However, if it is present in a user's
    `known_hosts` file, then Cargo definitely shouldn't accept that key and
    probably shouldn't suggest that the user add it to their `known_hosts`
    either.
    
    The change also adds support for detecting `@cert-authority` markers in
    `known_hosts` files. These lines cannot yet be used for host key
    verification, but if one is found for a matching host, the user will be
    informed that Cargo doesn't support `@cert-authority` markers in the
    error message. Additionally, the user will be advised to use the
    `net.git-fetch-with-cli` config option to use the command line git
    client for fetching crates from Git.
    
    Refs: rust-lang#11577
    hds committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    fc2cb00 View commit details
    Browse the repository at this point in the history
  2. Fix format

    hds committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    605506a View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2023

  1. Apply suggestions from code review

    Co-authored-by: Eric Huss <[email protected]>
    hds and ehuss authored Jan 30, 2023
    Configuration menu
    Copy the full SHA
    a871a90 View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2023

  1. Fix host file checking to not return success until all lines have bee…

    …n processed
    
    Since a @Revoked line might deny access to a key which would otherwise
    be accepted, we need to process all lines before we decide that a host
    key should be accepted.
    hds committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    26e08ab View commit details
    Browse the repository at this point in the history
  2. Merge branch 'ssh-known-hosts-markers' of github.com:hds/cargo into s…

    …sh-known-hosts-markers
    hds committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    3cecc8e View commit details
    Browse the repository at this point in the history
  3. cargo fmt

    hds committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    7a6ff7f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0acf2bf View commit details
    Browse the repository at this point in the history