chore: ライセンスヘッダのURL解決を spdx-license-list へ置き換える - #76
Merged
Conversation
oss-license-name-to-url は 2015-05-31 のリリースを最後に更新が止まり、 GitHub 側も archived になっている。脆弱性の報告は無いが、SPDX 識別子から URL へのマッピングが11年前のままで、その後に登録された識別子を解決できず URLなしになる。 SPDX 公式データの写しである spdx-license-list へ置き換えた。識別子の確認 だけに使い、URL は https://spdx.org/licenses/<ID>.html を組み立てている。 spdx-license-list が持つ url フィールドはライセンスごとに提供元がばらつく (ISC は isc.org の一覧ページ、0BSD は個人サイトかつ http)ため、 opensource.org で揃っていた現行の性格を引き継ぐ形にした。 生成されるヘッダの差分は URL の行だけで、ヘッダのバイト数も変わらない。 - * license: MIT (http://opensource.org/licenses/MIT) + * license: MIT (https://spdx.org/licenses/MIT.html) 依存ツリーに実在するライセンス名を全件突き合わせた結果、URLが付かなくなる ものは1件も無い。逆に 0BSD / MIT-0 / BlueOak-1.0.0 / CC-BY-4.0 / Unlicense など、現行では null だった識別子に URL が付くようになる。 旧実装が持っていた `bsd` → BSD-2-Clause のような非SPDX表記のエイリアスは 引き継いでいない。対象5リポジトリの全依存にその表記が1件も無く、 `gpl` → GPL-3.0 のような推測が正しい保証も無いため。なお SPDX 側は GPL-3.0 のような deprecated 識別子も持っているので、古い package.json で よく見る表記はそのまま解決できる。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RTMgXN4xUWD4LhkQtHhiGe
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
背景
oss-license-name-to-urlは 2015-05-31 のリリースを最後に更新が止まっていて、GitHub 側も archived です。脆弱性の報告はありませんが、SPDX 識別子から URL へのマッピングが11年前のままなので、その後に登録された識別子を解決できずヘッダに URL が付きません。tools/lib/license-header.mjsがこれを使ってリリースビルドのライセンスヘッダに URL を付けています。同じファイルを unitrad-ui / unitrac-ui / unitrad-view / unitrad-ui-nagano / unitrad-kintone-plugin の5リポジトリが1バイト違わず持っているので、同じ変更をまとめて入れています。変更内容
SPDX 公式データの写しである
spdx-license-listに置き換えました。識別子の確認だけに使い、URL はhttps://spdx.org/licenses/<ID>.htmlを組み立てています。spdx-license-list自体もurlフィールドを持っていますが、これは「ライセンス本文の置き場」で、ライセンスごとに提供元がばらつきます。ISC は isc.org の一覧ページ、Apache-2.0 は apache.org、0BSD は個人サイトかつ http のままです。現行がopensource.org/licenses/<ID>で揃っていた性格を引き継ぎたいので、SPDX 側のページに統一しました。旧実装が持っていた
bsd→BSD-2-Clauseのような非SPDX表記のエイリアスは引き継いでいません。5リポジトリの全依存にその表記が1件も無いこと、gpl→GPL-3.0のような推測が正しい保証も無いためです。SPDX 側はGPL-3.0のような deprecated 識別子も持っているので、古い package.json でよく見る表記はそのまま解決できます。出力の変化
リリースビルドのヘッダの差分は URL の行だけです。ヘッダのバイト数も変わりません(
http://opensource.org/licenses/MITとhttps://spdx.org/licenses/MIT.htmlがどちらも34文字のため)。5リポジトリのバンドルに実際に入るのは自リポジトリ + react + react-dom + react-paginate + scheduler で、いずれも MIT です。そのため実際の成果物では上記の1行が繰り返し変わるだけになります。
依存ツリー全体での突き合わせ
バンドルに入らないものも含めて、
node_modulesに実在するライセンス名を全件、置き換え前後で比較しました。URL が付かなくなるものは1件もありません。URL の形が変わるもの:
http://opensource.org/licenses/MIThttps://spdx.org/licenses/MIT.htmlhttp://opensource.org/licenses/Apache-2.0https://spdx.org/licenses/Apache-2.0.htmlhttp://opensource.org/licenses/ISChttps://spdx.org/licenses/ISC.htmlhttp://opensource.org/licenses/BSD-2-Clausehttps://spdx.org/licenses/BSD-2-Clause.htmlhttp://opensource.org/licenses/BSD-3-Clausehttps://spdx.org/licenses/BSD-3-Clause.htmlhttp://creativecommons.org/publicdomain/zero/1.0/https://spdx.org/licenses/CC0-1.0.html新しく URL が付くもの(現行は
nullで、ライセンス名だけがヘッダに出ていた):https://spdx.org/licenses/0BSD.htmlhttps://spdx.org/licenses/MIT-0.htmlhttps://spdx.org/licenses/BlueOak-1.0.0.htmlhttps://spdx.org/licenses/CC-BY-4.0.htmlhttps://spdx.org/licenses/CC-BY-3.0.htmlhttps://spdx.org/licenses/Unlicense.htmlこれが「11年古い」の実害そのものです。旧実装は
osi-licensesが持つ69件の OSI 一覧(2015年時点)だけを参照していて、そこに無い識別子は問答無用でnullを返していました。SPDX 側は現在 727 件を持っています。確認したこと
npm run releaseが通り、ヘッダの差分が URL の行だけであること(unitrac-uiは--allで4サイト分すべて確認)npm run typecheckとnpm testがグリーン(5リポジトリ合計 773 件)oss-license-name-to-urlとosi-licensesの削除、spdx-license-listの追加だけで、他の依存に巻き添えが無いことoss-license-name-to-url/osi-licenses/opensource.orgへの参照が残っていないこと🤖 Generated with Claude Code
https://claude.ai/code/session_01RTMgXN4xUWD4LhkQtHhiGe