Skip to content

Commit 0146381

Browse files
committed
Add licensing check for Rust code
If we add new rust dependencies we should now be alerted when a new license type is added.
1 parent 88b3648 commit 0146381

File tree

17 files changed

+113
-1
lines changed

17 files changed

+113
-1
lines changed

.github/workflows/rust.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,22 @@ jobs:
5353
- name: Typo Check
5454
uses: crate-ci/[email protected]
5555
with:
56-
files: ./rust
56+
files: ./rust
57+
58+
# Check licensing and produce a list of licenses
59+
licensing:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Install cargo-about
64+
uses: baptiste0928/cargo-install@v3
65+
with:
66+
crate: cargo-about
67+
version: "0.6.6"
68+
- name: Run license check
69+
run: cargo about generate about.hbs > license.html
70+
- name: Archive license file
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: license
74+
path: license.html

about.hbs

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<html>
2+
3+
<head>
4+
<style>
5+
@media (prefers-color-scheme: dark) {
6+
body {
7+
background: #333;
8+
color: white;
9+
}
10+
a {
11+
color: skyblue;
12+
}
13+
}
14+
.container {
15+
font-family: sans-serif;
16+
max-width: 800px;
17+
margin: 0 auto;
18+
}
19+
.intro {
20+
text-align: center;
21+
}
22+
.licenses-list {
23+
list-style-type: none;
24+
margin: 0;
25+
padding: 0;
26+
}
27+
.license-used-by {
28+
margin-top: -10px;
29+
}
30+
.license-text {
31+
max-height: 200px;
32+
overflow-y: scroll;
33+
white-space: pre-wrap;
34+
}
35+
</style>
36+
</head>
37+
38+
<body>
39+
<main class="container">
40+
<div class="intro">
41+
<h1>Third Party Licenses</h1>
42+
<p>This page lists the licenses of the **rust** projects used in binaryninja-api.</p>
43+
</div>
44+
45+
<h2>Overview of licenses:</h2>
46+
<ul class="licenses-overview">
47+
{{#each overview}}
48+
<li><a href="#{{id}}">{{name}}</a> ({{count}})</li>
49+
{{/each}}
50+
</ul>
51+
52+
<h2>All license text:</h2>
53+
<ul class="licenses-list">
54+
{{#each licenses}}
55+
<li class="license">
56+
<h3 id="{{id}}">{{name}}</h3>
57+
<h4>Used by:</h4>
58+
<ul class="license-used-by">
59+
{{#each used_by}}
60+
<li><a href="{{#if crate.repository}} {{crate.repository}} {{else}} https://crates.io/crates/{{crate.name}} {{/if}}">{{crate.name}} {{crate.version}}</a></li>
61+
{{/each}}
62+
</ul>
63+
<pre class="license-text">{{text}}</pre>
64+
</li>
65+
{{/each}}
66+
</ul>
67+
</main>
68+
</body>
69+
70+
</html>

about.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
accepted = [
2+
"Apache-2.0",
3+
"MIT",
4+
"Unicode-DFS-2016",
5+
"Unicode-3.0",
6+
"ISC",
7+
"BSD-3-Clause",
8+
"BSL-1.0",
9+
"LicenseRef-scancode-google-patent-license-fuchsia"
10+
]

arch/msp430/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "arch_msp430"
33
version = "0.1.0"
44
authors = ["jrozner"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

arch/riscv/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "arch_riscv"
33
version = "0.1.0"
44
authors = ["Ryan Snyder <[email protected]>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

arch/riscv/disasm/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "riscv-dis"
33
version = "0.1.0"
44
authors = ["Ryan Snyder <[email protected]>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
byteorder = "1"

plugins/dwarf/dwarf_export/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "dwarf_export"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

plugins/dwarf/dwarf_import/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "dwarf_import"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

plugins/dwarf/dwarfdump/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "dwarfdump"
33
version = "0.1.0"
44
authors = ["Kyle Martin <[email protected]>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[lib]
89
crate-type = ["cdylib"]

plugins/dwarf/shared/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "dwarfreader"
33
version = "0.1.0"
44
authors = ["Kyle Martin <[email protected]>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[dependencies]
89
binaryninja.workspace = true

plugins/idb_import/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "idb_import"
33
version = "0.1.0"
44
authors = ["Rubens Brandao <[email protected]>"]
55
edition = "2021"
6+
license = "Apache-2.0"
67

78
[lib]
89
crate-type = ["cdylib"]

plugins/pdb-ng/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "pdb-import-plugin"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

plugins/pdb-ng/demo/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "pdb-import-plugin-static"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["staticlib"]

plugins/warp/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "warp_ninja"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["lib", "cdylib"]

rust/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "0.1.0"
44
authors = ["Ryan Snyder <[email protected]>", "Kyle Martin <[email protected]>"]
55
edition = "2021"
66
rust-version = "1.83.0"
7+
license = "Apache-2.0"
78

89
[features]
910
# This is used when statically linking to prevent exporting CorePluginABIVersion and UiPluginABIVersion.

rust/binaryninjacore-sys/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ authors = ["Ryan Snyder <[email protected]>", "Kyle Martin <[email protected]>"]
55
build = "build.rs"
66
edition = "2021"
77
links = "binaryninjacore"
8+
license = "Apache-2.0"
89

910
[build-dependencies]
1011
bindgen = "0.71.1"

view/minidump/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "minidump_bn"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "Apache-2.0"
56

67
[lib]
78
crate-type = ["cdylib"]

0 commit comments

Comments
 (0)