Reject deprecated SPDX licenses, but be lenient with committed LICENSE files#754
Reject deprecated SPDX licenses, but be lenient with committed LICENSE files#754thomashoneyman wants to merge 6 commits intomasterfrom
Conversation
|
I double-checked with the strict license decoding, and 44 manifests fail with it. Can't break the manifest decoding, of course! Here are a set of packages which would fail strict parsing. So instead I'm adjusting to strict-on-publish, lenient-on-decode, to allow these existing manifests to parse. |
e85e9f6 to
3e045b4
Compare
Keep historical manifests backward-compatible while requiring canonical SPDX for new publishes.
3e045b4 to
ec28727
Compare
|
I'm not 100% happy with this because it's more code than I'd like to add, but on the other hand dealing with licenses is kind of a pain and it's not a huge surprise. The worst part is the split between |
Fixes #753. In that issue, @philippedev101 noted that license validation has a catch-22 in that:
licensee. Deprecated licenses likeAGPL-3.0are allowed, and the licenses must match.purs publish, which requires only current SPDX identifiers. Deprecated licenses likeAGPL-3.0are rejected.licenseetool will emit deprecated SPDX ids likeAGPL-3.0when it sees an AGPL license file, rather than their current / canonical forms. If the manifest specifiesAGPL-3.0-only, which is correct and compatible with the license file, this still gets rejected by the registry due to the "mismatch".Therefore, publishing would fail in one place or the other with no value that satisfies both. This PR fixes that by being strict for manifest parsing, but lenient with discovered
licenseelicenses:Registry.License.parsestays strict for user-authored licenses (current canonical SPDX only)License.canonicalizeDetected), then parsed strictly. By "canonicalize" I mean licenses with an unambiguous path to be moved from a deprecated to a current id are updated.Implementation-wise, I made a few changes:
Licenseis now stored as a parsed tree (not opaque text), andprintalways emits canonical formextractIdsworks from that stored tree now, so there's no ability to fail-onlyand-or-laterrewrites.On the app side of things, we have clear errors for when entries are detected but cannot be canonicalized, and we no longer ignore bad detected values in e.g. bower.json manifest files.