Skip to content

F-017: ci: add cargo-deny license/advisory enforcement#20

Open
Sephyi wants to merge 1 commit intodevelopmentfrom
audit/f-017-cargo-deny-ci
Open

F-017: ci: add cargo-deny license/advisory enforcement#20
Sephyi wants to merge 1 commit intodevelopmentfrom
audit/f-017-cargo-deny-ci

Conversation

@Sephyi
Copy link
Copy Markdown
Owner

@Sephyi Sephyi commented Apr 22, 2026

Summary

ci: add cargo-deny license/advisory enforcement.

Audit context

Closes audit entry F-017 from #3.

Verification

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-targets

Note: one pre-existing test porcelain_exits_within_timeout_with_no_staged_changes is a known macOS cold-start flake that reproduces on unmodified development — unrelated to this change.

PRD SR-005 requires cargo-deny for license, advisory, and source
enforcement across the dependency graph. Previously only cargo audit
ran, leaving license compatibility and unknown-registry risk unchecked.

Add a root deny.toml with:
- licenses: curated allow-list (MIT, Apache-2.0, BSD variants, ISC,
  Unicode-3.0, Zlib, CC0-1.0, MPL-2.0, BSL-1.0) plus an explicit
  exception for the root crate's AGPL-3.0-only OR LicenseRef-Commercial
  dual license. version = 2 disables the legacy copyleft behaviour.
- advisories: yanked = "deny", empty ignore list, version = 2.
- sources: deny unknown-registry and unknown-git; allow only
  crates.io-index.
- bans: multiple-versions = "warn" (too noisy to fail on today given
  the gix and toml trees), wildcards = "deny".
- graph.targets: all Tier-1 hosts so platform-gated deps
  (security-framework on macOS, winapi on Windows) are evaluated.

Wire a new "Cargo Deny" CI job via EmbarkStudios/cargo-deny-action@v2
running "cargo deny check --all-features". Kept as a standalone job to
minimise conflicts with other in-flight ci.yml edits.

Verified locally: cargo-deny 0.19.0 reports
"advisories ok, bans ok, licenses ok, sources ok" with only expected
duplicate-version warnings.

Closes audit entry F-017 from #3.
Copilot AI review requested due to automatic review settings April 22, 2026 19:50
@Sephyi Sephyi added the audit Codebase audit cleanup (issue #3) label Apr 22, 2026
@Sephyi Sephyi self-assigned this Apr 22, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cargo-deny policy enforcement to CI to cover license/advisory/source compliance (audit finding F-017 / PRD SR-005).

Changes:

  • Introduce deny.toml to define cargo-deny policy (targets, advisories, licenses, sources).
  • Add a new GitHub Actions CI job to run cargo deny check on PRs/branches.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
deny.toml New cargo-deny configuration for advisories, license allowlist/exception, and source restrictions.
.github/workflows/ci.yml Adds a deny job running EmbarkStudios/cargo-deny-action@v2 to enforce the new policy in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment on lines +118 to +127
deny:
name: Cargo Deny
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
arguments: --all-features
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new deny job doesn’t install the pinned Rust toolchain (env.RUST_TOOLCHAIN) like the other Rust jobs do. This can make cargo-deny run with whatever toolchain happens to be on the runner (or fail if cargo isn’t available), reducing reproducibility vs the rest of CI. Add the same dtolnay/rust-toolchain@master step (and optionally Swatinem/rust-cache@v2) before running cargo-deny.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit Codebase audit cleanup (issue #3)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants