Verify that registry crates in your Cargo.lock are reproducible from the git repository

Overview

cargo-goggles

Crates.io Version Crates.io License CI dependency status

Verify that registry crates in your Cargo.lock are reproducible from the git repository.

This cargo subcommand analyzes the following properties for crates in your Cargo.lock:

  1. Cargo.toml contains a repository field pointing at a valid git repository
  2. For each of the releases you are using, a valid git tag is present on the release commit
  3. The tagged commit matches the value in .cargo_vcs_info.json, if present
  4. The contents of the crates.io release are reproducible from the files inside the repo

How to use it

# Install
cargo install --locked cargo-goggles

# Run it inside your project (must already contain a Cargo.lock file)
cargo goggles

Roadmap

  • Cleanup most of the code
  • Make it into a proper library and CLI
  • Support registries other than crates.io
  • Fix some flaws
  • Make it pull previously cloned repositories when changes are available
  • Stop relying on the git CLI
  • Make it faster
  • Make it easy to see differences between the contents of the git repository and the registry

See also

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • Show dependency status of main branch in README

    Show dependency status of main branch in README

    It is a bit misleading to show the status of the last published version, because some issues could have been already resolved and this is not clear at a first glance.

    Feel free to close this PR if the current behavior is intended.

    opened by dodomorandi 3
  • False positive on utf8parse 0.2.1

    False positive on utf8parse 0.2.1

    Your tag heuristics doesn't work for the crate utf8parse. It is part of a larger workspace. The correct tag to use is utf8parse_v0.2.1 not v0.2.1 (which refers to the containing project vte I believe). This is part of https://github.com/alacritty/vte

    opened by VorpalBlade 3
  • Feature request: Paralleism

    Feature request: Paralleism

    It should be possible to use something like rayon to run many checks of different dependencies in parallel. The program doesn't seem to be either CPU or network bound, so it should be trivial to make it go faster.

    opened by VorpalBlade 1
  • feat(git): clone git repositories without blobs

    feat(git): clone git repositories without blobs

    Using --filter=blob:none still clones tags, but avoids downloading blobs until they are needed, e.g. until particular revision of the repository is checked out.

    Cloning all blobs including large deleted files may take a lot of space for some repositories.

    opened by link2xt 0
  • fix(git): set GIT_TERMINAL_PROMPT=0 env variable

    fix(git): set GIT_TERMINAL_PROMPT=0 env variable

    If this Boolean environment variable is set to false, git will not prompt on the terminal (e.g., when asking for HTTP authentication).

    As explained by the git docs this prevents private or deleted repositories from blocking the clone process by asking for credentials. Unfortunately, this doesn't seem to stop git from prompting about ssh key authenticity.

    opened by paolobarbolini 0
  • Duplicate tarball files and case-insensitive file systems complicate path checks

    Duplicate tarball files and case-insensitive file systems complicate path checks

    Beware that it's possible to have a tarball with cargo.toml that will be readable as Cargo.toml on a case-insensitive file system, but will not match path == "Cargo.toml" check in Rust.

    Due to case-insensitivity confusion, cargo package can behave differently on macOS and Windows where it may end up with both README.md and Readme.md or an extra cargo.lock: https://github.com/rust-lang/cargo/issues/13722

    Unfortunately there's a bunch of old crates affected by this.

    https://github.com/rust-lang/crates.io/issues/8410

    opened by kornelski 0
  • Faster clone method

    Faster clone method

    Instead of cloning the repo and then looking for a tag, you can use git ls-remote (Remote::create_detached & connect_auth & list in git2) to find a tag and its sha1.

    When you have a sha1, you can init an empty repo, and do git fetch +3db7c05aa35749cc4e0f0f892bc5831219901f98:refs/heads/whateverbranch --depth=1 to get just that one commit.

    opened by kornelski 3
  • Test that commit is reachable from the default branch

    Test that commit is reachable from the default branch

    It is easy to create commit somewhere off the main branch where nobody reviews it. Some projects keep non-main branch as default or maintain multiple stable branches that contain backports and are never merged into main, but at least a warning would be nice.

    I also wonder if we can do something to prevent (re)moving tags later. If we check published crate today and tag is in the right place, it can still be moved later. Can we do something to prevent it? I have looked a bit into annotated tags, but it does not seem to be possible to merge the tag into branch, i.e. make it impossible to remove the tag without force-pushing, right?

    I can see hash of annotated tags in .git/packed-refs, and it is different from the hash of the commit annotated tag points to, but attempting to merge this into main branch results in merging the commit, git says there is nothing to do, "already merged".

    In mercurial it is different, tags are stored in .hgtags file that is actually commited to the branch. This means tags look different depending on the commit checked out, but they are permanently recorded in the history. Is there anything similar for git? It seems to be at least possible to extend git this way, nothing prevents writing .gittags into the repo.

    opened by link2xt 1
  • Lockfile for non-reproducible crates

    Lockfile for non-reproducible crates

    cargo-goggles needs a way to store a list of tested reproducible and tested non-reproducible crates next to Cargo.lock so it can be committed to the repository. Then in CI we can check that all packages from Cargo.lock have been tested and are included in one of these lists. Locally developers can run cargo-goggles to update the list, but likely not in CI on every commit because downloading git repositories for all dependencies is too slow and uses git hoster resources unnecessarily.

    opened by link2xt 3
  • Put crate name and version in `repo_dir`

    Put crate name and version in `repo_dir`

    This will fix "Make it pull previously cloned repositories when changes are available" todo item from the readme. Together with #13 this should be relatively cheap to clone the same repo multiple times.

    Having a separate checkout for each crate makes everything easier because each repository is cloned and checked out once and is not changed afterwards.

    opened by link2xt 0
