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

Add cargo deny to audit licenses of dependencies #40

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

expressvpn-mariappan-r
Copy link
Collaborator

@expressvpn-mariappan-r expressvpn-mariappan-r commented Aug 30, 2023

Description

  • 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
  • Updated CA cert for openquantumsafe test site which is used in example

Motivation and Context

Auditing workspace (and its dependency graph) for security issues, licensing and other issues using cargo-deny

How Has This Been Tested?

Verified cargo deny sources licenses running successfully locally

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • All active GitHub checks are passing
  • The correct base branch is being used, if not main

@CLAassistant
Copy link

CLAassistant commented Aug 30, 2023

CLA assistant check
All committers have signed the CLA.

deny.toml Outdated Show resolved Hide resolved
@expressvpn-mariappan-r expressvpn-mariappan-r changed the title [LIT-37] Add cargo deny to audit licenses of dependencies Add cargo deny to audit licenses of dependencies Aug 30, 2023
@expressvpn-ian-c
Copy link
Contributor

https://github.com/expressvpn/wolfssl-sys/actions/runs/6021857682/job/16335468877?pr=40 failed but CI shows passed -- I guess we need to propagate an error code or something?

.github/workflows/nightly-cargo-deny.yaml Outdated Show resolved Hide resolved
deny.toml Outdated Show resolved Hide resolved
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
allow-git = [
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add the liboqs repo here -- or maybe we can switch back to the released version now that 0.8.0 is out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes makes sense to update the deps since its released last week.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should switch back to using the crate now that it has been released. This is on my todo list for this week, but if you're already working in this area, feel free to make the change 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It became chicken and egg problem when I tried to upgrade liboqs to 0.8.0

Issue:

The latest version of wolfssl v5.6.3 was released on June 21:
https://github.com/wolfSSL/wolfssl/releases/tag/v5.6.3-stable

But liboqs renamed some of its api's on May 17 in this pr:
open-quantum-safe/liboqs#1467

and released v0.8.0 on Aug 21

WolfSSL updated its api to accomodate the above rename in this pr only on July 12:

But it is not yet released.

So if we have to move liboqs to crates version, either we have to patch the wolfssl in build script or use the master version of wolfssl. Think we can take this up in future pr

@expressvpn-mariappan-r
Copy link
Collaborator Author

https://github.com/expressvpn/wolfssl-sys/actions/runs/6021857682/job/16335468877?pr=40 failed but CI shows passed -- I guess we need to propagate an error code or something?

This is actually a warning and cargo-deny ran successfully. That's why GA run succeeded.

But the run actually getting succeeding for me without any warnings locally (typical works for me scenario)
Checking why there is difference between mine and github environment

@expressvpn expressvpn deleted a comment from xv-ian-c Aug 30, 2023
@expressvpn-ian-c
Copy link
Contributor

This is actually a warning and cargo-deny ran successfully.

Oh, I missed that.

I think we should consider making most of these things actual errors, a warning hidden in a passing CI job noone will ever notice.

But the run actually getting succeeding for me without any warnings locally (typical works for me scenario)
Checking why there is difference between mine and github environment

cargo deny fetch or cargo install -f cargo-deny are my usual "fix" when this sort of thing happens, CI naturally gets the very latest of everything.

@expressvpn-mariappan-r
Copy link
Collaborator Author

Found the issue, the github run uses --all-features which i was not adding when running locally:

❯ cargo deny check license sources bans
bans ok, licenses ok, sources ok
❯ cargo deny --all-features check license sources bans
error[source-not-allowed]: detected 'git' source not explicitly allowed
   ┌─ /home/maari/work/expressvpn/wolfssl-sys/Cargo.lock:22:15
   │
22 │ oqs-sys 0.7.2 git+https://github.com/open-quantum-safe/liboqs-rust?rev=10c540350d86fa71110b325f4883f421cb326970#10c540350d86fa71110b325f4883f421cb326970
   │               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source
   │
   = oqs-sys v0.7.2
     └── wolfssl-sys v0.1.15

bans ok, licenses ok, sources FAILED
❯ 

- 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
@expressvpn-mariappan-r expressvpn-mariappan-r merged commit a8164c6 into main Aug 31, 2023
4 checks passed
@expressvpn-ian-c expressvpn-ian-c deleted the lit-37-add-cargo-deny branch August 31, 2023 10:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants