Skip to content

Commit 2d3cc1b

Browse files
committed
meta: set up cargo-deny for dependency audits
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ie08db7030742f7278a1256282586a5526a6a6964
1 parent 00c307d commit 2d3cc1b

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

.deny.toml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[advisories]
2+
ignore = [ ]
3+
4+
[licenses]
5+
allow = [
6+
"0BSD",
7+
"Apache-2.0",
8+
"Apache-2.0 WITH LLVM-exception",
9+
"BSD-1-Clause",
10+
"BSD-2-Clause",
11+
"BSD-3-Clause",
12+
"BSL-1.0",
13+
"CC0-1.0",
14+
"CDLA-Permissive-2.0",
15+
"ISC",
16+
"MIT",
17+
"MIT-0",
18+
"MPL-2.0",
19+
"Unicode-3.0",
20+
"Unlicense",
21+
"Zlib",
22+
]
23+
confidence-threshold = 0.8
24+
25+
exceptions = [
26+
{ allow = [
27+
"EUPL-1.2",
28+
], crate = "evix" },
29+
{ allow = [
30+
"EUPL-1.2",
31+
], crate = "pound" },
32+
{ allow = [
33+
"EUPL-1.2",
34+
], crate = "pound-derive" },
35+
]
36+
37+
[licenses.private]
38+
ignore = false
39+
registries = [ ]
40+
41+
[bans]
42+
allow = [ ]
43+
allow-workspace = true
44+
deny = [ ]
45+
external-default-features = "allow"
46+
highlight = "all"
47+
multiple-versions = "warn"
48+
skip = [ ]
49+
skip-tree = [ ]
50+
wildcards = "deny"
51+
workspace-default-features = "allow"
52+
53+
[sources]
54+
allow-git = [ ]
55+
allow-registry = [ "https://github.com/rust-lang/crates.io-index" ]
56+
unknown-git = "deny"
57+
unknown-registry = "deny"
58+
59+
[sources.allow-org]
60+
bitbucket = [ ]
61+
github = [ ]
62+
gitlab = [ ]

.github/workflows/rust.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ jobs:
3838
- name: Run Clippy
3939
run: nix develop --command cargo clippy --all-targets -- -D warnings
4040

41+
deny:
42+
name: Dependency Audit
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
46+
with:
47+
persist-credentials: false
48+
- uses: cachix/install-nix-action@b97f05dcb019ddea06450a50ef6203d2fdc19fee # v31
49+
- name: Check Dependency Policy
50+
run: nix build .#checks.x86_64-linux.cargo-deny --no-link -L
51+
- name: Audit Dependency Advisories
52+
run: nix develop --command cargo deny check advisories
53+
4154
test:
4255
name: Test
4356
runs-on: ubuntu-latest

flake.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@
122122

123123
checks = forAllSystems (system: let
124124
pkgs = pkgsFor system;
125+
craneLib = crane.mkLib pkgs;
126+
cargoDenySrc = let
127+
fs = lib.fileset;
128+
s = ./.;
129+
in
130+
fs.toSource {
131+
root = s;
132+
fileset = fs.unions [
133+
(s + /crates)
134+
(s + /Cargo.lock)
135+
(s + /Cargo.toml)
136+
(s + /deny.toml)
137+
];
138+
};
125139

126140
callTest = path: pkgs.callPackage path {inherit self;};
127141
nixosModuleAgentPackage = pkgs.callPackage ./nix/package.nix {crate = "circus-agent";};
@@ -153,6 +167,13 @@
153167
paths = builtins.attrValues vmTests;
154168
};
155169

170+
cargo-deny = craneLib.cargoDeny {
171+
pname = "circus";
172+
src = cargoDenySrc;
173+
cargoDenyChecks = "bans licenses sources";
174+
cargoExtraArgs = "--locked";
175+
};
176+
156177
formatting =
157178
pkgs.runCommand "circus-formatting-check" {
158179
preferLocal = true;
@@ -188,6 +209,7 @@
188209
glibc.dev
189210

190211
taplo
212+
cargo-deny
191213
cargo-nextest
192214
clippy
193215
rust-analyzer

0 commit comments

Comments
 (0)