Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ad5088379 | ||
|
|
7c391b7f4b |
@@ -156,44 +156,6 @@ describe("ComponentDetection.processComponentsToManifests", () => {
|
|||||||
expect(manifests[0].indirectDependencies()).toHaveLength(1);
|
expect(manifests[0].indirectDependencies()).toHaveLength(1);
|
||||||
expect(manifests[0].countDependencies()).toBe(1);
|
expect(manifests[0].countDependencies()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("un-escapes URL-encoded locationsFoundAt", () => {
|
|
||||||
const componentsFound = [
|
|
||||||
{
|
|
||||||
component: {
|
|
||||||
name: "test-package",
|
|
||||||
version: "1.0.0",
|
|
||||||
packageUrl: {
|
|
||||||
Scheme: "pkg",
|
|
||||||
Type: "nuget",
|
|
||||||
Name: "test-package",
|
|
||||||
Version: "1.0.0"
|
|
||||||
},
|
|
||||||
id: "test-package 1.0.0 - nuget"
|
|
||||||
},
|
|
||||||
isDevelopmentDependency: false,
|
|
||||||
topLevelReferrers: [], // Empty = direct dependency
|
|
||||||
locationsFoundAt: ["/my%20project/my%20project.csproj"]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const dependencyGraphs: DependencyGraphs = {
|
|
||||||
"my project/my project.csproj": {
|
|
||||||
graph: { "test-package": null },
|
|
||||||
explicitlyReferencedComponentIds: ["test-package 1.0.0 - nuget"],
|
|
||||||
developmentDependencies: [],
|
|
||||||
dependencies: []
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const manifests = ComponentDetection.processComponentsToManifests(componentsFound, dependencyGraphs);
|
|
||||||
|
|
||||||
expect(manifests).toHaveLength(1);
|
|
||||||
expect(manifests[0].name).toBe("my project/my project.csproj");
|
|
||||||
expect(manifests[0].directDependencies()).toHaveLength(1);
|
|
||||||
expect(manifests[0].indirectDependencies()).toHaveLength(0);
|
|
||||||
expect(manifests[0].countDependencies()).toBe(1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('normalizeDependencyGraphPaths', () => {
|
describe('normalizeDependencyGraphPaths', () => {
|
||||||
|
|||||||
@@ -154,9 +154,7 @@ export default class ComponentDetection {
|
|||||||
packages.forEach((pkg: ComponentDetectionPackage) => {
|
packages.forEach((pkg: ComponentDetectionPackage) => {
|
||||||
pkg.locationsFoundAt.forEach((location: any) => {
|
pkg.locationsFoundAt.forEach((location: any) => {
|
||||||
// Use the normalized path (remove leading slash if present)
|
// Use the normalized path (remove leading slash if present)
|
||||||
let normalizedLocation = location.startsWith('/') ? location.substring(1) : location;
|
const normalizedLocation = location.startsWith('/') ? location.substring(1) : location;
|
||||||
// Unescape the path, as upstream ComponentDetection emits locationsFoundAt in URL-encoded form
|
|
||||||
normalizedLocation = decodeURIComponent(normalizedLocation);
|
|
||||||
|
|
||||||
if (!manifests.find((manifest: Manifest) => manifest.name == normalizedLocation)) {
|
if (!manifests.find((manifest: Manifest) => manifest.name == normalizedLocation)) {
|
||||||
const manifest = new Manifest(normalizedLocation, normalizedLocation);
|
const manifest = new Manifest(normalizedLocation, normalizedLocation);
|
||||||
|
|||||||
+1
-3
@@ -36129,9 +36129,7 @@ class ComponentDetection {
|
|||||||
pkg.locationsFoundAt.forEach((location) => {
|
pkg.locationsFoundAt.forEach((location) => {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
// Use the normalized path (remove leading slash if present)
|
// Use the normalized path (remove leading slash if present)
|
||||||
let normalizedLocation = location.startsWith('/') ? location.substring(1) : location;
|
const normalizedLocation = location.startsWith('/') ? location.substring(1) : location;
|
||||||
// Unescape the path, as upstream ComponentDetection emits locationsFoundAt in URL-encoded form
|
|
||||||
normalizedLocation = decodeURIComponent(normalizedLocation);
|
|
||||||
if (!manifests.find((manifest) => manifest.name == normalizedLocation)) {
|
if (!manifests.find((manifest) => manifest.name == normalizedLocation)) {
|
||||||
const manifest = new dependency_submission_toolkit_1.Manifest(normalizedLocation, normalizedLocation);
|
const manifest = new dependency_submission_toolkit_1.Manifest(normalizedLocation, normalizedLocation);
|
||||||
manifests.push(manifest);
|
manifests.push(manifest);
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Generated
+4681
-8627
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -30,22 +30,22 @@
|
|||||||
"@actions/github": "^6.0.1",
|
"@actions/github": "^6.0.1",
|
||||||
"@github/dependency-submission-toolkit": "^2.0.5",
|
"@github/dependency-submission-toolkit": "^2.0.5",
|
||||||
"cross-fetch": "^4.1.0",
|
"cross-fetch": "^4.1.0",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^16.5.0",
|
||||||
"fs": "^0.0.1-security",
|
"fs": "^0.0.1-security",
|
||||||
"octokit": "^5.0.5",
|
"octokit": "^4.1.3",
|
||||||
"tar": "^7.5.2",
|
"tar": "^7.4.3",
|
||||||
"yaml": "^2.8.1"
|
"yaml": "^2.7.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.28.5",
|
"@babel/preset-env": "^7.27.2",
|
||||||
"@babel/preset-typescript": "^7.28.5",
|
"@babel/preset-typescript": "^7.27.1",
|
||||||
"@eslint/js": "^9.39.1",
|
"@eslint/js": "^9.26.0",
|
||||||
"@types/glob": "^9.0.0",
|
"@types/glob": "^8.1.0",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^29.5.14",
|
||||||
"@vercel/ncc": "^0.38.4",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.26.0",
|
||||||
"jest": "^30.2.0",
|
"jest": "^29.7.0",
|
||||||
"jest-transform-stub": "^2.0.0",
|
"jest-transform-stub": "^2.0.0",
|
||||||
"ts-jest": "^29.4.5"
|
"ts-jest": "^29.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+18
-18
@@ -685,9 +685,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/eslintrc/node_modules/js-yaml": {
|
"node_modules/@eslint/eslintrc/node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
@@ -2273,9 +2273,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint/node_modules/js-yaml": {
|
"node_modules/eslint/node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
@@ -3541,9 +3541,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "3.14.2",
|
"version": "3.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^1.0.7",
|
"argparse": "^1.0.7",
|
||||||
@@ -5338,9 +5338,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-yaml": {
|
"js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
@@ -6538,9 +6538,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"js-yaml": {
|
"js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
@@ -7525,9 +7525,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"js-yaml": {
|
"js-yaml": {
|
||||||
"version": "3.14.2",
|
"version": "3.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"argparse": "^1.0.7",
|
"argparse": "^1.0.7",
|
||||||
|
|||||||
Reference in New Issue
Block a user