Skip to content

Commit d8ef4be

Browse files
committed
ci(security): add cargo-audit, cargo-deny, and SBOM generation workflows; add deny.toml
1 parent 9a00281 commit d8ef4be

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/workflows/security.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Security Checks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 3 * * 1'
10+
11+
jobs:
12+
cargo-audit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: dtolnay/rust-toolchain@stable
17+
- name: Generate lockfile
18+
run: cargo generate-lockfile
19+
- name: Audit dependencies (RustSec)
20+
uses: rustsec/audit-check@v2
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
cargo-deny:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: dtolnay/rust-toolchain@stable
29+
- name: Run cargo-deny (advisories, bans, licenses)
30+
uses: EmbarkStudios/cargo-deny-action@v1
31+
32+
sbom:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: CycloneDX (Cargo)
37+
run: |
38+
cargo install cyclonedx-bom --locked
39+
cyclonedx-bom -o sbom-cyclonedx-cargo.json
40+
- name: SBOM (Syft) for repo
41+
uses: anchore/sbom-action@v0
42+
with:
43+
path: .
44+
format: cyclonedx-json
45+
output-file: sbom-cyclonedx-syft.json
46+
- name: Upload SBOMs
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: sboms
50+
path: |
51+
sbom-cyclonedx-cargo.json
52+
sbom-cyclonedx-syft.json
53+

deny.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# cargo-deny configuration (baseline). Adjust as the project evolves.
2+
3+
[advisories]
4+
severity-threshold = "medium"
5+
yanked = "warn"
6+
ignore = []
7+
8+
[licenses]
9+
unlicensed = "deny"
10+
allow = [
11+
"Apache-2.0",
12+
"MIT",
13+
"BSD-3-Clause",
14+
"BSD-2-Clause",
15+
"ISC",
16+
"Unicode-3.0",
17+
]
18+
copyleft = "warn"
19+
confidence-threshold = 0.8
20+
exceptions = []
21+
22+
[bans]
23+
multiple-versions = "warn"
24+
wildcards = "allow"
25+
deny = []
26+
skip = []
27+
allow = []
28+
29+
[sources]
30+
unknown-registry = "warn"
31+
unknown-git = "warn"
32+

0 commit comments

Comments
 (0)