snyk 1.1260.0 → 1.1261.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/245.index.js +78 -46
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +4 -4
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -226490,7 +226490,7 @@ exports.extractPkgsFromNpmLockV2 = extractPkgsFromNpmLockV2;
|
|
|
226490
226490
|
"use strict";
|
|
226491
226491
|
|
|
226492
226492
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
226493
|
-
exports.getChildNodeKey = exports.buildDepGraphNpmLockV2 = exports.parseNpmLockV2Project = exports.extractPkgsFromNpmLockV2 = void 0;
|
|
226493
|
+
exports.matchOverrideKey = exports.getChildNodeKey = exports.buildDepGraphNpmLockV2 = exports.parseNpmLockV2Project = exports.extractPkgsFromNpmLockV2 = void 0;
|
|
226494
226494
|
const extract_npm_lock_v2_pkgs_1 = __webpack_require__(61253);
|
|
226495
226495
|
Object.defineProperty(exports, "extractPkgsFromNpmLockV2", ({ enumerable: true, get: function () { return extract_npm_lock_v2_pkgs_1.extractPkgsFromNpmLockV2; } }));
|
|
226496
226496
|
const dep_graph_1 = __webpack_require__(71479);
|
|
@@ -226577,9 +226577,16 @@ const dfsVisit = async (depGraphBuilder, node, visitedMap, npmLockPkgs, strictOu
|
|
|
226577
226577
|
}
|
|
226578
226578
|
};
|
|
226579
226579
|
const getChildNode = (name, depInfo, pkgs, strictOutOfSync, includeDevDeps, includeOptionalDeps, ancestry, pkgKeysByName, overrides) => {
|
|
226580
|
+
let version = depInfo.version;
|
|
226580
226581
|
const override = overrides &&
|
|
226581
|
-
checkOverrides([...ancestry, { name, version
|
|
226582
|
-
|
|
226582
|
+
checkOverrides([...ancestry, { name, version }], overrides);
|
|
226583
|
+
if (override) {
|
|
226584
|
+
version = override;
|
|
226585
|
+
}
|
|
226586
|
+
if (version.startsWith('npm:')) {
|
|
226587
|
+
version = version.split('@').pop() || version;
|
|
226588
|
+
}
|
|
226589
|
+
let childNodeKey = (0, exports.getChildNodeKey)(name, version, ancestry, pkgs, pkgKeysByName);
|
|
226583
226590
|
if (!childNodeKey) {
|
|
226584
226591
|
if (strictOutOfSync) {
|
|
226585
226592
|
throw new errors_1.OutOfSyncError(`${name}@${depInfo.version}`, parsers_1.LockfileType.npm);
|
|
@@ -226726,7 +226733,7 @@ const checkOverrides = (ancestry, overrides) => {
|
|
|
226726
226733
|
// First traverse into overrides from root down
|
|
226727
226734
|
for (const [idx, pkg] of ancestryWithoutRoot.entries()) {
|
|
226728
226735
|
// Do we have this in overrides
|
|
226729
|
-
const override = overrides
|
|
226736
|
+
const override = (0, exports.matchOverrideKey)(overrides, pkg);
|
|
226730
226737
|
// If we dont find current element move down the ancestry
|
|
226731
226738
|
if (!override) {
|
|
226732
226739
|
continue;
|
|
@@ -226752,6 +226759,37 @@ const checkOverrides = (ancestry, overrides) => {
|
|
|
226752
226759
|
}
|
|
226753
226760
|
return;
|
|
226754
226761
|
};
|
|
226762
|
+
// Here we have to match our pkg to
|
|
226763
|
+
// possible keys in the overrides object
|
|
226764
|
+
const matchOverrideKey = (overrides, pkg) => {
|
|
226765
|
+
if (overrides[pkg.name]) {
|
|
226766
|
+
return overrides[pkg.name];
|
|
226767
|
+
}
|
|
226768
|
+
const overrideKeysNameToVersions = Object.keys(overrides).reduce((acc, key) => {
|
|
226769
|
+
// Split the key to separate the package name from the version spec
|
|
226770
|
+
const atIndex = key.lastIndexOf('@');
|
|
226771
|
+
const name = key.substring(0, atIndex);
|
|
226772
|
+
const versionSpec = key.substring(atIndex + 1);
|
|
226773
|
+
// Check if the package name already exists in the accumulator
|
|
226774
|
+
if (!acc[name]) {
|
|
226775
|
+
acc[name] = [];
|
|
226776
|
+
}
|
|
226777
|
+
// Add the version spec to the list of versions for this package name
|
|
226778
|
+
acc[name].push(versionSpec);
|
|
226779
|
+
return acc;
|
|
226780
|
+
}, {});
|
|
226781
|
+
const computedOverrides = overrideKeysNameToVersions[pkg.name];
|
|
226782
|
+
if (computedOverrides) {
|
|
226783
|
+
for (const versionSpec of computedOverrides) {
|
|
226784
|
+
const isPkgVersionSubsetOfOverrideSpec = semver.subset(pkg.version, semver.validRange(versionSpec));
|
|
226785
|
+
if (isPkgVersionSubsetOfOverrideSpec) {
|
|
226786
|
+
return overrides[`${pkg.name}@${versionSpec}`];
|
|
226787
|
+
}
|
|
226788
|
+
}
|
|
226789
|
+
}
|
|
226790
|
+
return null;
|
|
226791
|
+
};
|
|
226792
|
+
exports.matchOverrideKey = matchOverrideKey;
|
|
226755
226793
|
//# sourceMappingURL=index.js.map
|
|
226756
226794
|
|
|
226757
226795
|
/***/ }),
|
|
@@ -237200,7 +237238,9 @@ async function buildDepGraphFromFiles(root, targetFile, manifestType, useProject
|
|
|
237200
237238
|
if (!((_a = projectAssets.project) === null || _a === void 0 ? void 0 : _a.frameworks)) {
|
|
237201
237239
|
throw new errors_1.FileNotProcessableError(`unable to detect any target framework in manifest file ${safeTargetFile}, a valid one is needed to continue down this path.`);
|
|
237202
237240
|
}
|
|
237203
|
-
|
|
237241
|
+
// Scan all 'frameworks' detected in the project.assets.json file, and use the targetAlias if detected and
|
|
237242
|
+
// otherwise the raw key name, as it's not guaranteed that all framework objects contains a targetAlias.
|
|
237243
|
+
const targetFrameworks = Object.entries(projectAssets.project.frameworks).map(([key, value]) => ('targetAlias' in value ? value.targetAlias : key));
|
|
237204
237244
|
if (targetFrameworks.length <= 0) {
|
|
237205
237245
|
throw new errors_1.FileNotProcessableError(`unable to detect a target framework in ${projectRootFolder}, a valid one is needed to continue down this path.`);
|
|
237206
237246
|
}
|
|
@@ -237662,8 +237702,6 @@ function buildGraph(projectName, projectAssets, publishedProjectDeps, runtimeAss
|
|
|
237662
237702
|
name: projectName,
|
|
237663
237703
|
version: projectAssets.project.version,
|
|
237664
237704
|
});
|
|
237665
|
-
// That's what `dotnet` wants to call this project. Which is not always the same as what Snyk wants to call it.
|
|
237666
|
-
const restoreProjectName = `${projectAssets.project.restore.projectName}/${projectAssets.project.version}`;
|
|
237667
237705
|
// We publish to one RID and one only, so we can safely assume that the true dependencies will exist in this key.
|
|
237668
237706
|
// E.g. targets -> .NETCoreApp,Version=v8.0/osx-arm64
|
|
237669
237707
|
const runtimeTarget = publishedProjectDeps.runtimeTarget.name;
|
|
@@ -237674,26 +237712,22 @@ function buildGraph(projectName, projectAssets, publishedProjectDeps, runtimeAss
|
|
|
237674
237712
|
if (!(runtimeTarget in publishedProjectDeps.targets)) {
|
|
237675
237713
|
throw new errors_1.InvalidManifestError(`no ${runtimeTarget} found in targets object, cannot continue without it`);
|
|
237676
237714
|
}
|
|
237677
|
-
|
|
237678
|
-
|
|
237679
|
-
|
|
237680
|
-
const
|
|
237681
|
-
|
|
237715
|
+
// What `dotnet` wants to call this project is not always the same as what Snyk wants to call it, and the version
|
|
237716
|
+
// postfix is not the same as what's defined in `project.assets.json` due to NuGet version normalization, which is
|
|
237717
|
+
// not applied during publish, only during restore. So we have to rely on the fact that the name is enough.
|
|
237718
|
+
const restoreProjectName = Object.keys(publishedProjectDeps.targets[runtimeTarget]).find((f) => f.startsWith(projectAssets.project.restore.projectName));
|
|
237719
|
+
if (!restoreProjectName) {
|
|
237720
|
+
throw new errors_1.InvalidManifestError(`no project name containing ${projectAssets.project.restore.projectName} found in ${runtimeTarget} object, cannot continue without it`);
|
|
237721
|
+
}
|
|
237722
|
+
// Find names and versions of all dependencies of the root package. These are already structured correctly in
|
|
237723
|
+
// the deps.json generated by `dotnet publish`.
|
|
237724
|
+
const topLevelDepPackages = publishedProjectDeps.targets[runtimeTarget][restoreProjectName]
|
|
237725
|
+
.dependencies;
|
|
237682
237726
|
// Iterate over all the dependencies found in the target dependency list, and build the depGraph based off of that.
|
|
237683
237727
|
const targetDependencies = Object.entries(publishedProjectDeps.targets[runtimeTarget]).reduce((acc, entry) => {
|
|
237684
237728
|
const [nameWithVersion, pkg] = entry;
|
|
237685
237729
|
return { ...acc, [nameWithVersion]: pkg };
|
|
237686
237730
|
}, {});
|
|
237687
|
-
const topLevelDepPackages = topLevelDependencies.reduce((acc, topLevelDepName) => {
|
|
237688
|
-
const nameWithVersion = Object.keys(targetDependencies).find((targetDep) =>
|
|
237689
|
-
// Lowercase the comparison, as .csproj <PackageReference>s are not case-sensitive, and can be written however you like.
|
|
237690
|
-
targetDep.toLowerCase().startsWith(topLevelDepName.toLowerCase()));
|
|
237691
|
-
if (!nameWithVersion) {
|
|
237692
|
-
throw new errors_1.InvalidManifestError(`cant find a name and a version in assets file, something's very malformed`);
|
|
237693
|
-
}
|
|
237694
|
-
const [name, version] = nameWithVersion.split('/');
|
|
237695
|
-
return { ...acc, [name]: version };
|
|
237696
|
-
}, {});
|
|
237697
237731
|
const rootNode = {
|
|
237698
237732
|
type: 'root',
|
|
237699
237733
|
dependencies: topLevelDepPackages,
|
|
@@ -238260,23 +238294,21 @@ function generateRuntimeAssemblies(deps) {
|
|
|
238260
238294
|
if (!deps.targets) {
|
|
238261
238295
|
throw new errors.FileNotProcessableError('could not find any targets in deps file');
|
|
238262
238296
|
}
|
|
238263
|
-
|
|
238264
|
-
|
|
238265
|
-
|
|
238297
|
+
if (!(runtimeTargetName in deps.targets)) {
|
|
238298
|
+
throw new errors.FileNotProcessableError(`could not locate ${runtimeTargetName} in list of targets, cannot continue`);
|
|
238299
|
+
}
|
|
238300
|
+
// Run through all runtimepacks in target, indexed for example as
|
|
238301
|
+
// runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/7.0.14
|
|
238302
|
+
// runtimepack.Microsoft.AspNetCore.App.Runtime.osx-arm64/7.0.14
|
|
238266
238303
|
// ... etc.
|
|
238267
238304
|
// See all: https://github.com/dotnet/runtime/blob/bd83e17052d3c09022bad1d91dca860ca6b27ab9/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
|
|
238268
238305
|
let runtimeAssemblyVersions = {};
|
|
238269
|
-
Object.
|
|
238270
|
-
|
|
238271
|
-
|
|
238272
|
-
|
|
238273
|
-
|
|
238274
|
-
|
|
238275
|
-
// but guard against it to ensure good user feedback in case we did something wrong.
|
|
238276
|
-
const runtimePack = Object.keys(dependencies).find((dep) => dep.startsWith('runtimepack'));
|
|
238277
|
-
if (!runtimePack) {
|
|
238278
|
-
throw new errors.FileNotProcessableError(`could not find any runtimepack.* identifier in the ${target} dependency`);
|
|
238279
|
-
}
|
|
238306
|
+
const runtimePacks = Object.keys(deps.targets[runtimeTargetName]).filter((t) => t.startsWith('runtimepack'));
|
|
238307
|
+
if (runtimePacks.length <= 0) {
|
|
238308
|
+
throw new errors.FileNotProcessableError(`could not find any runtimepack.* identifiers in ${runtimeTargetName}, cannot continue`);
|
|
238309
|
+
}
|
|
238310
|
+
runtimePacks.forEach((runtimePack) => {
|
|
238311
|
+
const dependencies = deps.targets[runtimeTargetName][runtimePack];
|
|
238280
238312
|
// The runtimepack contains all the current RuntimeIdentifier (RID) assemblies which we are interested in.
|
|
238281
238313
|
// Such as
|
|
238282
238314
|
// "runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/6.0.16": {
|
|
@@ -238285,10 +238317,10 @@ function generateRuntimeAssemblies(deps) {
|
|
|
238285
238317
|
// }
|
|
238286
238318
|
// }
|
|
238287
238319
|
// We traverse all those and store them for the dependency graph build.
|
|
238288
|
-
if (!('runtime' in dependencies
|
|
238320
|
+
if (!('runtime' in dependencies)) {
|
|
238289
238321
|
throw new errors.FileNotProcessableError(`could not find any runtime list in the ${runtimePack} dependency`);
|
|
238290
238322
|
}
|
|
238291
|
-
const runtimes = dependencies[
|
|
238323
|
+
const runtimes = dependencies['runtime'];
|
|
238292
238324
|
// Dig down into the specific runtimepack which contains all the assembly versions of
|
|
238293
238325
|
// the bundled DLLs for the given runtime, as:
|
|
238294
238326
|
// "runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/6.0.16": {
|
|
@@ -238304,14 +238336,14 @@ function generateRuntimeAssemblies(deps) {
|
|
|
238304
238336
|
// (...)
|
|
238305
238337
|
// We currently only address assemblyVersions. FileVersion might become relevant, depending
|
|
238306
238338
|
// on how vulnerabilities are reported in the future.
|
|
238307
|
-
runtimeAssemblyVersions =
|
|
238308
|
-
|
|
238309
|
-
|
|
238310
|
-
|
|
238311
|
-
|
|
238312
|
-
|
|
238313
|
-
|
|
238314
|
-
|
|
238339
|
+
runtimeAssemblyVersions = {
|
|
238340
|
+
...runtimeAssemblyVersions,
|
|
238341
|
+
...Object.entries(runtimes).reduce((acc, [dll, versions]) => {
|
|
238342
|
+
// Take the version number (N.N.N.N) and remove the last element, in order for vulndb to understand anything.
|
|
238343
|
+
acc[dll] = versions.assemblyVersion.split('.').slice(0, -1).join('.');
|
|
238344
|
+
return acc;
|
|
238345
|
+
}, {}),
|
|
238346
|
+
};
|
|
238315
238347
|
});
|
|
238316
238348
|
if ((0, lodash_1.isEmpty)(runtimeAssemblyVersions)) {
|
|
238317
238349
|
throw new errors.FileNotProcessableError('collection of runtime assembly versions was empty, that should not happen');
|