Owner
M4SS - Industrial IoT Solutions
Makers of S451 - Soon to be published Open Source technology for interconnecting IoT machines in a secure and reliable way
M4SS - Industrial IoT Solutions
Estimate the amount of time spent working on a Git repository

jikyuu (時給) A tool to estimate the amount of time spent working on a Git repository. It is a direct port of git-hours, written in Node.js, because the

null 18 Nov 16, 2022
GRM — Git Repository Manager

GRM helps you manage git repositories in a declarative way. Configure your repositories in a TOML file, GRM does the rest.

Hannes Körber 32 Dec 30, 2022
Open Source terraform provider registry

Terustry Simple configurable proxy that implement terraform provider registry protocol, to build your own terraform provider private registry. How it

Open-Source by Veepee 53 Nov 24, 2022
Rust program to monitor Windows 10 Registry keys for changes or modifications.

RegMon This Rust program monitors changes to multiple registry keys in Windows 10 and writes the changes to a text file. It also periodically sends a

0x44F 3 Jan 16, 2023
cargo-lambda a Cargo subcommand to help you work with AWS Lambda

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. This subcommand compiles AWS Lambda functions natively and produces

David Calavera 184 Jan 5, 2023
cargo-lambda is a Cargo subcommand to help you work with AWS Lambda.

cargo-lambda cargo-lambda is a Cargo subcommand to help you work with AWS Lambda. The new subcommand creates a basic Rust package from a well defined

null 184 Jan 5, 2023
A cargo subcommand that extends cargo's capabilities when it comes to code generation.

cargo-px Cargo Power eXtensions Check out the announcement post to learn more about cargo-px and the problems it solves with respect to code generatio

Luca Palmieri 33 May 7, 2023
A Zincati lock backend for stateful workloads.

This repository is deprecated. We realized CoreOS is probably not a good fit for us. The repository will be kept up on the off chance that this is use

Open Computing Facility 6 Dec 7, 2022
Free and open-source reimplementation of Native Mouse Lock (display_mouse_lock) in rust.

dml-rs display_mouse_lock in rust. Free, open-source reimplementation of display_mouse_lock (Native Mouse Lock) in Rust. Written because I felt like i

Tomat 4 Feb 12, 2023
An efficient async condition variable for lock-free algorithms

async-event An efficient async condition variable for lock-free algorithms, a.k.a. "eventcount". Overview Eventcount-like primitives are useful to mak

Asynchronics 3 Jul 10, 2023
Easily add emojis to your git commit messages 😎

gimoji A CLI tool that makes it easy to add emojis to your git commit messages. It's very similar to (and is based on) gitmoji-cli but written in Rust

Zeeshan Ali Khan 12 May 29, 2023
🌲 Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 26 Dec 17, 2022
Clean up the lines of files in your code repository

lineman Clean up the lines of files in your code repository NOTE: While lineman does have tests in place to ensure it operates in a specific way, I st

Joseph T. Lyons 4 Nov 25, 2021
A lean, minimal, and stable set of types for color interoperation between crates in Rust.

This library provides a lean, minimal, and stable set of types for color interoperation between crates in Rust. Its goal is to serve the same function that mint provides for (linear algebra) math types.

Gray Olson 16 Sep 21, 2022
k-mer counter in Rust using the rust-bio and rayon crates

krust is a k-mer counter written in Rust and run from the command line that will output canonical k-mers and their frequency across the records in a f

null 14 Jan 7, 2023
Rust library to scan files and expand multi-file crates source code as a single tree

syn-file-expand This library allows you to load full source code of multi-file crates into a single syn::File. Features: Based on syn crate. Handling

Vitaly Shukela 11 Jul 27, 2022
Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.

cargo-xbuild Cargo-xbuild is a wrapper for cargo build, which cross compiles the sysroot crates core, compiler_builtins, and alloc for custom targets.

Rust OSDev 241 Dec 30, 2022
A snapshot of name squatting on crates.io

Machine-readable database of public packages on crates.io which meet an arbitrary, unwritten, sensible definition of name squatting: squatted.csv Form

David Tolnay 69 Feb 1, 2023
Generate an SPDX Software Bill of Materials for Rust crates.

cargo-spdx cargo-spdx is currently in development and not yet ready for use. cargo-spdx provides a cargo subcommand to generate an SPDX Software Bill

Andrew Lilley Brinker 13 May 18, 2023