-
Notifications
You must be signed in to change notification settings - Fork 0
Replace cargo audit with cargo deny for CLI dependency policy #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: chunk1/harness
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # cargo-deny policy for the corgea CLI. | ||
| # Run: ./harness deny (CI runs it strict via ./harness ci) | ||
|
|
||
| [advisories] | ||
| version = 2 | ||
| # RustSec DB: fail on vulnerable/unmaintained/unsound/yanked crates. | ||
| # ignore = [] # add "RUSTSEC-YYYY-NNNN" with a justification comment if ever needed | ||
|
|
||
| [licenses] | ||
| version = 2 | ||
| # SPDX ids allowed to ship in the distributed binary. All permissive, | ||
| # plus option-ext's file-level MPL-2.0 (transitive via `dirs`). | ||
| allow = [ | ||
| "MIT", | ||
| "Apache-2.0", | ||
| "Apache-2.0 WITH LLVM-exception", | ||
| "BSD-3-Clause", | ||
| "Unicode-3.0", | ||
| "Unlicense", | ||
| "0BSD", | ||
| "CC0-1.0", | ||
| "MIT-0", | ||
| "Zlib", | ||
| "BSL-1.0", | ||
| "MPL-2.0", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Evidence: lines 11-12 say MPL is being allowed only for |
||
| ] | ||
| # The `corgea` crate's own LICENSE file is LGPL-2.1; it ships only as a binary | ||
| # (never `cargo publish`ed) so it's marked `publish = false` in Cargo.toml, | ||
| # which makes it "private" and exempt from these dep-license rules. | ||
| private = { ignore = true } | ||
| confidence-threshold = 0.9 | ||
|
|
||
| [bans] | ||
| # Duplicate versions are common & low-risk in a 310-crate tree → warn, don't fail. | ||
| multiple-versions = "warn" | ||
| wildcards = "warn" | ||
|
|
||
| [sources] | ||
| # Lock the supply chain to crates.io. Any git / alt-registry dep fails the gate. | ||
| unknown-registry = "deny" | ||
| unknown-git = "deny" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| # Project development tasks. Bash + cargo + git only. | ||
| # Usage: ./harness <command> [--verbose] [--min=N] | ||
| # | ||
| # Commands: check, fix, lint, test, audit, coverage, pre-commit, ci, | ||
| # Commands: check, fix, lint, test, deny, coverage, pre-commit, ci, | ||
| # post-edit, setup-hooks, suppressions | ||
|
|
||
| set -u | ||
|
|
@@ -160,21 +160,21 @@ cmd_test() { | |
| run_with_summary "Tests" 0 -- cargo test | ||
| } | ||
|
|
||
| cmd_audit() { | ||
| _cmd_audit_inner 0 | ||
| cmd_deny() { | ||
| _cmd_deny_inner 0 | ||
| } | ||
|
|
||
| _cmd_audit_inner() { | ||
| _cmd_deny_inner() { | ||
| local strict="$1" | ||
| if cargo audit --version >/dev/null 2>&1; then | ||
| run "Dep audit" 0 -- cargo audit | ||
| if cargo deny --version >/dev/null 2>&1; then | ||
| run "Dep policy" 0 -- cargo deny check | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Evidence: the harness runs |
||
| return | ||
| fi | ||
| if [ "$strict" = "1" ]; then | ||
| printf " %s✗%s Dep audit (cargo-audit not installed)\n" "$RED" "$RESET" | ||
| printf " %s✗%s Dep policy (cargo-deny not installed)\n" "$RED" "$RESET" | ||
| exit 1 | ||
| fi | ||
| printf " %s⊘ Dep audit skipped (install: cargo install cargo-audit)%s\n" "$DIM" "$RESET" | ||
| printf " %s⊘ Dep policy skipped (install: cargo install cargo-deny)%s\n" "$DIM" "$RESET" | ||
| } | ||
|
|
||
| cmd_coverage() { | ||
|
|
@@ -244,7 +244,7 @@ cmd_ci() { | |
| printf "\n%s[ci]%s\n\n" "$BLUE" "$RESET" | ||
| run "Clippy (strict)" 0 -- cargo clippy -- -D warnings | ||
| run "Format check" 0 -- cargo fmt --check | ||
| _cmd_audit_inner 1 | ||
| _cmd_deny_inner 1 | ||
| if ! cargo llvm-cov --version >/dev/null 2>&1; then | ||
| printf " %s✗%s Coverage (cargo-llvm-cov not installed)\n" "$RED" "$RESET" | ||
| printf " %sInstall:%s cargo install cargo-llvm-cov\n" "$DIM" "$RESET" | ||
|
|
@@ -274,7 +274,7 @@ case "$cmd" in | |
| fix) cmd_fix ;; | ||
| lint) cmd_lint ;; | ||
| test) cmd_test ;; | ||
| audit) cmd_audit ;; | ||
| deny) cmd_deny ;; | ||
| coverage) cmd_coverage ;; | ||
| pre-commit) cmd_pre_commit ;; | ||
| ci) cmd_ci ;; | ||
|
|
@@ -283,7 +283,7 @@ case "$cmd" in | |
| suppressions) cmd_suppressions ;; | ||
| -h|--help|help) | ||
| printf "Usage: ./harness <command> [--verbose] [--min=N]\n\n" | ||
| printf "Commands: check, fix, lint, test, audit, coverage, pre-commit,\n" | ||
| printf "Commands: check, fix, lint, test, deny, coverage, pre-commit,\n" | ||
| printf " ci, post-edit, setup-hooks, suppressions\n" | ||
| ;; | ||
| *) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Evidence: this comment says the advisory gate fails on yanked crates, but the new
[advisories]config only setsversion = 2and does not setyanked.cargo-deny's current default for yanked crates iswarn, socargo deny checkwill not fail CI when a yanked crate is present. Impact: the replacement policy is weaker than the stated production gate and can ship a yanked dependency while reporting only a warning. Concrete fix: addyanked = "deny"under[advisories](and keep ignores explicit/reasoned if a yanked crate must be tolerated), or change the stated policy if yanked crates are intentionally non-blocking.