diff --git a/__tests__/result-service.test.ts b/__tests__/result-service.test.ts index 4104279..fffcea4 100644 --- a/__tests__/result-service.test.ts +++ b/__tests__/result-service.test.ts @@ -7,7 +7,7 @@ const licenseTableTest: { name: string; description: string; content: string; li description: 'Only one dependency file', content: '{"package.json":[{"dependencies":[{"component":"p-timeout","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/p-timeout","url":"https://www.npmjs.com/package/p-timeout","version":"6.1.2"},{"component":"@sindresorhus/tsconfig","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/%40sindresorhus/tsconfig","url":"https://www.npmjs.com/package/%40sindresorhus/tsconfig","version":"5.0.0"}],"id":"dependency","status":"pending"}]}', - licenses: [{ spdxid: 'MIT', url: null, copyleft: null, count: 2 }] + licenses: [{ spdxid: 'MIT', url: 'https://spdx.org/licenses/MIT.html', copyleft: false, count: 2 }] }, { name: '2) license test', @@ -15,9 +15,9 @@ const licenseTableTest: { name: string; description: string; content: string; li content: '{"package.json":[{"dependencies":[{"component":"@types/node","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/%40types/node","url":"https://www.npmjs.com/package/%40types/node","version":"17.0.45"},{"component":"packageurl-js","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/packageurl-js","url":"https://www.npmjs.com/package/packageurl-js","version":"0.0.5"},{"component":"typescript","licenses":[{"is_spdx_approved":true,"name":"Apache-2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:npm/typescript","url":"https://www.npmjs.com/package/typescript","version":"4.9.5"}],"id":"dependency","status":"pending"}],"requirements.txt":[{"dependencies":[{"component":"requests","licenses":[{"is_spdx_approved":true,"name":"Apache2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:pypi/requests","url":"https://pypi.org/project/requests","version":"2.31.0"},{"licenses":[{}],"purl":"pkg:pypi/crc32c"},{"component":"binaryornot","licenses":[{"is_spdx_approved":true,"name":"BSD","spdx_id":"0BSD"}],"purl":"pkg:pypi/binaryornot","url":"https://pypi.org/project/binaryornot","version":"0.4.4"},{"component":"pytest","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest","url":"https://pypi.org/project/pytest","version":"8.0.0rc2"},{"component":"pytest-cov","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest-cov","url":"https://pypi.org/project/pytest-cov","version":"4.1.0"},{"component":"beautifulsoup4","licenses":[{"is_spdx_approved":true,"name":"MITLicense","spdx_id":"MIT"}],"purl":"pkg:pypi/beautifulsoup4","url":"https://pypi.org/project/beautifulsoup4","version":"4.12.3"}],"id":"dependency","status":"pending"}]}', licenses: [ - { spdxid: 'MIT', url: null, copyleft: null, count: 5 }, - { spdxid: 'Apache-2.0', url: null, copyleft: null, count: 2 }, - { spdxid: '0BSD', url: null, copyleft: null, count: 1 } + { spdxid: 'MIT', url: 'https://spdx.org/licenses/MIT.html', copyleft: false, count: 5 }, + { spdxid: 'Apache-2.0', url: 'https://spdx.org/licenses/Apache-2.0.html', copyleft: false, count: 2 }, + { spdxid: '0BSD', url: 'https://spdx.org/licenses/0BSD.html', copyleft: false, count: 1 } ] }, { @@ -27,9 +27,19 @@ const licenseTableTest: { name: string; description: string; content: string; li '{"aaaaa.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"snippet","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"1-37","matched":"97%","oss_lines":"33-69","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"aefc7383cccb35ecf8994c49d17c69be","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"attributions.c":[{"component":"engine","file":"attributions.c","file_hash":"4dd9a878731a51b612fedde5ad5d6084","file_url":"https://osskb.org/api/file_contents/4dd9a878731a51b612fedde5ad5d6084","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"name":"JSON","source":"scancode","url":"https://spdx.org/licenses/JSON.html"},{"name":"LicenseRef-scancode-unknown-license-reference","source":"scancode"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"4dd9a878731a51b612fedde5ad5d6084","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"binary_scan.c":[{"component":"engine","file":"binary_scan.c","file_hash":"0d27d55d1134cbdaa1536babdff219f5","file_url":"https://osskb.org/api/file_contents/0d27d55d1134cbdaa1536babdff219f5","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"0d27d55d1134cbdaa1536babdff219f5","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"component.c":[{"component":"engine","file":"component.c","file_hash":"6852eb3bc69f70a15064645ad24446a2","file_url":"https://osskb.org/api/file_contents/6852eb3bc69f70a15064645ad24446a2","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2023-06-05","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"6852eb3bc69f70a15064645ad24446a2","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"1170a6175564e85c6877886e5ca565b2","vendor":"scanoss","version":"5.2.6"}],"copyright.c":[{"component":"engine","file":"copyright.c","file_hash":"e5965a5937743a78129b73b4171961e9","file_url":"https://osskb.org/api/file_contents/e5965a5937743a78129b73b4171961e9","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"e5965a5937743a78129b73b4171961e9","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"cryptography.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"45931442719d401103ab8bcbbca1af99","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"debug.c":[{"component":"engine","file":"debug.c","file_hash":"5adbcacf687f26596731900c07570673","file_url":"https://osskb.org/api/file_contents/5adbcacf687f26596731900c07570673","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"5adbcacf687f26596731900c07570673","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"decrypt.c":[{"component":"engine","file":"decrypt.c","file_hash":"d954b45c05e338f1a9f56a93110cdae0","file_url":"https://osskb.org/api/file_contents/d954b45c05e338f1a9f56a93110cdae0","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"d954b45c05e338f1a9f56a93110cdae0","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"no-match.c":[{"id":"none","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"}}]}', licenses: [ { spdxid: 'GPL-2.0-only', url: 'https://spdx.org/licenses/GPL-2.0-only.html', copyleft: true, count: 16 }, - { spdxid: 'GPL-2.0-or-later', url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', copyleft: true, count: 12 }, - { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: null, count: 1 }, - { spdxid: 'LicenseRef-scancode-unknown-license-reference', url: null, copyleft: null, count: 1 } + { + spdxid: 'GPL-2.0-or-later', + url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', + copyleft: false, + count: 12 + }, + { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: false, count: 1 }, + { + spdxid: 'LicenseRef-scancode-unknown-license-reference', + url: 'https://spdx.org/licenses/LicenseRef-scancode-unknown-license-reference.html', + copyleft: false, + count: 1 + } ] }, { @@ -38,13 +48,23 @@ const licenseTableTest: { name: string; description: string; content: string; li content: '{"aaaaa.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"snippet","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"1-37","matched":"97%","oss_lines":"33-69","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"aefc7383cccb35ecf8994c49d17c69be","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"attributions.c":[{"component":"engine","file":"attributions.c","file_hash":"4dd9a878731a51b612fedde5ad5d6084","file_url":"https://osskb.org/api/file_contents/4dd9a878731a51b612fedde5ad5d6084","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"name":"JSON","source":"scancode","url":"https://spdx.org/licenses/JSON.html"},{"name":"LicenseRef-scancode-unknown-license-reference","source":"scancode"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"4dd9a878731a51b612fedde5ad5d6084","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"binary_scan.c":[{"component":"engine","file":"binary_scan.c","file_hash":"0d27d55d1134cbdaa1536babdff219f5","file_url":"https://osskb.org/api/file_contents/0d27d55d1134cbdaa1536babdff219f5","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"0d27d55d1134cbdaa1536babdff219f5","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"component.c":[{"component":"engine","file":"component.c","file_hash":"6852eb3bc69f70a15064645ad24446a2","file_url":"https://osskb.org/api/file_contents/6852eb3bc69f70a15064645ad24446a2","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2023-06-05","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"6852eb3bc69f70a15064645ad24446a2","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"1170a6175564e85c6877886e5ca565b2","vendor":"scanoss","version":"5.2.6"}],"copyright.c":[{"component":"engine","file":"copyright.c","file_hash":"e5965a5937743a78129b73b4171961e9","file_url":"https://osskb.org/api/file_contents/e5965a5937743a78129b73b4171961e9","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"e5965a5937743a78129b73b4171961e9","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"cryptography.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"45931442719d401103ab8bcbbca1af99","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"debug.c":[{"component":"engine","file":"debug.c","file_hash":"5adbcacf687f26596731900c07570673","file_url":"https://osskb.org/api/file_contents/5adbcacf687f26596731900c07570673","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"5adbcacf687f26596731900c07570673","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"decrypt.c":[{"component":"engine","file":"decrypt.c","file_hash":"d954b45c05e338f1a9f56a93110cdae0","file_url":"https://osskb.org/api/file_contents/d954b45c05e338f1a9f56a93110cdae0","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"d954b45c05e338f1a9f56a93110cdae0","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"no-match.c":[{"id":"none","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"}}],"requirements.txt":[{"dependencies":[{"component":"requests","licenses":[{"is_spdx_approved":true,"name":"Apache2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:pypi/requests","url":"https://pypi.org/project/requests","version":"2.31.0"},{"licenses":[{}],"purl":"pkg:pypi/crc32c"},{"component":"binaryornot","licenses":[{"is_spdx_approved":true,"name":"BSD","spdx_id":"0BSD"}],"purl":"pkg:pypi/binaryornot","url":"https://pypi.org/project/binaryornot","version":"0.4.4"},{"component":"pytest","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest","url":"https://pypi.org/project/pytest","version":"8.0.0rc2"},{"component":"pytest-cov","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest-cov","url":"https://pypi.org/project/pytest-cov","version":"4.1.0"},{"component":"beautifulsoup4","licenses":[{"is_spdx_approved":true,"name":"MITLicense","spdx_id":"MIT"}],"purl":"pkg:pypi/beautifulsoup4","url":"https://pypi.org/project/beautifulsoup4","version":"4.12.3"}],"id":"dependency","status":"pending"}]}', licenses: [ - { spdxid: 'MIT', url: null, copyleft: null, count: 3 }, + { spdxid: 'MIT', url: 'https://spdx.org/licenses/MIT.html', copyleft: false, count: 3 }, { spdxid: 'GPL-2.0-only', url: 'https://spdx.org/licenses/GPL-2.0-only.html', copyleft: true, count: 16 }, - { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: null, count: 1 }, - { spdxid: 'LicenseRef-scancode-unknown-license-reference', url: null, copyleft: null, count: 1 }, - { spdxid: 'GPL-2.0-or-later', url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', copyleft: true, count: 12 }, - { spdxid: 'Apache-2.0', url: null, copyleft: null, count: 1 }, - { spdxid: '0BSD', url: null, copyleft: null, count: 1 } + { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: false, count: 1 }, + { + spdxid: 'LicenseRef-scancode-unknown-license-reference', + url: 'https://spdx.org/licenses/LicenseRef-scancode-unknown-license-reference.html', + copyleft: false, + count: 1 + }, + { + spdxid: 'GPL-2.0-or-later', + url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', + copyleft: false, + count: 12 + }, + { spdxid: 'Apache-2.0', url: 'https://spdx.org/licenses/Apache-2.0.html', copyleft: false, count: 1 }, + { spdxid: '0BSD', url: 'https://spdx.org/licenses/0BSD.html', copyleft: false, count: 1 } ] } ]; diff --git a/dist/index.js b/dist/index.js index 222a45d..5bba645 100644 --- a/dist/index.js +++ b/dist/index.js @@ -126004,7 +126004,7 @@ class CopyleftPolicyCheck extends policy_check_1.PolicyCheck { super.run(scannerResults); const components = (0, result_service_1.getComponents)(scannerResults); // Filter copyleft components - const componentsWithCopyleft = components.filter(component => component.licenses.some(license => !!license.copyleft || this.copyleftLicenses.has(license.spdxid.trim().toLowerCase()))); + const componentsWithCopyleft = components.filter(component => component.licenses.some(license => !!license.copyleft || license_utils_1.licenseUtil.isCopyLeft(license.spdxid.trim().toLowerCase()))); const summary = this.getSummary(componentsWithCopyleft); let details = this.getDetails(componentsWithCopyleft); if (details) { @@ -126031,12 +126031,12 @@ class CopyleftPolicyCheck extends policy_check_1.PolicyCheck { const rows = []; components.forEach(component => { component.licenses.forEach(license => { - const copyleftIcon = license.copyleft ? ':x:' : ' '; + const copyleftIcon = license_utils_1.licenseUtil.isCopyLeft(license.spdxid?.trim().toLowerCase()) ? ':x:' : ' '; rows.push([ component.purl, component.version, license.spdxid, - `${(0, license_utils_1.getOSADL)(license.spdxid) || ''}`, + `${license_utils_1.licenseUtil.getOSADL(license?.spdxid) || ''}`, copyleftIcon ]); }); @@ -126559,7 +126559,7 @@ async function generateJobSummary(scannerResults, policies) { const ROWS = []; items.forEach(l => { const copyleftIcon = l.copyleft ? ':x:' : ' '; - ROWS.push([l.spdxid, copyleftIcon, `${(0, license_utils_1.getOSADL)(l.spdxid) || ''}`]); + ROWS.push([l.spdxid, copyleftIcon, `${license_utils_1.licenseUtil.getOSADL(l?.spdxid) || ''}`]); }); return (0, markdown_utils_1.generateTable)(HEADERS, ROWS); }; @@ -126676,7 +126676,7 @@ function getComponents(results) { version: c.version, licenses: c.licenses.map(l => ({ spdxid: l.name, - copyleft: !l.copyleft ? null : l.copyleft === 'yes' ? true : false, + copyleft: license_utils_1.licenseUtil.isCopyLeft(l.name?.trim().toLowerCase()), url: l?.url ? l.url : null, count: 1 })) @@ -126689,7 +126689,12 @@ function getComponents(results) { purl: d.purl, version: d.version, licenses: d.licenses - .map(l => ({ spdxid: l.spdx_id, copyleft: null, url: null, count: 1 })) + .map(l => ({ + spdxid: l.spdx_id, + copyleft: license_utils_1.licenseUtil.isCopyLeft(l.spdx_id?.trim().toLowerCase()), + url: null, + count: 1 + })) .filter(l => l.spdxid) }); } @@ -126736,8 +126741,8 @@ function getLicenses(results) { for (const l of c.licenses) { licenses.push({ spdxid: l.name, - copyleft: !l.copyleft ? null : l.copyleft === 'yes' ? true : false, - url: (0, license_utils_1.getOSADL)(l.name), + copyleft: license_utils_1.licenseUtil.isCopyLeft(l.name.trim().toLowerCase()), + url: license_utils_1.licenseUtil.getOSADL(l?.name), count: 1 }); } @@ -126748,7 +126753,12 @@ function getLicenses(results) { for (const l of d.licenses) { if (!l.spdx_id) continue; - licenses.push({ spdxid: l.spdx_id, copyleft: null, url: (0, license_utils_1.getOSADL)(l.spdx_id), count: 1 }); + licenses.push({ + spdxid: l.spdx_id, + copyleft: license_utils_1.licenseUtil.isCopyLeft(l.spdx_id?.trim().toLowerCase()), + url: license_utils_1.licenseUtil.getOSADL(l?.spdx_id), + count: 1 + }); } } } @@ -127004,11 +127014,49 @@ exports.createCommentOnPR = createCommentOnPR; "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getOSADL = void 0; -const getOSADL = (spdxid) => { - return `https://spdx.org/licenses/${spdxid}.html`; -}; -exports.getOSADL = getOSADL; +exports.licenseUtil = exports.LicenseUtil = void 0; +class LicenseUtil { + BASE_OSADL_URL = 'https://spdx.org/licenses'; + HTML = 'html'; + constructor() { + this.init(); + } + defaultCopyleftLicenses = new Set([ + 'GPL-1.0-only', + 'GPL-2.0-only', + 'GPL-3.0-only', + 'AGPL-3.0-only', + 'Sleepycat', + 'Watcom-1.0', + 'GFDL-1.1-only', + 'GFDL-1.2-only', + 'GFDL-1.3-only', + 'LGPL-2.1-only', + 'LGPL-3.0-only', + 'MPL-1.1', + 'MPL-2.0', + 'EPL-1.0', + 'EPL-2.0', + 'CDDL-1.0', + 'CDDL-1.1', + 'CECILL-2.1', + 'Artistic-1.0', + 'Artistic-2.0', + 'CC-BY-SA-4.0' + ].map(l => l.toLowerCase())); + copyLeftLicenses = new Set(); + init() { + this.copyLeftLicenses = this.defaultCopyleftLicenses; + } + isCopyLeft(spdxid) { + return this.copyLeftLicenses.has(spdxid); + } + getOSADL(spdxid) { + return `${this.BASE_OSADL_URL}/${spdxid}/.${this.HTML}`; + } +} +exports.LicenseUtil = LicenseUtil; +exports.licenseUtil = new LicenseUtil(); /***/ }), diff --git a/src/main.ts b/src/main.ts index 647233f..1c85383 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,6 +29,7 @@ import * as outputs from './app.output'; import { scanService, uploadResults } from './services/scan.service'; import { policyManager } from './policies/policy.manager'; +import { licenseUtil } from './utils/license.utils'; /** * The main function for the action. * @returns {Promise} Resolves when the action is complete. diff --git a/src/policies/copyleft-policy-check.ts b/src/policies/copyleft-policy-check.ts index fdb718b..f6a861f 100644 --- a/src/policies/copyleft-policy-check.ts +++ b/src/policies/copyleft-policy-check.ts @@ -28,7 +28,7 @@ import { Component, getComponents } from '../services/result.service'; import { generateTable } from '../utils/markdown.utils'; import * as core from '@actions/core'; import { context } from '@actions/github'; -import { getOSADL } from '../utils/license.utils'; +import { licenseUtil } from '../utils/license.utils'; /** * This class checks if any of the components identified in the scanner results are subject to copyleft licenses. @@ -74,7 +74,7 @@ export class CopyleftPolicyCheck extends PolicyCheck { // Filter copyleft components const componentsWithCopyleft = components.filter(component => component.licenses.some( - license => !!license.copyleft || this.copyleftLicenses.has(license.spdxid.trim().toLowerCase()) + license => !!license.copyleft || licenseUtil.isCopyLeft(license.spdxid.trim().toLowerCase()) ) ); @@ -107,12 +107,12 @@ export class CopyleftPolicyCheck extends PolicyCheck { components.forEach(component => { component.licenses.forEach(license => { - const copyleftIcon = license.copyleft ? ':x:' : ' '; + const copyleftIcon = licenseUtil.isCopyLeft(license.spdxid?.trim().toLowerCase()) ? ':x:' : ' '; rows.push([ component.purl, component.version, license.spdxid, - `${getOSADL(license.spdxid) || ''}`, + `${licenseUtil.getOSADL(license?.spdxid) || ''}`, copyleftIcon ]); }); diff --git a/src/services/report.service.ts b/src/services/report.service.ts index 1ef591c..a1086c0 100644 --- a/src/services/report.service.ts +++ b/src/services/report.service.ts @@ -27,7 +27,7 @@ import * as core from '@actions/core'; import { CONCLUSION, PolicyCheck } from '../policies/policy-check'; import { generateTable } from '../utils/markdown.utils'; import { context } from '@actions/github'; -import { getOSADL } from '../utils/license.utils'; +import { licenseUtil } from '../utils/license.utils'; export function generatePRSummary(scannerResults: ScannerResults, policies: PolicyCheck[]): string { const components = getComponents(scannerResults); @@ -83,7 +83,7 @@ export async function generateJobSummary(scannerResults: ScannerResults, policie items.forEach(l => { const copyleftIcon = l.copyleft ? ':x:' : ' '; - ROWS.push([l.spdxid, copyleftIcon, `${getOSADL(l.spdxid) || ''}`]); + ROWS.push([l.spdxid, copyleftIcon, `${licenseUtil.getOSADL(l?.spdxid) || ''}`]); }); return generateTable(HEADERS, ROWS); }; diff --git a/src/services/result.service.ts b/src/services/result.service.ts index 7a79a6b..a55ed14 100644 --- a/src/services/result.service.ts +++ b/src/services/result.service.ts @@ -22,7 +22,7 @@ */ import { ComponentID, DependencyComponent, ScannerComponent, ScannerResults } from './result.interfaces'; -import { getOSADL } from '../utils/license.utils'; +import { licenseUtil } from '../utils/license.utils'; //TODO: Move all functions to a class named ResultService that produces an object { licenses: []; compoments: []; dependencies: []; vulns: [];} @@ -58,7 +58,7 @@ export function getComponents(results: ScannerResults): Component[] { version: (c as ScannerComponent).version, licenses: (c as ScannerComponent).licenses.map(l => ({ spdxid: l.name, - copyleft: !l.copyleft ? null : l.copyleft === 'yes' ? true : false, + copyleft: licenseUtil.isCopyLeft(l.name?.trim().toLowerCase()), url: l?.url ? l.url : null, count: 1 })) @@ -72,7 +72,12 @@ export function getComponents(results: ScannerResults): Component[] { purl: d.purl, version: d.version, licenses: d.licenses - .map(l => ({ spdxid: l.spdx_id, copyleft: null, url: null, count: 1 })) + .map(l => ({ + spdxid: l.spdx_id, + copyleft: licenseUtil.isCopyLeft(l.spdx_id?.trim().toLowerCase()), + url: null, + count: 1 + })) .filter(l => l.spdxid) }); } @@ -123,8 +128,8 @@ export function getLicenses(results: ScannerResults): License[] { for (const l of (c as ScannerComponent).licenses) { licenses.push({ spdxid: l.name, - copyleft: !l.copyleft ? null : l.copyleft === 'yes' ? true : false, - url: getOSADL(l.name), + copyleft: licenseUtil.isCopyLeft(l.name.trim().toLowerCase()), + url: licenseUtil.getOSADL(l?.name), count: 1 }); } @@ -135,7 +140,12 @@ export function getLicenses(results: ScannerResults): License[] { for (const d of dependencies) { for (const l of d.licenses) { if (!l.spdx_id) continue; - licenses.push({ spdxid: l.spdx_id, copyleft: null, url: getOSADL(l.spdx_id), count: 1 }); + licenses.push({ + spdxid: l.spdx_id, + copyleft: licenseUtil.isCopyLeft(l.spdx_id?.trim().toLowerCase()), + url: licenseUtil.getOSADL(l?.spdx_id), + count: 1 + }); } } } diff --git a/src/utils/license.utils.ts b/src/utils/license.utils.ts index 88c50ed..7dd2e6c 100644 --- a/src/utils/license.utils.ts +++ b/src/utils/license.utils.ts @@ -1,3 +1,48 @@ -export const getOSADL = (spdxid: string): string => { - return `https://spdx.org/licenses/${spdxid}.html`; -}; +export class LicenseUtil { + private BASE_OSADL_URL = 'https://spdx.org/licenses'; + private HTML = 'html'; + constructor() { + this.init(); + } + + private defaultCopyleftLicenses = new Set( + [ + 'GPL-1.0-only', + 'GPL-2.0-only', + 'GPL-3.0-only', + 'AGPL-3.0-only', + 'Sleepycat', + 'Watcom-1.0', + 'GFDL-1.1-only', + 'GFDL-1.2-only', + 'GFDL-1.3-only', + 'LGPL-2.1-only', + 'LGPL-3.0-only', + 'MPL-1.1', + 'MPL-2.0', + 'EPL-1.0', + 'EPL-2.0', + 'CDDL-1.0', + 'CDDL-1.1', + 'CECILL-2.1', + 'Artistic-1.0', + 'Artistic-2.0', + 'CC-BY-SA-4.0' + ].map(l => l.toLowerCase()) + ); + + private copyLeftLicenses = new Set(); + + private init(): void { + this.copyLeftLicenses = this.defaultCopyleftLicenses; + } + + isCopyLeft(spdxid: string): boolean { + return this.copyLeftLicenses.has(spdxid); + } + + getOSADL(spdxid: string): string { + return `${this.BASE_OSADL_URL}/${spdxid}/.${this.HTML}`; + } +} +export const licenseUtil = new LicenseUtil();