Giter VIP home page Giter VIP logo

cargo-scan's Introduction

Cargo Scan

cargo scan is a supply chain auditing tool for Cargo (Rust) dependencies using static analysis. It can also be used in tandem with cargo vet.

โš ๏ธ cargo scan is under active development. All interfaces are currently unstable.

Installation

Make sure you have Rust, then run make install.

This installs cargo-download and builds the Rust source. Installation has been tested on Mac OS (Monterey) and Linux (Arch Linux).

Quick-start

Obtaining a crate

To use Cargo Scan you first need a crate. You can either:

  • Fetch an existing crate from crates.io:
    cargo download -x <crate name>
    
  • Use one of the provided test crates in data/test-crates
  • Provide your own (given the directory to the source files)

Running a scan

To scan a crate, looking for dangerous function calls:

cargo run <path to crate>

Crates can be put anywhere, but are generally placed in data/packages for our scripting. For example,

cargo run data/packages/num_cpus
cargo run data/test-packages/permissions-ex

Running an audit

To audit a package:

cargo run --bin audit <path to crate> crate.policy

Unit tests

  • Run cargo test to run Rust unit tests

  • Run make test to re-run the tool on all our test packages, whose results are in data/results and placed under version control to check for any regressions.

Running an experiment

You can also run ./scripts/scan.py -h to see options for running an experiment; this is useful for running a scan on a large list of crates, e.g. the top 100 crates on crates.io or your own provided list. Alternatively, see Makefile for some pre-defined experiments to run, such as make top10.

cargo-scan's People

Contributors

cdstanford avatar davidthien avatar lzoghbi avatar

Watchers

Jainta Paul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.