-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add cargo-deny + dependency-review + commitlint workflows #16
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
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,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" | ||
| ]] | ||
| } | ||
| } |
| 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 |
| 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 | ||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # 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 = [] | ||
|
|
||
| [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", | ||
| ] | ||
|
Comment on lines
+27
to
+30
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. 🧩 Analysis chain🏁 Script executed: find . -name "deny.toml" -type fRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 86 🏁 Script executed: cat -n deny.tomlRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 1150 🏁 Script executed: rg "BUSL-1.1|exception" deny.tomlRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 128 🌐 Web query:
💡 Result: License exceptions in cargo-deny are configured in the [licenses] section of deny.toml (or cargo-deny.toml) to allow specific licenses for particular crates without globally permitting them everywhere [1][2]. This prevents implicit allowance of licenses in future dependencies. The exceptions field is an array of tables, each specifying: - crate: the crate name (required) - version: optional version constraint (e.g., "=0.1.1") - allow: array of SPDX license identifiers (e.g., ["Zlib"]) [1] Example: Citations:
🏁 Script executed: fd Cargo.lock && cat Cargo.lock | grep -A 5 -B 5 "BUSL\|Business"Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 85 🏁 Script executed: git ls-files | head -20Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 516 🏁 Script executed: cat Cargo.lock | head -100Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 3000 🏁 Script executed: rg "license.*BUSL\|BUSL.*license" --type json --type yaml --type tomlRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 56 🏁 Script executed: grep -i "busl" Cargo.lockRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 56 🏁 Script executed: grep -i "busl" Cargo.tomlRepository: Sentriscloud/sentrix-grpc-wasm Length of output: 56 🏁 Script executed: git log --oneline -- deny.toml | head -20Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 147 🏁 Script executed: git show HEAD:deny.toml | grep -A 2 -B 2 "BUSL"Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 222 🏁 Script executed: git show 5cce607:deny.toml | head -40Repository: Sentriscloud/sentrix-grpc-wasm Length of output: 848 Move Line 27 globally allows [[licenses.exceptions]]
name = "crate-name"
allow = ["BUSL-1.1"]Note: 🤖 Prompt for AI Agents
Member
Author
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. Skip — same forward-compat reasoning as sister comments on sdk-rs#22 + sentrix-explorer-v2#31. Sentrix Chain workspace crates are all BUSL-1.1; sentrix-grpc-wasm consumes sentrix-proto from crates.io which IS BUSL-1.1. Per-crate exceptions would be cleaner but the maintenance overhead (one entry per BUSL crate, each needing version-pin) outweighs the precision. Re-evaluate at 1.0 stabilisation. 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.
( ˘•ω•˘ ) 🐇 ✏️ Learnings added
|
||
|
|
||
| [bans] | ||
| multiple-versions = "warn" | ||
| wildcards = "warn" | ||
| allow-wildcard-paths = true | ||
| highlight = "all" | ||
|
|
||
| [sources] | ||
| unknown-registry = "deny" | ||
| unknown-git = "deny" | ||
| allow-git = [] | ||
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-grpc-wasm
Length of output: 277
🏁 Script executed:
Repository: Sentriscloud/sentrix-grpc-wasm
Length of output: 438
Update wagoid/commitlint-github-action SHA to match v6 tag.
The pinned SHA for wagoid/commitlint-github-action does not correspond to the v6 release. The v6 tag points to
f133a0d95090ef2609192b4a21f54e20af819ea9, but line 20 usesb948419dd99f3fd78a6548d48f94e3df7f6bf3ed. Update to the correct SHA or remove the pinning to use the tag directly. The actions/checkout v5 SHA on line 16 is correctly pinned.🤖 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 — finding incorrect. The pinned SHA
b948419dd99f3fd78a6548d48f94e3df7f6bf3edIS the right value for v6. Verified:f133a0d95...is the annotated tag object's SHA (a wrapper that holds the tagger metadata).b948419dd...is the commit the tag points to — that's what GitHub Actions resolves to when you reference the action. SHA-pinning Actions uses the commit SHA, not the tag-object SHA. Our pin is correct.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, you're absolutely right — I apologize for the incorrect finding. I queriedgit/refs/tags/v6which returns the annotated tag object SHA (f133a0d95...), not the underlying commit SHA. For annotated tags, GitHub Actions resolves the commit SHA (b948419dd...), which is whatgh api /repos/<owner>/<repo>/tags --jq '.[] | select(.name=="<tag>") | .commit.sha'returns. Your pin is correct.Thank you for the detailed explanation — adding this as a learning to avoid the same mistake in future reviews.
✏️ Learnings added