Skip to content

ci: add license-check workflow - #217

Open
Seth-Schmidt wants to merge 8 commits into
mainfrom
feature/pro-560-add-license-check-workflow
Open

ci: add license-check workflow#217
Seth-Schmidt wants to merge 8 commits into
mainfrom
feature/pro-560-add-license-check-workflow

Conversation

@Seth-Schmidt

@Seth-Schmidt Seth-Schmidt commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a PR gate that fails when a package introduces a production dependency
under a disallowed license. Addresses compliance finding 3-1 (License Check).

Scope is what we distribute: contract bytecode and scripts/ source. Packages with known-but-pending or
peer-install-only exceptions are suppressed via exact name@version exclusions
in the Makefile.

Changes

  • Makefilemake check-licenses

    • Iterates all contract packages plus scripts/fhevm-cli and
      scripts/governance-proposal-builder.
    • Allow-list: MIT, BSD variants, Apache-2.0, ISC, etc.
    • EXCLUDE_PACKAGES: LGPL Safe (cleared), LZBL LayerZero v2 packages (legal
      pending), BUSL peers not compiled into our Solidity (v1, Chainlink CCIP,
      lz-v2-utilities).
  • .github/workflows/license-check.yml

    • license-check/check-licenses (bpr)
  • package.json / lockfiles — move deployed Solidity deps from
    devDependenciesdependencies in governance, token, solanaOFT,
    staking, safe, and scripts/fhevm-cli so --production scans the real
    compile-time tree. Lockfiles regenerated to match.

@cla-bot cla-bot Bot added the cla-signed label Jul 17, 2026
Comment thread .github/workflows/license-check.yml Fixed
Comment thread .github/workflows/license-check.yml Fixed
Comment thread .github/workflows/license-check.yml Fixed
Comment thread .github/workflows/license-check.yml Fixed
Adds a PR gate that fails when a dependency introduces a copyleft
(GPL/AGPL/LGPL) license:

- license-check/node (bpr): runs `license-checker` over the root production
  dependency tree.
- license-check/rust (bpr): runs `cargo deny check licenses` against the
  Solana OFT crate, governed by a new contracts/solanaOFT/deny.toml allow-list.

Both jobs carry the (bpr) suffix so they can be added to the default-branch
required-status-checks ruleset.
@Seth-Schmidt
Seth-Schmidt force-pushed the feature/pro-560-add-license-check-workflow branch 3 times, most recently from b2df1f0 to 07ae9ff Compare July 17, 2026 19:40
@Seth-Schmidt
Seth-Schmidt force-pushed the feature/pro-560-add-license-check-workflow branch from 07ae9ff to dee3d5c Compare July 17, 2026 19:41
@Seth-Schmidt
Seth-Schmidt force-pushed the feature/pro-560-add-license-check-workflow branch from 801e2fc to 80bdea6 Compare July 17, 2026 20:39
@Seth-Schmidt Seth-Schmidt self-assigned this Jul 17, 2026
@Seth-Schmidt
Seth-Schmidt marked this pull request as ready for review July 29, 2026 21:06
@Seth-Schmidt
Seth-Schmidt requested a review from a team as a code owner July 29, 2026 21:06
Comment thread .github/workflows/license-check.yml Outdated

- name: Check licenses
working-directory: ${{ matrix.package }}
run: npx --yes license-checker --production --failOn "GPL;AGPL;LGPL"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the only rule that we allow ? also: i thought it was ok for tooling/testing (ie non-smart contract libraries), which I don't think we differentiate here

you can check an old work of mine here (in the makefile) if you're curious : https://github.com/zama-ai/protocol-apps/pull/14/changes

@Seth-Schmidt

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Aug 6, 2026

Copy link
Copy Markdown

Claude finished @Seth-Schmidt's request.View run

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AUTOMATED]

Code Review — ci: add license-check workflow

The workflow is well-structured and follows established repository conventions (SHA-pinned actions, least-privilege permissions, concurrency groups, persist-credentials: false, (bpr) naming). The shell logic for discovering affected packages in a monorepo is sound.

However, the license-checking step has a critical issue that defeats the purpose of the workflow.

Summary

Category Result
Guideline Compliance ✅ Fully compliant with repo conventions
Error Handling ✅ Adequate (set -euo pipefail, proper aggregate gate)
Security ✅ Least-privilege, pinned actions, no credential exposure
Bug / Correctness ⚠️ 1 issue found (see inline comment)

uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AUTOMATED]

Bug: --failOn uses exact string matching — copyleft licenses will slip through

license-checker's --failOn compares the full license string against each entry using literal equality (source). The values "GPL", "AGPL", and "LGPL" do not match real-world SPDX identifiers like GPL-2.0-only, GPL-3.0-only, AGPL-3.0-only, LGPL-2.1-only, etc.

As a result, every copyleft-licensed package will silently pass this check, defeating the purpose of the workflow.

Options to fix:

  1. Enumerate the specific SPDX identifiers (and common non-SPDX variants reported by npm):

    npx --yes license-checker --production --failOn \
      "GPL-1.0-only;GPL-1.0-or-later;GPL-2.0-only;GPL-2.0-or-later;GPL-3.0-only;GPL-3.0-or-later;AGPL-1.0-only;AGPL-1.0-or-later;AGPL-3.0-only;AGPL-3.0-or-later;LGPL-2.0-only;LGPL-2.0-or-later;LGPL-2.1-only;LGPL-2.1-or-later;LGPL-3.0-only;LGPL-3.0-or-later"
  2. Use --onlyAllow instead (allowlist approach — --onlyAllow does substring matching, so it's safer):

    npx --yes license-checker --production --onlyAllow \
      "MIT;ISC;Apache-2.0;BSD-2-Clause;BSD-3-Clause;0BSD;CC0-1.0;Unlicense;CC-BY-3.0;CC-BY-4.0;Python-2.0;BlueOak-1.0.0"
  3. Switch to a fork with SPDX-aware matching, e.g. license-checker-rseidelsohn (actively maintained) or @onebeyond/license-checker (enforces valid SPDX).

Confidence: 95/100

@claude

claude Bot commented Aug 6, 2026

Copy link
Copy Markdown

The review has been posted successfully. Here's a summary of the review:

Review Summary for PR #217: ci: add license-check workflow

What was reviewed

A new GitHub Actions workflow (153 lines) that gates PRs on copyleft license detection across npm packages in a monorepo.

Findings

✅ Guideline Compliance — Fully compliant with all repository conventions (SHA-pinned actions, least-privilege permissions, concurrency groups, persist-credentials: false, (bpr) naming pattern).

✅ Security — Proper least-privilege permissions, no credential exposure, SHA-pinned actions.

✅ Error Handling — Adequate use of set -euo pipefail, proper aggregate gate job with if: always().

⚠️ 1 Bug Found (Critical) — The --failOn "GPL;AGPL;LGPL" flag on license-checker uses exact string matching, not substring matching. Real-world SPDX identifiers like GPL-2.0-only, GPL-3.0-only, AGPL-3.0-only, LGPL-2.1-only etc. will not be caught, silently defeating the purpose of the workflow. Three fix options were provided in the inline comment.

@zama-ai zama-ai deleted a comment from claude Bot Sep 1, 2026
@Seth-Schmidt
Seth-Schmidt force-pushed the feature/pro-560-add-license-check-workflow branch from 3a231d2 to 6845239 Compare September 1, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants