mirror of
https://github.com/n8n-io/n8n.git
synced 2026-12-04 00:30:34 +00:00
fix: Resolve missing release SBOM licenses (no-changelog) (#42911)
Co-authored-by: n8n-cat-bot[bot] <283985454+n8n-cat-bot[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
2beb2e368a
commit
beffde2ca3
2 files changed
+69
No files matched your search
@@ -28,6 +28,22 @@
|
||||
"pkg:npm/streamsearch@1.1.0": {
|
||||
"license": "MIT",
|
||||
"source": "compiled/node_modules/streamsearch/LICENSE — package.json uses legacy licenses[] array"
|
||||
},
|
||||
"pkg:npm/xmlhttprequest-ssl@2.1.2": {
|
||||
"license": "MIT",
|
||||
"source": "compiled/node_modules/xmlhttprequest-ssl/LICENSE — MIT text. package.json uses a legacy licenses[] array."
|
||||
},
|
||||
"pkg:npm/simple-lru-cache@0.0.2": {
|
||||
"license": "MIT",
|
||||
"source": "compiled/node_modules/simple-lru-cache/LICENSE — MIT text. package.json uses a legacy licenses[] array."
|
||||
},
|
||||
"pkg:npm/cohere-ai@7.14.0": {
|
||||
"license": "MIT",
|
||||
"source": "compiled/node_modules/cohere-ai/LICENSE — MIT text. The published package.json has no license field."
|
||||
},
|
||||
"pkg:npm/%40kafkajs/confluent-schema-registry@3.8.0": {
|
||||
"license": "MIT",
|
||||
"source": "compiled/node_modules/@kafkajs/confluent-schema-registry/LICENSE — MIT text. The published package.json has no license field."
|
||||
}
|
||||
},
|
||||
"byName": {
|
||||
|
||||
@@ -5,6 +5,9 @@ import { mkdtemp, mkdir, rm, readFile, copyFile, writeFile } from 'node:fs/promi
|
||||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { enrichSbom, loadLicenseConfig } from './enrich-sbom.mjs';
|
||||
import { checkSbom, loadSpdxIds } from './check-sbom-licenses.mjs';
|
||||
import { qualifiedName, renderSbom } from './render-licenses-md.mjs';
|
||||
|
||||
// End-to-end test of the release-blocking license chain: enrich-sbom feeds
|
||||
// check-sbom-licenses, driven as real CLIs (main(), arg parsing, exit codes,
|
||||
@@ -189,3 +192,53 @@ describe('image license resolutions (shipped config)', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('release license resolutions (shipped config)', () => {
|
||||
it('resolves packages with missing license metadata in the SBOM and license manifest', async () => {
|
||||
const raw = {
|
||||
components: [
|
||||
{
|
||||
name: 'xmlhttprequest-ssl',
|
||||
version: '2.1.2',
|
||||
purl: 'pkg:npm/xmlhttprequest-ssl@2.1.2',
|
||||
licenses: [],
|
||||
},
|
||||
{
|
||||
name: 'simple-lru-cache',
|
||||
version: '0.0.2',
|
||||
purl: 'pkg:npm/simple-lru-cache@0.0.2',
|
||||
licenses: [],
|
||||
},
|
||||
{
|
||||
name: 'cohere-ai',
|
||||
version: '7.14.0',
|
||||
purl: 'pkg:npm/cohere-ai@7.14.0',
|
||||
licenses: [],
|
||||
},
|
||||
{
|
||||
group: '@kafkajs',
|
||||
name: 'confluent-schema-registry',
|
||||
version: '3.8.0',
|
||||
purl: 'pkg:npm/%40kafkajs/confluent-schema-registry@3.8.0',
|
||||
licenses: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
const gateOptions = { validIds: await loadSpdxIds(), allowRefs: new Set() };
|
||||
assert.equal(checkSbom(raw, gateOptions).failures.length, 4);
|
||||
|
||||
const config = await loadLicenseConfig();
|
||||
const { sbom } = enrichSbom(raw, config);
|
||||
for (const component of sbom.components) {
|
||||
assert.deepEqual(component.licenses, [{ license: { id: 'MIT' } }], component.purl);
|
||||
}
|
||||
assert.deepEqual(checkSbom(sbom, gateOptions).failures, []);
|
||||
|
||||
const { markdown, unresolved } = await renderSbom(sbom, {});
|
||||
assert.deepEqual(unresolved, []);
|
||||
assert.ok(markdown.includes('## MIT\n'));
|
||||
for (const component of raw.components) {
|
||||
assert.ok(markdown.includes(`* ${qualifiedName(component)} ${component.version}\n`));
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user