Skip to content
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

NEW Check that all dependency licenses are permissive #44

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ Run Silverstripe CI matrix tests
Only intended to be used within [gha-ci](https://github.com/silverstripe/gha-ci). The inputs all come from the matrix generated as a part of that workflow.

GitHub job permissions required: `none`

## JS license checking

This action will check the licences of any installed NPM dependencies against a list of allowed SPDX identifiers of open source licences. These are contained in semi-colon delimited list in `allowed-spdx-delimited.txt`. If any insalaled non-dev dependencies are found that are not in the allowed list then the job will fail. See https://spdx.org/licenses/ for a list of SPDX identifiers.

Note that the `Unlicense` is an SPDX identifier for an actual license and not a placeholder for a missing license.

Composer dependences are checked seperately in `ci.yml` of `silverstripe/recipe-kitchen-sink`.
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ runs:
echo "Running yarn lint"
yarn run lint
fi
# Validate licenses of all NPM dependencies are allowed
echo "Checking licenses of all dependencies"
# The following NPM package report as UNKNOWN or UNLICENSED, though have been manually checked they have permissive licenses:
EXCLUDE_PACKAGES='[email protected];[email protected];@silverstripe/[email protected];[email protected];[email protected]'
Copy link
Member

Choose a reason for hiding this comment

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

  • glob-to-regexp is archived so we should replace it.
  • silverstripe/react-injector isn't maintained - the correct react injector is inside silverstripe/admin directly. Whatever has this dependency should remove it immediately.
  • cwp-watea-theme and cwp-starter-theme should not be included as npm/yarn dependencies anywhere, so whatever has listed those as dependencies should also remove them immediately.

jquery.are-you-sure is the only item here that we can't really do anything about.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we should sort those out for CMS 6, though remember this would also run on CMS 5.3 builds, and we don't have plans to update JS deps there

I've added a note to the unmaintained deps card to remove these

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any problem with resolving these dependency problems in CMS 5, or at the very very least looking at what effort is involved with doing so. I suspect the effort will be very small for these deps.

More to the point though, if we're not going to update deps for CMS 5 then this thing that checks deps shouldn't run on CMS 5.

Copy link
Member Author

@emteknetnz emteknetnz Dec 19, 2024

Choose a reason for hiding this comment

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

Replacing deps is out of scope for this PR. We can look CMS 5 deps seperately on the unmaintained deps card I linked to.

and we don't have plans to update JS deps there

I'm probably wrong there actually, we still haven't released CMS 5.4 which presumably will include updating JS deps. We may also need to update CMS 5 deps while it's still under support post CMS 6 stable

npm install -g license-checker
SPDX_ALLOWED_DELIMITED=$(cat ${{ github.action_path }}/allowed-spdx-delimited.txt | tr -d '\n')
license-checker --production --unknown --out /dev/null --onlyAllow "$SPDX_ALLOWED_DELIMITED" --excludePackages "$EXCLUDE_PACKAGES"
# If we get to this point, everything was successful
echo "Passed"

- name: "Run PHP linting"
Expand Down
1 change: 1 addition & 0 deletions allowed-spdx-delimited.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIT;MIT-0;ISC;0BSD;BSD-2-Clause;BSD-3-Clause;Apache-2.0;Python-2.0;CC0-1.0;CC-BY-3.0;CC-BY-4.0;Public Domain;Unlicense
Loading