From ee1c4e5e76c7f98754e399eb3051837046f8df82 Mon Sep 17 00:00:00 2001 From: Mariappan Ramasamy <142989797+expressvpn-mariappan-r@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:14:48 +0800 Subject: [PATCH 1/2] Add cargo deny to audit licenses of dependencies - 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 --- .github/workflows/ci.yaml | 7 ++++ .github/workflows/nightly-cargo-deny.yaml | 12 ++++++ Earthfile | 5 +++ deny.toml | 51 +++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 .github/workflows/nightly-cargo-deny.yaml create mode 100644 deny.toml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 53a5486..b1dcc4c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.github/workflows/nightly-cargo-deny.yaml b/.github/workflows/nightly-cargo-deny.yaml new file mode 100644 index 0000000..c65aa79 --- /dev/null +++ b/.github/workflows/nightly-cargo-deny.yaml @@ -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 diff --git a/Earthfile b/Earthfile index fe11661..23995cc 100644 --- a/Earthfile +++ b/Earthfile @@ -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 diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..98ec7bb --- /dev/null +++ b/deny.toml @@ -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", +] From f8aaa2d6996cf1d67afb0c816d247ed96270fbcb Mon Sep 17 00:00:00 2001 From: Mariappan Ramasamy <142989797+expressvpn-mariappan-r@users.noreply.github.com> Date: Thu, 31 Aug 2023 18:05:05 +0800 Subject: [PATCH 2/2] Update outdated test.openquantumsafe.org ca cert --- examples/test_certs/pq-osa-ca.crt | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/test_certs/pq-osa-ca.crt b/examples/test_certs/pq-osa-ca.crt index 9b7d8a1..5d9545a 100644 --- a/examples/test_certs/pq-osa-ca.crt +++ b/examples/test_certs/pq-osa-ca.crt @@ -1,29 +1,29 @@ -----BEGIN CERTIFICATE----- -MIIFCzCCAvOgAwIBAgIUavME2jj8LF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