Closed nazmulidris closed 1 year ago
Hey @nazmulidris have you checked this out yet ? https://embarkstudios.github.io/cargo-deny/index.html
If you look at config in ch-3.1 we can set based on our requirement
[licenses]
unlicensed = "deny"
allow-osi-fsf-free = "neither"
copyleft = "deny"
# We want really high confidence when inferring licenses from text
confidence-threshold = 0.93
allow = [
"Apache-2.0",
"Apache-2.0 WITH LLVM-exception",
"MIT",
"MPL-2.0",
"BSD-3-Clause",
"ISC",
]
And we can test this directly. I feel this to be a good alternative to have instead of building entire application to do this. I suggest to include this into the CI using Github Actions https://github.com/EmbarkStudios/cargo-deny-action. Please let me know about this :)
@Harshil-Jani That is a great suggestion ππ½ . I didn't know about that crate. I like the idea of the GitHub Action as well to automate this in CI/CD. That's cool that the GA was written by EmbardStudios. We use crossterm which is written by Timon who works there ππ½
Hii, So I have done the audit locally and below is the script which you can include in deny.toml
in project root. And then run cargo deny check licenses
.
[licenses]
unlicensed = "deny"
allow = [
"MIT",
"Apache-2.0",
]
copyleft = "deny"
This is the generated report based on above configuration
error[rejected]: failed to satisfy license requirements
ββ ansi_colours 1.2.2 (registry+https://github.com/rust-lang/crates.io-index):4:12
β
4 β license = "LGPL-3.0-or-later"
β ^^^^^^^^^^^^^^^^^
β β
β license expression retrieved via Cargo.toml `license`
β rejected: license is considered copyleft
β
= ansi_colours v1.2.2
βββ r3bl_rs_utils_core v0.9.3
β βββ r3bl_redux v0.2.3
β β βββ r3bl_rs_utils v0.9.8
β β βββ r3bl_tui v0.3.4
β β βββ r3bl_rs_utils v0.9.8 (*)
β βββ r3bl_rs_utils v0.9.8 (*)
β βββ r3bl_rs_utils_macro v0.9.3
β β βββ r3bl_redux v0.2.3 (*)
β β βββ r3bl_rs_utils v0.9.8 (*)
β β βββ r3bl_tui v0.3.4 (*)
β βββ r3bl_tui v0.3.4 (*)
βββ r3bl_tui v0.3.4 (*)
error[rejected]: failed to satisfy license requirements
ββ encoding_rs 0.8.33 (registry+https://github.com/rust-lang/crates.io-index):4:13
β
4 β license = "(Apache-2.0 OR MIT) AND BSD-3-Clause"
β -^^^^^^^^^^----^^^------^^^^^^^^^^^^
β ββ β β
β ββ β rejected: not explicitly allowed
β ββ accepted: license is explicitly allowed
β βaccepted: license is explicitly allowed
β license expression retrieved via Cargo.toml `license`
β
= encoding_rs v0.8.33
βββ reqwest v0.11.20
βββ r3bl_rs_utils_core v0.9.3
βββ r3bl_redux v0.2.3
β βββ r3bl_rs_utils v0.9.8
β βββ r3bl_tui v0.3.4
β βββ r3bl_rs_utils v0.9.8 (*)
βββ r3bl_rs_utils v0.9.8 (*)
βββ r3bl_rs_utils_macro v0.9.3
β βββ r3bl_redux v0.2.3 (*)
β βββ r3bl_rs_utils v0.9.8 (*)
β βββ r3bl_tui v0.3.4 (*)
βββ r3bl_tui v0.3.4 (*)
error[rejected]: failed to satisfy license requirements
ββ unicode-ident 1.0.12 (registry+https://github.com/rust-lang/crates.io-index):4:13
β
4 β license = "(MIT OR Apache-2.0) AND Unicode-DFS-2016"
β -^^^----^^^^^^^^^^------^^^^^^^^^^^^^^^^
β ββ β β
β ββ β rejected: not explicitly allowed
β ββ accepted: license is explicitly allowed
β βaccepted: license is explicitly allowed
β license expression retrieved via Cargo.toml `license`
β
= unicode-ident v1.0.12
βββ proc-macro2 v1.0.67
β βββ async-trait v0.1.73
β β βββ r3bl_redux v0.2.3
β β β βββ r3bl_rs_utils v0.9.8
β β β βββ r3bl_tui v0.3.4
β β β βββ r3bl_rs_utils v0.9.8 (*)
β β βββ r3bl_rs_utils v0.9.8 (*)
β β βββ r3bl_rs_utils_core v0.9.3
β β β βββ r3bl_redux v0.2.3 (*)
β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β βββ r3bl_rs_utils_macro v0.9.3
β β β β βββ r3bl_redux v0.2.3 (*)
β β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β β βββ r3bl_tui v0.3.4 (*)
β β β βββ r3bl_tui v0.3.4 (*)
β β βββ r3bl_tui v0.3.4 (*)
β βββ attribute-derive v0.6.1
β β βββ get-size-derive v0.1.3
β β βββ get-size v0.1.4
β β βββ r3bl_redux v0.2.3 (*)
β β βββ r3bl_rs_utils v0.9.8 (*)
β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β βββ r3bl_tui v0.3.4 (*)
β βββ attribute-derive-macro v0.6.1
β β βββ attribute-derive v0.6.1 (*)
β βββ derive-where v1.2.5
β β βββ quote-use-macros v0.7.2
β β βββ quote-use v0.7.2
β β βββ attribute-derive-macro v0.6.1 (*)
β βββ futures-macro v0.3.28
β β βββ futures-util v0.3.28
β β βββ futures v0.3.28
β β β βββ r3bl_redux v0.2.3 (*)
β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β βββ r3bl_tui v0.3.4 (*)
β β βββ futures-executor v0.3.28
β β β βββ futures v0.3.28 (*)
β β βββ h2 v0.3.21
β β β βββ hyper v0.14.27
β β β β βββ hyper-tls v0.5.0
β β β β β βββ reqwest v0.11.20
β β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β βββ reqwest v0.11.20 (*)
β β β βββ reqwest v0.11.20 (*)
β β βββ hyper v0.14.27 (*)
β β βββ r3bl_redux v0.2.3 (*)
β β βββ r3bl_rs_utils v0.9.8 (*)
β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β βββ r3bl_rs_utils_macro v0.9.3 (*)
β β βββ r3bl_tui v0.3.4 (*)
β β βββ reqwest v0.11.20 (*)
β βββ openssl-macros v0.1.1
β β βββ openssl v0.10.57
β β βββ native-tls v0.2.11
β β βββ hyper-tls v0.5.0 (*)
β β βββ reqwest v0.11.20 (*)
β β βββ tokio-native-tls v0.3.1
β β βββ hyper-tls v0.5.0 (*)
β β βββ reqwest v0.11.20 (*)
β βββ palette_derive v0.6.1
β β βββ palette v0.6.1
β β βββ r3bl_tui v0.3.4 (*)
β βββ phf_macros v0.11.2
β β βββ phf v0.11.2
β β βββ palette v0.6.1 (*)
β βββ proc-macro-error v1.0.4
β β βββ attribute-derive-macro v0.6.1 (*)
β βββ proc-macro-error-attr v1.0.4
β β βββ proc-macro-error v1.0.4 (*)
β βββ proc-macro-utils v0.8.0
β β βββ attribute-derive-macro v0.6.1 (*)
β βββ quote v1.0.33
β β βββ async-trait v0.1.73 (*)
β β βββ attribute-derive v0.6.1 (*)
β β βββ attribute-derive-macro v0.6.1 (*)
β β βββ derive-where v1.2.5 (*)
β β βββ futures-macro v0.3.28 (*)
β β βββ get-size-derive v0.1.3 (*)
β β βββ openssl-macros v0.1.1 (*)
β β βββ palette_derive v0.6.1 (*)
β β βββ phf_macros v0.11.2 (*)
β β βββ proc-macro-error v1.0.4 (*)
β β βββ proc-macro-error-attr v1.0.4 (*)
β β βββ proc-macro-utils v0.8.0 (*)
β β βββ quote-use v0.7.2 (*)
β β βββ quote-use-macros v0.7.2 (*)
β β βββ r3bl_rs_utils_macro v0.9.3 (*)
β β βββ serde_derive v1.0.188
β β β βββ serde v1.0.188
β β β βββ bincode v1.3.3
β β β β βββ syntect v5.1.0
β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β βββ r3bl_tui v0.3.4 (*)
β β β βββ crossterm v0.24.0
β β β β βββ reedline v0.16.0
β β β β βββ (dev) r3bl_rs_utils v0.9.8 (*)
β β β β βββ (dev) r3bl_tui v0.3.4 (*)
β β β βββ crossterm v0.26.1
β β β β βββ r3bl_redux v0.2.3 (*)
β β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β βββ r3bl_rs_utils_macro v0.9.3 (*)
β β β β βββ r3bl_tui v0.3.4 (*)
β β β βββ plist v1.5.0
β β β β βββ syntect v5.1.0 (*)
β β β βββ r3bl_redux v0.2.3 (*)
β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β βββ r3bl_tui v0.3.4 (*)
β β β βββ reedline v0.16.0 (*)
β β β βββ reqwest v0.11.20 (*)
β β β βββ serde_json v1.0.107
β β β β βββ r3bl_redux v0.2.3 (*)
β β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β βββ r3bl_tui v0.3.4 (*)
β β β β βββ reqwest v0.11.20 (*)
β β β β βββ syntect v5.1.0 (*)
β β β βββ serde_urlencoded v0.7.1
β β β β βββ reqwest v0.11.20 (*)
β β β βββ syntect v5.1.0 (*)
β β β βββ toml v0.5.11
β β β βββ find-crate v0.6.3
β β β βββ palette_derive v0.6.1 (*)
β β βββ strum_macros v0.24.3
β β β βββ r3bl_tui v0.3.4 (*)
β β β βββ reedline v0.16.0 (*)
β β βββ syn v1.0.109
β β β βββ palette_derive v0.6.1 (*)
β β β βββ proc-macro-error v1.0.4 (*)
β β β βββ r3bl_rs_utils_macro v0.9.3 (*)
β β β βββ strum_macros v0.24.3 (*)
β β βββ syn v2.0.37
β β β βββ async-trait v0.1.73 (*)
β β β βββ attribute-derive v0.6.1 (*)
β β β βββ attribute-derive-macro v0.6.1 (*)
β β β βββ derive-where v1.2.5 (*)
β β β βββ futures-macro v0.3.28 (*)
β β β βββ get-size-derive v0.1.3 (*)
β β β βββ openssl-macros v0.1.1 (*)
β β β βββ phf_macros v0.11.2 (*)
β β β βββ quote-use v0.7.2 (*)
β β β βββ quote-use-macros v0.7.2 (*)
β β β βββ serde_derive v1.0.188 (*)
β β β βββ thiserror-impl v1.0.49
β β β β βββ thiserror v1.0.49
β β β β βββ reedline v0.16.0 (*)
β β β β βββ syntect v5.1.0 (*)
β β β βββ tokio-macros v2.1.0
β β β β βββ tokio v1.32.0
β β β β βββ h2 v0.3.21 (*)
β β β β βββ hyper v0.14.27 (*)
β β β β βββ hyper-tls v0.5.0 (*)
β β β β βββ r3bl_redux v0.2.3 (*)
β β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β βββ r3bl_tui v0.3.4 (*)
β β β β βββ reqwest v0.11.20 (*)
β β β β βββ tokio-native-tls v0.3.1 (*)
β β β β βββ tokio-util v0.7.9
β β β β βββ h2 v0.3.21 (*)
β β β βββ wasm-bindgen-backend v0.2.87
β β β β βββ wasm-bindgen-macro-support v0.2.87
β β β β βββ wasm-bindgen-macro v0.2.87
β β β β βββ wasm-bindgen v0.2.87
β β β β βββ chrono v0.4.31
β β β β β βββ r3bl_redux v0.2.3 (*)
β β β β β βββ r3bl_rs_utils v0.9.8 (*)
β β β β β βββ r3bl_rs_utils_core v0.9.3 (*)
β β β β β βββ r3bl_tui v0.3.4 (*)
β β β β β βββ reedline v0.16.0 (*)
β β β β βββ iana-time-zone v0.1.57
β β β β β βββ chrono v0.4.31 (*)
β β β β βββ js-sys v0.3.64
β β β β β βββ chrono v0.4.31 (*)
β β β β β βββ iana-time-zone v0.1.57 (*)
β β β β β βββ reqwest v0.11.20 (*)
β β β β β βββ wasm-bindgen-futures v0.4.37
β β β β β β βββ reqwest v0.11.20 (*)
β β β β β βββ web-sys v0.3.64
β β β β β βββ reqwest v0.11.20 (*)
β β β β β βββ wasm-bindgen-futures v0.4.37 (*)
β β β β βββ reqwest v0.11.20 (*)
β β β β βββ wasm-bindgen-futures v0.4.37 (*)
β β β β βββ web-sys v0.3.64 (*)
β β β βββ wasm-bindgen-macro-support v0.2.87 (*)
β β βββ thiserror-impl v1.0.49 (*)
β β βββ tokio-macros v2.1.0 (*)
β β βββ vte_generate_state_changes v0.1.1
β β β βββ vte v0.10.1
β β β βββ strip-ansi-escapes v0.1.1
β β β βββ reedline v0.16.0 (*)
β β βββ wasm-bindgen-backend v0.2.87 (*)
β β βββ wasm-bindgen-macro v0.2.87 (*)
β β βββ wasm-bindgen-macro-support v0.2.87 (*)
β βββ quote-use-macros v0.7.2 (*)
β βββ r3bl_rs_utils_macro v0.9.3 (*)
β βββ serde_derive v1.0.188 (*)
β βββ strum_macros v0.24.3 (*)
β βββ syn v1.0.109 (*)
β βββ syn v2.0.37 (*)
β βββ thiserror-impl v1.0.49 (*)
β βββ tokio-macros v2.1.0 (*)
β βββ vte_generate_state_changes v0.1.1 (*)
β βββ wasm-bindgen-backend v0.2.87 (*)
β βββ wasm-bindgen-macro-support v0.2.87 (*)
βββ syn v1.0.109 (*)
βββ syn v2.0.37 (*)
licenses FAILED
@Harshil-Jani Thank you for running this audit. I am taking a look at the crates that were flagged. Also did you want to make a PR w/ these changes into the repo? It is hacktoberfest, and you could get credit for it? Also if you would like to chat about the PR, here is our discord server: https://discord.gg/UejyhKfx
@Harshil-Jani I did a little more digging from the generated report that you shared in an earlier comment.
[x] ansi_colours
crate has to be dropped & replaced with this.
[x] This license audit step has to be added to the ci/cd work that we have planned as well.
[x] reqwest
might need to be dropped as well. I don't know why it is a dependency of r3bl_rs_utils_core
in the first place π€ .
[x] I think it is safe to add an exception
for two crates (unicode-indent
, encoding_rs
) using (Unicode-DFS-2016
, BSD-3-Clause
) to deny.toml
:
[licenses]
unlicensed = "deny"
allow = ["MIT", "Apache-2.0"]
copyleft = "deny"
# https://github.com/EmbarkStudios/cargo-deny/blob/main/examples/01_allow_license/deny.toml
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html?highlight=exception#the-exceptions-field-optional
# https://docs.rs/cargo-deny/latest/cargo_deny/licenses/cfg/struct.Exception.html
exceptions = [
{
name = "unicode-ident",
allow = ["Unicode-DFS-2016"]
},
{
name = "encoding_rs",
allow = ["BSD-3-Clause"]
}
]
Note - I haven't tried to run this yet π
SPDX identifiers are short text strings that uniquely identify a software license. SPDX identifiers are used to communicate license information in a standardized and machine-readable format. SPDX identifiers are part of the Software Package Data Exchange (SPDX) standard, which is an open standard for communicating software bill of materials (SBOM) information including components, licenses, copyrights, and security references.
Also I found the mdbook for this crate here: https://embarkstudios.github.io/cargo-deny/
exception
field in deny.toml
The exception
field in the cargo-deny
crate is a way to allow one or more licenses to be permitted only for a particular crate. It is a part of the cfg
module in the licenses
module of the cargo-deny
crate.
The exception
field has three fields: name
, version
, and allow
. The name
field specifies the name of the crate to apply the exception to. The version
field is an optional version constraint for the crate, which defaults to any version. The allow
field is a list of one or more SPDX identifiers that are allowed only for this crate.
Example: https://github.com/EmbarkStudios/cargo-deny/blob/main/examples/01_allow_license/deny.toml
@Harshil-Jani Also we have a discord server if you want to chat about this issue over there: https://discord.com/invite/UejyhKfx
Also did you want to make a PR w/ these changes into the repo?
Sure, I would love to contribute in the project.
Looking forward towards doing all the changes suggested by you above π .
@Harshil-Jani I am assigning this issue to you π And I will work on generating new issues for each of the Action item checkboxes in one of the comments above. And I will clean up this issue and other existing issues as well (update cross links, etc) ππ½
Use of
r3bl_ansi_color
crate and stop usingansi-colours
crate.Make sure to remove all dependencies that don't use MIT or Apache (ie, that use any kind of copyleft license), eg:
ansi-colours
, maybelolcat
?We should look at all the crates we have as dependencies and remove the ones that have incompatible licenses to ours (Apache2.0), such as any copyleft type license.
More info
Related issues: