Skip to content

Commit 8827bad

Browse files
committed
ci(cargo-deny): add dependency audit with cargo-deny
Add cargo-deny to check dependencies for vulnerabilities, license violations, and banned crates. Runs as a step in branch-checks for PRs and as a separate scheduled workflow for daily advisory scanning. Signed-off-by: Ignas Baranauskas <[email protected]>
1 parent dd2b4e3 commit 8827bad

7 files changed

Lines changed: 166 additions & 1 deletion

File tree

‎.github/workflows/branch-checks.yml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,25 @@ jobs:
7979
- name: Check license headers
8080
run: mise run license:check
8181

82+
cargo-deny:
83+
name: Cargo Deny
84+
needs: pr_metadata
85+
if: needs.pr_metadata.outputs.should_run == 'true'
86+
runs-on: linux-amd64-cpu8
87+
container:
88+
image: ghcr.io/nvidia/openshell/ci:latest
89+
credentials:
90+
username: ${{ github.actor }}
91+
password: ${{ secrets.GITHUB_TOKEN }}
92+
steps:
93+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
94+
95+
- name: Install tools
96+
run: mise install --locked
97+
98+
- name: Check dependencies
99+
run: mise run rust:deny:policy
100+
82101
rust:
83102
name: Rust (${{ matrix.runner }})
84103
needs: pr_metadata

‎.github/workflows/cargo-deny.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Cargo Deny (scheduled)
5+
6+
on:
7+
schedule:
8+
- cron: "23 7 * * *"
9+
workflow_dispatch:
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
15+
permissions:
16+
contents: read
17+
packages: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
cargo-deny:
25+
name: Cargo Deny
26+
runs-on: linux-amd64-cpu8
27+
container:
28+
image: ghcr.io/nvidia/openshell/ci:latest
29+
credentials:
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
steps:
33+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34+
35+
- name: Install tools
36+
run: mise install --locked
37+
38+
- name: Check dependencies
39+
run: mise run rust:deny

‎deny.toml‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# cargo-deny configuration
5+
# https://embarkstudios.github.io/cargo-deny/
6+
7+
[graph]
8+
all-features = false
9+
no-default-features = false
10+
11+
# -- Advisories (RustSec + NVD) ------------------------------------------------
12+
[advisories]
13+
yanked = "warn"
14+
unmaintained = "workspace"
15+
maximum-db-staleness = "P30D"
16+
ignore = [
17+
# Pre-existing advisories acknowledged at onboarding. Each should be
18+
# resolved by upgrading the affected transitive dependency and then
19+
# removing the ignore entry.
20+
{ id = "RUSTSEC-2026-0190", reason = "anyhow unsoundness in downcast_mut — awaiting upstream fix" },
21+
{ id = "RUSTSEC-2026-0204", reason = "crossbeam-epoch pointer deref — transitive via metrics/quanta" },
22+
{ id = "RUSTSEC-2023-0071", reason = "rsa Marvin attack — transitive via spiffe, no direct exposure" },
23+
{ id = "RUSTSEC-2025-0134", reason = "rustls-pemfile unmaintained — transitive via older kube/hyper" },
24+
{ id = "RUSTSEC-2026-0098", reason = "rustls-webpki URI name constraints — transitive via older rustls" },
25+
{ id = "RUSTSEC-2026-0099", reason = "rustls-webpki wildcard name constraints — transitive via older rustls" },
26+
{ id = "RUSTSEC-2026-0104", reason = "rustls-webpki CRL parsing panic — transitive via older rustls" },
27+
{ id = "RUSTSEC-2025-0068", reason = "serde_yml unsound+unmaintained — direct dep, no maintained alternative yet" },
28+
]
29+
30+
# -- Licenses ------------------------------------------------------------------
31+
[licenses]
32+
confidence-threshold = 0.8
33+
unused-allowed-license = "allow"
34+
35+
allow = [
36+
"Apache-2.0",
37+
"Apache-2.0 WITH LLVM-exception",
38+
"MIT",
39+
"MIT-0",
40+
"BSD-1-Clause",
41+
"BSD-2-Clause",
42+
"BSD-3-Clause",
43+
"BSL-1.0",
44+
"ISC",
45+
"Zlib",
46+
"0BSD",
47+
"CC0-1.0",
48+
"Unlicense",
49+
"Unicode-3.0",
50+
"CDLA-Permissive-2.0",
51+
]
52+
53+
[licenses.private]
54+
ignore = true
55+
registries = []
56+
57+
# -- Bans ----------------------------------------------------------------------
58+
[bans]
59+
multiple-versions = "warn"
60+
wildcards = "allow"
61+
highlight = "all"
62+
workspace-default-features = "allow"
63+
external-default-features = "allow"
64+
65+
# -- Sources -------------------------------------------------------------------
66+
[sources]
67+
unknown-registry = "deny"
68+
unknown-git = "deny"
69+
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
70+
allow-git = []

‎mise.lock‎

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎mise.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ skaffold = { version = "2.20.0", os = ["linux", "macos"] }
4040
k3d = { version = "5.8.3", os = ["macos"] }
4141
"github:anchore/syft" = { version = "1.44.0" }
4242
"github:EmbarkStudios/cargo-about" = { version = "0.8.4", version_prefix = "" }
43+
"github:EmbarkStudios/cargo-deny" = { version = "0.20.2", version_prefix = "" }
4344
zig = "0.14.1"
4445
"github:rust-cross/cargo-zigbuild" = "0.22.3"
4546
"npm:markdownlint-cli2" = "0.22.0"

‎tasks/ci.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ hide = true
5656

5757
[ci]
5858
description = "Run full checks (lint, compile/type checks, and tests)"
59-
depends = ["lint", "check", "test", "go:ci"]
59+
depends = ["lint", "check", "test", "go:ci", "rust:deny:policy"]
6060

6161
[all]
6262
description = "Alias for ci"

‎tasks/rust.toml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ run = [
3434
]
3535
hide = true
3636

37+
["rust:deny"]
38+
description = "Check dependencies for all cargo-deny rules"
39+
run = "cargo deny check"
40+
41+
["rust:deny:policy"]
42+
description = "Check dependencies for license violations, bans, and source restrictions"
43+
run = "cargo deny check licenses bans sources"
44+
45+
3746
["rust:verify:telemetry-off"]
3847
description = "Verify telemetry emission code is compiled out with --no-default-features"
3948
run = [

0 commit comments

Comments
 (0)