Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Add cargo deny to audit licenses of dependencies
Browse files Browse the repository at this point in the history
- Add earthly target `check-license` for checking licenses
- Update github actions to `cargo deny licenses sources bans` on every pr excluding advisories
- Add github action nightly job to run `cargo deny` including advisories
  • Loading branch information
expressvpn-mariappan-r committed Aug 31, 2023
1 parent a63355f commit ee1c4e5
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ jobs:
- uses: actions/checkout@v3
- name: Lint crate
run: earthly --ci +lint
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check bans licenses sources
12 changes: 12 additions & 0 deletions .github/workflows/nightly-cargo-deny.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Nightly `cargo deny` checks
on:
schedule:
- cron: '17 6 * * *'
workflow_dispatch:

jobs:
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
5 changes: 5 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ lint:
RUN rustup component add clippy
RUN apt-get install -qqy bsdextrautils
RUN cargo clippy --all-features --all-targets -- -D warnings

check-license:
RUN cargo install --locked cargo-deny
COPY --dir src tests Cargo.toml Cargo.lock deny.toml ./
RUN cargo deny --all-features check bans license sources
51 changes: 51 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[advisories]
db-path = "~/.cargo/advisory-db"
db-urls = ["https://github.com/rustsec/advisory-db"]
vulnerability = "deny"
unmaintained = "deny"
yanked = "deny"
notice = "deny"
ignore = [
#"RUSTSEC-0000-0000",
]
# * None - CVSS Score 0.0
# * Low - CVSS Score 0.1 - 3.9
# * Medium - CVSS Score 4.0 - 6.9
# * High - CVSS Score 7.0 - 8.9
# * Critical - CVSS Score 9.0 - 10.0
severity-threshold = "High"

[licenses]
default = "deny"
copyleft = "deny"
unlicensed = "deny"
allow = [
"MIT",
"Apache-2.0",
"Unicode-DFS-2016",
"BSD-3-Clause",
"ISC",
]
allow-osi-fsf-free = "neither"
confidence-threshold = 0.8
exceptions = [
{ name = "wolfssl-sys", allow = ["GPL-2.0"], version = "*" },
]

[licenses.private]
ignore = true

[bans]
multiple-versions = "warn"
wildcards = "allow"
highlight = "all"
workspace-default-features = "allow"
external-default-features = "allow"

[sources]
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = [
"https://github.com/open-quantum-safe/liboqs-rust",
]

0 comments on commit ee1c4e5

Please sign in to comment.