-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add cargo-deny + dependency-review + commitlint workflows #31
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "extends": ["@commitlint/config-conventional"], | ||
| "rules": { | ||
| "header-max-length": [2, "always", 100], | ||
| "body-max-line-length": [0, "always"], | ||
| "footer-max-line-length": [0, "always"], | ||
| "type-enum": [2, "always", [ | ||
| "build", "chore", "ci", "docs", "feat", "fix", | ||
| "perf", "refactor", "revert", "style", "test" | ||
| ]] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: cargo-deny | ||
|
|
||
| # License + advisory + ban policy enforcement via deny.toml. Runs on PR | ||
| # + push to main + manual dispatch. Mirrors the cargo-deny gate already | ||
| # running on the chain repo (sentrix-labs/sentrix). | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| cargo-deny: | ||
| name: cargo-deny (licenses + advisories + bans) | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | ||
| - uses: EmbarkStudios/cargo-deny-action@6c8f9facfa5047ec02d8485b6bf52b587b7777d1 # v2 | ||
| with: | ||
| command: check | ||
| arguments: --all-features |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: commitlint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| commitlint: | ||
| name: commitlint | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6 | ||
| with: | ||
| configFile: .commitlintrc.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Dependency review | ||
|
|
||
| # Runs GitHub's dependency-review-action on PRs. Diffs the lockfile | ||
| # changes vs the base branch and BLOCKS merge if newly-introduced | ||
| # dependencies have HIGH-severity vulnerabilities OR licenses outside | ||
| # our allowlist. Complements cargo-deny (full-tree post-merge gate) | ||
| # with a pre-merge diff-only gate. | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| dependency-review: | ||
| name: Dependency review | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | ||
|
|
||
| - uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4 | ||
| with: | ||
| fail-on-severity: high | ||
| # Mirror deny.toml [licenses].allow. | ||
| allow-licenses: MIT, Apache-2.0, Apache-2.0 WITH LLVM-exception, BSD-2-Clause, BSD-3-Clause, ISC, MPL-2.0, Unicode-DFS-2016, Unicode-3.0, CC0-1.0, Zlib, 0BSD, BUSL-1.1, CDLA-Permissive-2.0 | ||
| allow-dependencies-licenses: pkg:githubactions/Swatinem/rust-cache | ||
| comment-summary-in-pr: on-failure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # cargo-deny configuration. Loaded by .github/workflows/cargo-deny.yml. | ||
| # See https://embarkstudios.github.io/cargo-deny/ | ||
|
|
||
| [graph] | ||
| all-features = true | ||
|
|
||
| [advisories] | ||
| yanked = "deny" | ||
| ignore = [ | ||
| # `paste` is unmaintained (author archived) but still a transitive dep | ||
| # of alloy / sqlx / prost. No vulnerability — just dormant. Mirrors | ||
| # the ignore in indexer-rs + the chain repo. | ||
| "RUSTSEC-2024-0436", | ||
| # `rustls-pemfile` is deprecated in favour of `rustls-pki-types`; | ||
| # transitive via reqwest -> rustls. No vulnerability. | ||
| "RUSTSEC-2025-0134", | ||
| ] | ||
|
|
||
| [licenses] | ||
| unused-allowed-license = "allow" | ||
| confidence-threshold = 0.8 | ||
| allow = [ | ||
| "MIT", | ||
| "Apache-2.0", | ||
| "Apache-2.0 WITH LLVM-exception", | ||
| "BSD-2-Clause", | ||
| "BSD-3-Clause", | ||
| "ISC", | ||
| "MPL-2.0", | ||
| "Unicode-DFS-2016", | ||
| "Unicode-3.0", | ||
| "CC0-1.0", | ||
| "Zlib", | ||
| "0BSD", | ||
| "BUSL-1.1", | ||
| # webpki-roots v1.x: CDLA-Permissive-2.0 (transitive via reqwest -> rustls). | ||
| "CDLA-Permissive-2.0", | ||
| # Boost Software License — permissive OSI-approved, transitive via | ||
| # xxhash-rust used by leptos's hashing layer. | ||
| "BSL-1.0", | ||
| ] | ||
|
|
||
| [bans] | ||
| # Multiple major versions tolerated for now (leptos + alloy ecosystems | ||
| # regularly need two majors during migration). Tighten later if a | ||
| # specific crate becomes the problem. | ||
| multiple-versions = "warn" | ||
| wildcards = "warn" | ||
| allow-wildcard-paths = true | ||
| highlight = "all" | ||
|
|
||
| [sources] | ||
| unknown-registry = "deny" | ||
| unknown-git = "deny" | ||
| allow-git = [] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 88
🏁 Script executed:
# Check the full deny.toml file to understand structure cat deny.tomlRepository: Sentriscloud/sentrix-explorer-v2
Length of output: 1551
🌐 Web query:
cargo-deny per-crate license exceptions allow💡 Result:
cargo-deny does support per-crate license exceptions, and they’re configured under the [licenses] section via an exceptions array using crate selectors (PackageSpecs) so you can allow additional licenses for specific crates only (instead of allowing that license globally across the whole dependency graph). [1] Example (deny.toml or project exceptions file): exceptions = [ # This exception applies only to the specified crate (and optional version constraints) { crate = "inferno", allow = ["CDDL-1.0"] }, ] This is explicitly described as: the exceptions field “is meant to allow additional licenses only for particular crates” and uses PackageSpecs to select “the crate the exception applies to.” [1] Notes that matter for “allow”: - The general [licenses] allow list applies to the entire crate graph, meaning any license you allow there becomes permitted for any crate that matches the license checker (including crates that may introduce that license later). [1] - The exceptions mechanism exists to make those additional allowances more selective and avoid implicitly allowing licenses in future/unrelated dependency paths. [1]
Citations:
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 102
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 134
🏁 Script executed:
# Check if there's a Cargo.lock file to see which crates use BUSL-1.1 head -100 Cargo.lockRepository: Sentriscloud/sentrix-explorer-v2
Length of output: 2650
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 58
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 58
🏁 Script executed:
# Check if there are actual crates with BUSL-1.1 in the lock file wc -l Cargo.lockRepository: Sentriscloud/sentrix-explorer-v2
Length of output: 92
🏁 Script executed:
Repository: Sentriscloud/sentrix-explorer-v2
Length of output: 416
🌐 Web query:
cargo-deny project own license vs dependencies BUSL-1.1💡 Result:
cargo-deny checks licenses for all crates in the dependency graph (dependencies and transitive deps), but does not check the project's own license specified in its Cargo.toml[1][2]. The licenses check (
cargo deny check licenses) evaluates every crate's license expression against the deny.toml configuration to ensure acceptable terms[1][2][3]. BUSL-1.1 (Business Source License 1.1) is a valid SPDX identifier[4]. It is not OSI-approved or FSF Free/Libre[4][5], so with defaultallow-osi-fsf-free = "neither"and no explicit allow/deny, it falls todefault = "deny"(implicitly rejected)[1][6][3][7]. To allow BUSL-1.1 in dependencies: - Add"BUSL-1.1"to[licenses].allow(allows everywhere)[3]. - Or use per-crate exceptions:exceptions = [ { allow = ["BUSL-1.1"], crate = "specific-crate" } ][8][9][3]. Examples: - wasmer-upstream allows BUSL-1.1 for specific crates like wasmer-compiler-singlepass[8]. - vouch-sh uses exception for its own vouch-server crate under BUSL-1.1 and clarifies the license file[9]. The project's own license is irrelevant to cargo-deny's licenses check; configure policies based on what deps are acceptable regardless of your project's license[10].Citations:
Move
BUSL-1.1from globalallowlist to a crate-specific exception.BUSL-1.1is restrictive and non-OSI-approved. Keeping it globally allowlisted means any future BUSL-1.1 dependency automatically passes without review. Use cargo-deny'sexceptionsmechanism instead to scope this to specific crates only:Example
This follows the pattern used by other projects (wasmer, vouch) for restrictive licenses and ensures each BUSL-1.1 dependency receives explicit evaluation.
🤖 Prompt for AI Agents
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.
Skip — same forward-compat reasoning as sister comments on sdk-rs#22 + sentrix-grpc-wasm#16. Sentrix Chain workspace crates are all BUSL-1.1; if explorer-v2 ever adds a path-dep on a chain crate (currently only depends on sentrix-proto v0.1.1 from crates.io which is BUSL-1.1 already in tree) the allowlist needs BUSL-1.1. Acknowledging the per-crate exceptions mechanism would be more precise — defer until the dep tree stabilises post-migration.
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.
@satyakwok, understood — the globalBUSL-1.1allowlist is intentional given that Sentrix Chain workspace crates are all BUSL-1.1 andsentrix-proto v0.1.1(already in tree) carries that license. Deferring the migration to per-crateexceptionsuntil the dep tree stabilises post-migration makes sense. I'll note this context to avoid re-raising it in future reviews.(ᵔᴥᵔ)
✏️ Learnings added