Git Product home page Git Product logo

cargo-audit's Introduction

(unofficial)

Cargo Audit

In a Docker image

Getting started

If you inspect the Dockerfile you'll see that this is literally just a Docker image that contains cargo-audit in a distroless image. I created it to save time on installing it since cargo install is so slow.

The image runs cargo audit fix.

# Pull the image
docker pull ghcr.io/simonhyll/cargo-audit
# Run it in your crate
docker run --rm -v $(pwd):/app ghcr.io/simonhyll/cargo-audit
# Or, on Windows, because $(pwd) wont work there to mount the current working directory
docker run --rm -v %cd%:/app ghcr.io/simonhyll/cargo-audit

# Or you can build and run it yourself

# Clone the repository
git clone https://github.com/simonhyll/cargo-audit
cd cargo-audit
# Build the image
docker build -t cargo-audit:latest .
# Run it in your crate
docker run --rm -v $(pwd):/app cargo-audit

In a workflow

This is the most useful usecase. Just add it to a workflow and bam, your project gets audited and a pull request is created to push the fixes if any were made.

    steps:
      - name: Run cargo audit fix
        uses: simonhyll/cargo-audit@v1
        with:
          path: "./" # (optional) Path to the folder that contains your Cargo.lock file

Here's an example full workflow.

name: Audit project
on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

jobs:
  audit:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write

    steps:
      - name: Run cargo audit fix
        uses: simonhyll/cargo-audit@v1

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          branch: bot/cargo-audit
          title: "[Bot] Audit fixes"
          commit-message: Cargo audit fixes
          body: >
            Updates to Cargo.toml and/or Cargo.lock with security fixes.
          labels: automated pr

cargo-audit's People

Contributors

simonhyll avatar

Stargazers

 avatar

Watchers

 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.