From b9840144eba909b9d8552c9e4f94f0dbad286bd5 Mon Sep 17 00:00:00 2001 From: Agustin Isasmendi Date: Mon, 22 Jan 2024 14:42:34 +0100 Subject: [PATCH] SCP-48 Extract licenses from results --- .github/workflows/test-action.yml | 23 ++++---- .prettierrc.json | 2 +- __tests__/main.test.ts | 21 ++----- dist/index.js | 86 +++++++++++++++++++++++++++ results.json | 0 src/main.ts | 7 ++- src/services/result.interfaces.ts | 98 +++++++++++++++++++++++++++++++ src/services/result.service.ts | 31 ++++++++++ src/services/result.test.ts | 52 ++++++++++++++++ 9 files changed, 288 insertions(+), 32 deletions(-) create mode 100644 results.json create mode 100644 src/services/result.interfaces.ts create mode 100644 src/services/result.service.ts create mode 100644 src/services/result.test.ts diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index e21a7a3..19c2aaa 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - main + - '*' permissions: contents: read @@ -12,23 +12,20 @@ permissions: jobs: test-action: name: GitHub Actions Test - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Checkout id: checkout uses: actions/checkout@v4 - - name: Setup Python - id: setup-python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - run: pip install scanoss[fast_winnowing] scancode-toolkit +# - name: Setup Python +# id: setup-python +# uses: actions/setup-python@v5 +# with: +# python-version: '3.10' +# +# - run: pip install scanoss[fast_winnowing] scancode-toolkit - name: Test Local Action id: test-action @@ -36,4 +33,4 @@ jobs: - name: Print Output id: output - run: cat "${{ steps.test-action.outputs.result-filepath }}" + run: echo "${{ steps.test-action.outputs.licenses }}" diff --git a/.prettierrc.json b/.prettierrc.json index a378146..c173f6b 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,5 +1,5 @@ { - "printWidth": 80, + "printWidth": 120, "tabWidth": 2, "useTabs": false, "semi": false, diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 30efdfb..51100b8 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -49,19 +49,9 @@ describe('action', () => { // Verify that all of the core library functions were called correctly expect(debugMock).toHaveBeenNthCalledWith(1, 'Waiting 500 milliseconds ...') - expect(debugMock).toHaveBeenNthCalledWith( - 2, - expect.stringMatching(timeRegex) - ) - expect(debugMock).toHaveBeenNthCalledWith( - 3, - expect.stringMatching(timeRegex) - ) - expect(setOutputMock).toHaveBeenNthCalledWith( - 1, - 'time', - expect.stringMatching(timeRegex) - ) + expect(debugMock).toHaveBeenNthCalledWith(2, expect.stringMatching(timeRegex)) + expect(debugMock).toHaveBeenNthCalledWith(3, expect.stringMatching(timeRegex)) + expect(setOutputMock).toHaveBeenNthCalledWith(1, 'time', expect.stringMatching(timeRegex)) expect(errorMock).not.toHaveBeenCalled() }) @@ -80,10 +70,7 @@ describe('action', () => { expect(runMock).toHaveReturned() // Verify that all of the core library functions were called correctly - expect(setFailedMock).toHaveBeenNthCalledWith( - 1, - 'milliseconds not a number' - ) + expect(setFailedMock).toHaveBeenNthCalledWith(1, 'milliseconds not a number') expect(errorMock).not.toHaveBeenCalled() }) }) diff --git a/dist/index.js b/dist/index.js index 67da29b..b68a024 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3985,6 +3985,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.run = void 0; const core = __importStar(__nccwpck_require__(186)); const exec = __importStar(__nccwpck_require__(514)); +const result_service_1 = __nccwpck_require__(414); /** * The main function for the action. * @returns {Promise} Resolves when the action is complete. @@ -4005,6 +4006,9 @@ async function run() { options.silent = true; // run scan await exec.exec('scanoss-py', ['scan', repoDir, '--output', outputPath], options); + const scannerResults = await (0, result_service_1.readResult)(outputPath); + const licenses = (0, result_service_1.getLicenses)(scannerResults); + core.setOutput('licenses', licenses.toString()); // set outputs for other workflow steps to use core.setOutput('result-filepath', outputPath); } @@ -4017,6 +4021,88 @@ async function run() { exports.run = run; +/***/ }), + +/***/ 554: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ComponentID = void 0; +var ComponentID; +(function (ComponentID) { + ComponentID["NONE"] = "none"; + ComponentID["FILE"] = "file"; + ComponentID["SNIPPET"] = "snippet"; + ComponentID["DEPENDENCY"] = "dependency"; +})(ComponentID || (exports.ComponentID = ComponentID = {})); + + +/***/ }), + +/***/ 414: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getLicenses = exports.readResult = void 0; +const result_interfaces_1 = __nccwpck_require__(554); +const fs = __importStar(__nccwpck_require__(147)); +async function readResult(filepath) { + const content = await fs.promises.readFile(filepath, 'utf-8'); + return JSON.parse(content); +} +exports.readResult = readResult; +function getLicenses(results) { + const licenses = new Set(); + for (const [path, component] of Object.entries(results)) { + component.forEach(c => { + if (c.id === result_interfaces_1.ComponentID.DEPENDENCY) { + ; + c.dependencies.forEach(d => { + d.licenses.forEach(l => { + licenses.add(l.spdx_id); + }); + }); + } + if (c.id === result_interfaces_1.ComponentID.FILE || c.id === result_interfaces_1.ComponentID.SNIPPET) { + ; + c.licenses.forEach(l => { + licenses.add(l.name); + }); + } + }); + } + return Array.from(licenses); +} +exports.getLicenses = getLicenses; + + /***/ }), /***/ 491: diff --git a/results.json b/results.json new file mode 100644 index 0000000..e69de29 diff --git a/src/main.ts b/src/main.ts index 08e5765..9a8bc74 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,6 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' +import { getLicenses, readResult } from './services/result.service' /** * The main function for the action. @@ -24,11 +25,15 @@ export async function run(): Promise { // run scan await exec.exec( - 'scanoss-py', + 'docker run -it ghcr.io/scanoss/scanoss-py:v1.9.0', ['scan', repoDir, '--output', outputPath], options ) + const scannerResults = await readResult(outputPath) + const licenses = getLicenses(scannerResults) + core.setOutput('licenses', licenses.toString()) + // set outputs for other workflow steps to use core.setOutput('result-filepath', outputPath) } catch (error) { diff --git a/src/services/result.interfaces.ts b/src/services/result.interfaces.ts new file mode 100644 index 0000000..3238efd --- /dev/null +++ b/src/services/result.interfaces.ts @@ -0,0 +1,98 @@ +export type ScannerResults = Record< + string, + ScannerComponent[] | DependencyComponent[] +> + +export enum ComponentID { + NONE = 'none', + FILE = 'file', + SNIPPET = 'snippet', + DEPENDENCY = 'dependency' +} + +interface CommonComponent { + id: ComponentID + status: string +} + +export interface DependencyComponent extends CommonComponent { + dependencies: { + licenses: { + is_spdx_approved: boolean + name: string + spdx_id: string + }[] + purl: string + url: string + version: string + }[] +} + +export interface ScannerComponent extends CommonComponent { + lines: string + oss_lines: string + matched: string + purl: string[] + vendor: string + component: string + version: string + latest: string + url: string + release_date: string + file: string + url_hash: string + file_hash: string + source_hash: string + file_url: string + licenses: { + name: string + patent_hints: string + copyleft: string + checklist_url: string + osadl_updated: string + source: string + incompatible_with?: string + }[] + dependencies: { + vendor: string + component: string + version: string + source: string + }[] + copyrights: { + name: string + source: string + }[] + vulnerabilities: { + ID: string + CVE: string + severity: string + reported: string + introduced: string + patched: string + summary: string + source: string + }[] + quality: { + score: string + source: string + }[] + cryptography: any[] + health: { + creation_date: string + issues: number + last_push: string + last_update: string + watchers: number + country: string + stars: number + forks: number + } + server: { + version: string + kb_version: { monthly: string; daily: string } + hostname: string + flags: string + elapsed: string + } +} diff --git a/src/services/result.service.ts b/src/services/result.service.ts new file mode 100644 index 0000000..17c2e0a --- /dev/null +++ b/src/services/result.service.ts @@ -0,0 +1,31 @@ +import { ComponentID, DependencyComponent, ScannerComponent, ScannerResults } from './result.interfaces' +import * as fs from 'fs' + +export async function readResult(filepath: string): Promise { + const content = await fs.promises.readFile(filepath, 'utf-8') + return JSON.parse(content) as ScannerResults +} + +export function getLicenses(results: ScannerResults) { + const licenses = new Set() + + for (const [path, component] of Object.entries(results)) { + component.forEach(c => { + if (c.id === ComponentID.DEPENDENCY) { + ;(c as DependencyComponent).dependencies.forEach(d => { + d.licenses.forEach(l => { + licenses.add(l.spdx_id) + }) + }) + } + + if (c.id === ComponentID.FILE || c.id === ComponentID.SNIPPET) { + ;(c as ScannerComponent).licenses.forEach(l => { + licenses.add(l.name) + }) + } + }) + } + + return Array.from(licenses) +} diff --git a/src/services/result.test.ts b/src/services/result.test.ts new file mode 100644 index 0000000..4940385 --- /dev/null +++ b/src/services/result.test.ts @@ -0,0 +1,52 @@ +import { ScannerResults } from './result.interfaces' +import { getLicenses } from './result.service' + +const licenseTableTest = [ + { + name: '1) license test', + 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: ['MIT'] + }, + { + name: '2) license test', + description: 'Only dependencies files', + 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: ['MIT', 'Apache-2.0', '0BSD'] + }, + { + name: '3) license test', + description: 'Scan without dependencies. It includes components with id:none, id:snippet and id:file', + 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"}}]}', + licenses: ['GPL-2.0-only', 'JSON', 'LicenseRef-scancode-unknown-license-reference', 'GPL-2.0-or-later'] + }, + { + name: '4) license test', + description: 'Scan with dependencies', + 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: [ + 'MIT', + 'GPL-2.0-only', + 'JSON', + 'LicenseRef-scancode-unknown-license-reference', + 'GPL-2.0-or-later', + 'Apache-2.0', + '0BSD' + ] + } +] + +describe('Test Results service', () => { + licenseTableTest.forEach(t => { + it(`${t.name}`, () => { + const scannerResults = JSON.parse(t.content) as ScannerResults + const licenses = getLicenses(scannerResults) + + expect(licenses.sort()).toEqual(t.licenses.sort()) + }) + }) +})