-
Notifications
You must be signed in to change notification settings - Fork 49
Add compliance CI checks and scripts #1453
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 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f937e38
Add SPDX license identifier and update license information across mul…
89f5522
Enhance compliance checks by adding Node.js setup and pnpm support; u…
20b31c1
Refactor compliance workflow: streamline pnpm setup and simplify gitl…
6f4c063
Improve gitleaks installation in compliance workflow with architectur…
fd3b942
Refactor Gitleaks installation in compliance workflow to simplify arc…
14590d7
Enhance gitleaks installation in compliance workflow with dynamic ver…
ce61a23
Merge branch 'main' into chralt98-add-compliance-checks
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
Some comments aren't visible on the classic Files Changed page.
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,20 @@ | ||
| rules: | ||
| - id: rust-no-dbg-in-runtime | ||
| message: Avoid dbg! in runtimes and pallets; use logging macros instead. | ||
| severity: WARNING | ||
| languages: [rust] | ||
| pattern: dbg!($X) | ||
| paths: | ||
| include: | ||
| - /runtime/** | ||
| - /zrml/** | ||
|
|
||
| - id: rust-no-println-in-runtime | ||
| message: Avoid println! in runtimes and pallets; use logging macros instead. | ||
| severity: WARNING | ||
| languages: [rust] | ||
| pattern: println!($X) | ||
| paths: | ||
| include: | ||
| - /runtime/** | ||
| - /zrml/** |
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,110 @@ | ||
| name: Compliance | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [ labeled ] | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| concurrency: | ||
| group: compliance-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| cargo-deny: | ||
| name: Cargo Deny | ||
| if: | | ||
| github.event_name == 'pull_request' && | ||
| (contains(github.event.pull_request.labels.*.name, 's:review-needed') || | ||
| contains(github.event.pull_request.labels.*.name, 's:accepted')) || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Install cargo-deny | ||
| uses: taiki-e/install-action@v2 | ||
| with: | ||
| tool: cargo-deny | ||
| - name: Run cargo-deny | ||
| run: | | ||
| cargo deny check licenses bans sources advisories | ||
|
|
||
| semgrep: | ||
| name: Semgrep | ||
| if: | | ||
| github.event_name == 'pull_request' && | ||
| (contains(github.event.pull_request.labels.*.name, 's:review-needed') || | ||
| contains(github.event.pull_request.labels.*.name, 's:accepted')) || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Run semgrep | ||
| uses: returntocorp/semgrep-action@v1 | ||
| with: | ||
| config: .github/semgrep-rules.yml | ||
|
|
||
| node-licenses: | ||
| name: Node Licenses | ||
| if: | | ||
| github.event_name == 'pull_request' && | ||
| (contains(github.event.pull_request.labels.*.name, 's:review-needed') || | ||
| contains(github.event.pull_request.labels.*.name, 's:accepted')) || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: integration-tests | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Check licenses | ||
| run: npx license-checker --production --summary | ||
| - name: Audit npm | ||
| run: npm audit --production | ||
|
|
||
| gitleaks: | ||
| name: Gitleaks | ||
| if: | | ||
| github.event_name == 'pull_request' && | ||
| (contains(github.event.pull_request.labels.*.name, 's:review-needed') || | ||
| contains(github.event.pull_request.labels.*.name, 's:accepted')) || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Run gitleaks | ||
| uses: gitleaks/gitleaks-action@v2 | ||
| with: | ||
| args: detect --redact | ||
|
|
||
| sbom-vuln: | ||
| name: SBOM and Vulnerability Scan | ||
| if: | | ||
| github.event_name == 'pull_request' && | ||
| (contains(github.event.pull_request.labels.*.name, 's:review-needed') || | ||
| contains(github.event.pull_request.labels.*.name, 's:accepted')) || | ||
| github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Generate SBOM | ||
| uses: anchore/sbom-action@v0 | ||
| with: | ||
| path: . | ||
| output-file: sbom.json | ||
| format: cyclonedx-json | ||
| - name: Scan SBOM | ||
| uses: anchore/scan-action@v3 | ||
| env: | ||
| GRYPE_CONFIG: ${{ github.workspace }}/.grype.yaml | ||
| with: | ||
| sbom: sbom.json | ||
| fail-build: true | ||
| severity-cutoff: medium |
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
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,24 @@ | ||
| name: Scancode | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| tags: | ||
| - "^v[0-9]+.[0-9]+.[0-9]+(-rc[0-9]+)?$" | ||
|
|
||
| jobs: | ||
| scancode: | ||
| name: Scancode | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Install scancode | ||
| run: pip install scancode-toolkit | ||
| - name: Run scancode | ||
| run: scancode --processes 4 -clp . --json-pp compliance-report.json | ||
| - name: Upload scancode report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: scancode-report | ||
| path: compliance-report.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
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,15 @@ | ||
| description = "Allow known public addresses and test keys that gitleaks flags" | ||
| title = "Zeitgeist gitleaks allowlist" | ||
|
|
||
| [allowlist] | ||
| paths = [ | ||
| '''^integration-tests/scripts/chopsticks-relay-timestamp-hook\.js$''', | ||
| '''^integration-tests/configs/rococo\.yml$''', | ||
| '''^integration-tests/configs/battery-station\.yml$''', | ||
| '''^runtime/battery-station/src/parachain_params\.rs$''', | ||
| '''^runtime/zeitgeist/src/parachain_params\.rs$''', | ||
| '''^scripts/runtime-upgrade/test_runtime_upgrade\.sh$''', | ||
| '''^node/res/bs_parachain\.json$''', | ||
| '''^node/res/bp\.json$''', | ||
| '''^node/res/bp_parachain\.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,125 @@ | ||
| ignore: | ||
| # Temporary allowlist until the Polkadot SDK is upgraded and pulls newer crypto/runtime crates. | ||
| - vulnerability: GHSA-c86p-w88r-qvqr | ||
| package: | ||
| name: ring | ||
| - vulnerability: GHSA-4p46-pwfr-66x6 | ||
| package: | ||
| name: ring | ||
| - vulnerability: GHSA-c2f5-jxjv-2hh8 | ||
| package: | ||
| name: wasmtime | ||
| - vulnerability: GHSA-hc7m-r6v8-hg9q | ||
| package: | ||
| name: wasmtime | ||
| - vulnerability: GHSA-9ghp-w2hm-vfpf | ||
| package: | ||
| name: wasmtime-jit-debug | ||
| # Temporary allowlist for Go stdlib CVEs pulled in via prebuilt esbuild binaries; remove once upstream ships builds with patched Go toolchains. | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2023-45288 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24787 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24784 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24791 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2023-24531 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24783 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2023-45289 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2023-45290 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-34156 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24785 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-34158 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24790 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-45336 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-34155 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-45341 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-22871 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-61723 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-61725 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58185 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-47907 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58186 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-61724 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-47912 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-47906 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58187 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58188 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58189 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-22866 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-4673 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-4674 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-58183 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2025-0913 | ||
| - package: | ||
| name: stdlib | ||
| vulnerability: CVE-2024-24789 | ||
| # idna GHSA still present in Rust stack; allowlisted until upstream upgrades. | ||
| - vulnerability: GHSA-h97m-ww89-6jmq | ||
| package: | ||
| name: idna | ||
| # tracing-subscriber 0.2.x pulled in via substrate stack; allowlist until upstream bumps to >=0.3.20. | ||
| - vulnerability: GHSA-xwfj-jgwm-7wp5 | ||
| package: | ||
| name: tracing-subscriber | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
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.