Skip to content

Commit df6ed37

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 df6ed37

3 files changed

Lines changed: 96 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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122

123123
checks = forAllSystems (system: let
124124
pkgs = pkgsFor system;
125+
craneLib = crane.mkLib pkgs;
125126

126127
callTest = path: pkgs.callPackage path {inherit self;};
127128
nixosModuleAgentPackage = pkgs.callPackage ./nix/package.nix {crate = "circus-agent";};
@@ -153,6 +154,25 @@
153154
paths = builtins.attrValues vmTests;
154155
};
155156

157+
cargo-deny = craneLib.cargoDeny {
158+
pname = "circus-audit";
159+
src = let
160+
fs = lib.fileset;
161+
s = ./.;
162+
in
163+
fs.toSource {
164+
root = s;
165+
fileset = fs.unions [
166+
(s + /crates)
167+
(s + /Cargo.lock)
168+
(s + /Cargo.toml)
169+
(s + /.deny.toml)
170+
];
171+
};
172+
cargoDenyChecks = "bans licenses sources";
173+
cargoExtraArgs = "--locked";
174+
};
175+
156176
formatting =
157177
pkgs.runCommand "circus-formatting-check" {
158178
preferLocal = true;
@@ -188,6 +208,7 @@
188208
glibc.dev
189209

190210
taplo
211+
cargo-deny
191212
cargo-nextest
192213
clippy
193214
rust-analyzer

0 commit comments

Comments
 (0)