# cargo-deny configuration
# https://embarkstudios.github.io/cargo-deny/

[graph]
targets = [
    { triple = "x86_64-unknown-linux-gnu" },
    { triple = "aarch64-unknown-linux-gnu" },
    { triple = "x86_64-unknown-linux-musl" },
    { triple = "x86_64-apple-darwin" },
    { triple = "aarch64-apple-darwin" },
]

# ---- Advisories ---------------------------------------------------------------

[advisories]
version = 2
# Deny crates whose versions have been yanked from the registry.
yanked = "deny"
# Scope of the unmaintained check: audit all transitive deps.
unmaintained = "all"
# Targeted ignores. Each entry MUST cite the upstream blocker so we
# revisit when it moves. Re-audit quarterly: drop anything whose
# upstream has shipped a fix.
ignore = [
    # syntect's transitive deps. Both are flagged unmaintained but
    # there's no safe upgrade — syntect 5.x still depends on the
    # old majors. Replacing syntect would be a multi-day refactor
    # of the markdown code-block highlighter; not justified for an
    # unmaintained-but-functional advisory. Revisit when syntect
    # ships a release that drops these:
    #   https://github.com/trishume/syntect/issues
    "RUSTSEC-2025-0141", # bincode 1.3.3 unmaintained (via syntect) — dev ceased upstream
    "RUSTSEC-2024-0320", # yaml-rust 0.4.5 unmaintained (via syntect)
]

# ---- Licenses -----------------------------------------------------------------

[licenses]
version = 2
# Crates not matching any of these licenses fail the build.
allow = [
    "MIT",
    "Apache-2.0",
    "Apache-2.0 WITH LLVM-exception",
    "BSD-2-Clause",
    "BSD-3-Clause",
    "ISC",
    "Unicode-DFS-2016",
    "Unicode-3.0",
    "Zlib",
    "CC0-1.0",
    "MPL-2.0",
]
# Require at least 80% confidence when SPDX-matching a license file.
confidence-threshold = 0.8

# ---- Bans ---------------------------------------------------------------------

[bans]
# Warn if multiple versions of the same crate end up in the graph.
multiple-versions = "warn"
# Wildcards in Cargo.toml are a red flag.
wildcards = "deny"
# Highlight the worst offender when a feature pulls extra deps.
highlight = "all"

deny = [
    # Prefer rustls; openssl-sys pulls in a large C dependency.
    { name = "openssl-sys", reason = "use rustls instead of openssl" },
    { name = "openssl", reason = "use rustls instead of openssl" },
    { name = "native-tls", reason = "use rustls instead of native-tls" },
]

skip = []
skip-tree = []

# ---- Sources ------------------------------------------------------------------

[sources]
# Only allow crates.io as a registry source.
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
allow-git = []
