# cargo-deny configuration for dependency management and security

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

[advisories]
# The path where the advisory database is cloned/fetched into
db-path = "~/.cargo/advisory-db"
# The url(s) of the advisory databases to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "deny"
# The lint level for unmaintained crates
unmaintained = "warn"
# The lint level for crates that have been yanked from their source registry
yanked = "warn"
# The lint level for crates with security notices
notice = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
    #"RUSTSEC-0000-0000",
]

[licenses]
# The confidence threshold for detecting a license from a license text.
confidence-threshold = 0.8
# List of explicitly allowed licenses
allow = [
    "MIT",
    "Apache-2.0",
    "Apache-2.0 WITH LLVM-exception",
    "BSD-2-Clause",
    "BSD-3-Clause",
    "ISC",
    "Unicode-DFS-2016",
]
# List of explicitly disallowed licenses
deny = [
    "GPL-2.0",
    "GPL-3.0",
    "AGPL-3.0",
]
# Lint level for when multiple versions of the same license are detected
copyleft = "warn"
# Some crates don't have license files and we allow them specifically
exceptions = [
    # Allow ring which has some complex licensing
    { allow = ["MIT", "ISC", "OpenSSL"], name = "ring" },
    # webpki has Mozilla's license
    { allow = ["ISC", "MIT", "MPL-2.0"], name = "webpki" },
]

[[licenses.clarify]]
name = "ring"
# SPDX identifier
expression = "MIT AND ISC AND OpenSSL"
# License file paths
license-files = [
    { path = "LICENSE", hash = 0xbd0eed23 }
]

[bans]
# Lint level for when multiple versions of the same crate are detected
multiple-versions = "warn"
# Lint level for when a crate version requirement is `*`
wildcards = "allow"
# The graph highlighting used when creating dotgraphs for crates
highlight = "all"
# List of crates that are allowed. Use with care!
allow = [
    #{ name = "ansi_term", version = "=0.11.0" },
]
# List of crates to deny
deny = [
    # Insecure random number generation
    { name = "openssl", version = "*", use-instead = "rustls" },
    # Unmaintained and insecure
    { name = "chrono", version = "<0.4.20" },
]
# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
    #{ name = "ansi_term", version = "=0.11.0" },
]
# Similarly to `skip` allows you to skip certain crates from being checked. Unlike
# `skip`, a skipped crate is removed from the crate graph entirely.
skip-tree = [
    #{ name = "ansi_term", version = "=0.11.0", depth = 20 },
]

[sources]
# Lint level for what to happen when a crate from a crate registry that is
# not in the allow list is encountered
unknown-registry = "warn"
# Lint level for what to happen when a crate from a git repository that is not
# in the allow list is encountered
unknown-git = "warn"
# List of URLs for allowed crate registries. Defaults to the crates.io index
# if not specified. If it is specified but empty, no registries are allowed.
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# List of URLs for allowed Git repositories
allow-git = []