snyk-nuget-plugin 1.36.0 → 1.38.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/errors/big-tree-error.d.ts +5 -0
- package/dist/errors/cli-command-error.d.ts +5 -0
- package/dist/errors/file-not-found-error.d.ts +5 -0
- package/dist/errors/file-not-processable-error.d.ts +5 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/invalid-folder-format-error.d.ts +5 -0
- package/dist/errors/invalid-manifest-error.d.ts +5 -0
- package/dist/errors/invalid-target-file.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/nuget-parser/cli/dotnet.d.ts +4 -0
- package/dist/nuget-parser/cli/dotnet.js +8 -1
- package/dist/nuget-parser/cli/dotnet.js.map +1 -1
- package/dist/nuget-parser/cli/subprocess.d.ts +12 -0
- package/dist/nuget-parser/csharp/generator.d.ts +3 -0
- package/dist/nuget-parser/csharp/generator.js +66 -0
- package/dist/nuget-parser/csharp/generator.js.map +1 -0
- package/dist/nuget-parser/csharp/nugetframeworks_parser.d.ts +1 -0
- package/dist/nuget-parser/csharp/nugetframeworks_parser.js +85 -0
- package/dist/nuget-parser/csharp/nugetframeworks_parser.js.map +1 -0
- package/dist/nuget-parser/framework.d.ts +2 -0
- package/dist/nuget-parser/index.d.ts +7 -0
- package/dist/nuget-parser/index.js +19 -9
- package/dist/nuget-parser/index.js.map +1 -1
- package/dist/nuget-parser/parsers/csproj-parser.d.ts +2 -0
- package/dist/nuget-parser/parsers/dotnet-core-parser.d.ts +1 -0
- package/dist/nuget-parser/parsers/dotnet-core-v2-parser.d.ts +3 -0
- package/dist/nuget-parser/parsers/dotnet-core-v2-parser.js +40 -11
- package/dist/nuget-parser/parsers/dotnet-core-v2-parser.js.map +1 -1
- package/dist/nuget-parser/parsers/dotnet-framework-parser.d.ts +8 -0
- package/dist/nuget-parser/parsers/nuspec-parser.d.ts +3 -0
- package/dist/nuget-parser/parsers/packages-config-parser.d.ts +8 -0
- package/dist/nuget-parser/parsers/project-json-parser.d.ts +2 -0
- package/dist/nuget-parser/runtime-assembly.d.ts +3 -0
- package/dist/nuget-parser/types.d.ts +65 -0
- package/dist/nuget-parser/types.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BigTreeError } from './big-tree-error';
|
|
2
|
+
export { CliCommandError } from './cli-command-error';
|
|
3
|
+
export { FileNotFoundError } from './file-not-found-error';
|
|
4
|
+
export { FileNotProcessableError } from './file-not-processable-error';
|
|
5
|
+
export { InvalidManifestError } from './invalid-manifest-error';
|
|
6
|
+
export { InvalidTargetFile } from './invalid-target-file';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function validate(): Promise<void>;
|
|
2
|
+
export declare function restore(projectPath: string): Promise<void>;
|
|
3
|
+
export declare function run(projectPath: string, options: string[]): Promise<string>;
|
|
4
|
+
export declare function publish(projectPath: string, targetFramework?: string): Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.publish = exports.restore = exports.validate = void 0;
|
|
3
|
+
exports.publish = exports.run = exports.restore = exports.validate = void 0;
|
|
4
4
|
const debugModule = require("debug");
|
|
5
5
|
const errors_1 = require("../../errors");
|
|
6
6
|
const path = require("path");
|
|
@@ -41,6 +41,13 @@ async function restore(projectPath) {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
exports.restore = restore;
|
|
44
|
+
async function run(projectPath, options) {
|
|
45
|
+
const command = 'dotnet';
|
|
46
|
+
const args = ['run', '--project', projectPath].concat(options);
|
|
47
|
+
const response = await handle('run', command, args);
|
|
48
|
+
return response.stdout;
|
|
49
|
+
}
|
|
50
|
+
exports.run = run;
|
|
44
51
|
async function publish(projectPath, targetFramework) {
|
|
45
52
|
var _a;
|
|
46
53
|
const command = 'dotnet';
|
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,EAAE,CAAC;QAC7F,KAAK,CAAC,GAAG,CAAC,CAAC;QACX,MAAM,IAAI,wBAAe,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;KACnE;IAED,+GAA+G;IAC/G,uDAAuD;IACvD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC;AA7DD,0BA6DC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ProcessOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
env?: {
|
|
4
|
+
[name: string]: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface ExecResult {
|
|
8
|
+
stdout: string;
|
|
9
|
+
stderr: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function execute(command: string, args: string[], options?: ProcessOptions): Promise<ExecResult>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tearDown = exports.generate = void 0;
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
const debugModule = require("debug");
|
|
8
|
+
const NodeCache = require("node-cache");
|
|
9
|
+
const crypto = require("crypto");
|
|
10
|
+
const debug = debugModule('snyk');
|
|
11
|
+
const cache = new NodeCache();
|
|
12
|
+
// Use a simple, fast and not secure hashing algorithm just to ensure we don't return the same cached location for
|
|
13
|
+
// different types of files. This is mostly to speed up performance of tests, but in theory will also affect customers
|
|
14
|
+
// when scanning for multiple TargetFrameworks.
|
|
15
|
+
function generateCacheKey(files) {
|
|
16
|
+
const hash = crypto.createHash('sha256');
|
|
17
|
+
files
|
|
18
|
+
.map((f) => f.contents)
|
|
19
|
+
.forEach((content) => {
|
|
20
|
+
hash.update(content);
|
|
21
|
+
});
|
|
22
|
+
return hash.digest('hex');
|
|
23
|
+
}
|
|
24
|
+
// Importing .NET code from Typescript is not trivial and a bit lose cannon programming. However, we also want to keep
|
|
25
|
+
// this project dependent on as few packages as possible, so instead of opting into some "run .NET in Typescript" package,
|
|
26
|
+
// we do the simplest, which is this. Makes C# debugging a bit harder, but it's a compromise.
|
|
27
|
+
// Further, we also utilize this for our test fixtures. Running tests in parallel can cause race conditions for fixtures
|
|
28
|
+
// at-rest, if two tests are `dotnet publish`'ing to the same fixture folder. So we supply a generator for populating
|
|
29
|
+
// fixtures in temporary folders to keep the test stateless while ensuring parallelization.
|
|
30
|
+
function generate(tempDirNameSpace, files) {
|
|
31
|
+
const key = generateCacheKey(files);
|
|
32
|
+
const cached = cache.get(key);
|
|
33
|
+
if (cached) {
|
|
34
|
+
return cached;
|
|
35
|
+
}
|
|
36
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), `snyk-nuget-plugin-test-${tempDirNameSpace}-`));
|
|
37
|
+
let tempFilePath;
|
|
38
|
+
files.forEach((file) => {
|
|
39
|
+
tempFilePath = path.join(tempDir, file.name);
|
|
40
|
+
fs.writeFileSync(tempFilePath, file.contents);
|
|
41
|
+
});
|
|
42
|
+
debug(`Generated temporary CS files (${files
|
|
43
|
+
.map((f) => f.name)
|
|
44
|
+
.join(',')}) in ${tempDir}`);
|
|
45
|
+
cache.set(key, tempDir);
|
|
46
|
+
return tempDir;
|
|
47
|
+
}
|
|
48
|
+
exports.generate = generate;
|
|
49
|
+
function tearDown(dirs) {
|
|
50
|
+
debug(`Attempting to delete temporary CS files in ${dirs.join(',')}`);
|
|
51
|
+
for (const dir of dirs) {
|
|
52
|
+
if (!dir) {
|
|
53
|
+
// No tempDir to tear down. Assuming the test failed somewhere.
|
|
54
|
+
// Jest won't throw an error anyway if the operation fails.
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
fs.rmSync(dir, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
// Ignore it, test was tearing down anyway, and it seems Windows boxes especially don't like this.
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.tearDown = tearDown;
|
|
66
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../lib/nuget-parser/csharp/generator.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yBAAyB;AACzB,yBAAyB;AAEzB,qCAAqC;AACrC,wCAAwC;AACxC,iCAAiC;AAEjC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAElC,MAAM,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;AAE9B,kHAAkH;AAClH,sHAAsH;AACtH,+CAA+C;AAC/C,SAAS,gBAAgB,CAAC,KAAyB;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACzC,KAAK;SACF,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACtB,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACL,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,sHAAsH;AACtH,0HAA0H;AAC1H,6FAA6F;AAC7F,wHAAwH;AACxH,qHAAqH;AACrH,2FAA2F;AAC3F,SAAgB,QAAQ,CACtB,gBAAwB,EACxB,KAAyB;IAEzB,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,MAAM,GAAuB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,MAAM,EAAE;QACV,OAAO,MAAM,CAAC;KACf;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAC5B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,0BAA0B,gBAAgB,GAAG,CAAC,CACtE,CAAC;IAEF,IAAI,YAAoB,CAAC;IACzB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,KAAK,CACH,iCAAiC,KAAK;SACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,IAAI,CAAC,GAAG,CAAC,QAAQ,OAAO,EAAE,CAC9B,CAAC;IAEF,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACxB,OAAO,OAAO,CAAC;AACjB,CAAC;AA5BD,4BA4BC;AAED,SAAgB,QAAQ,CAAC,IAAc;IACrC,KAAK,CAAC,8CAA8C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEtE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,IAAI,CAAC,GAAG,EAAE;YACR,+DAA+D;YAC/D,2DAA2D;YAC3D,OAAO;SACR;QAED,IAAI;YACF,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;SACrC;QAAC,OAAO,KAAc,EAAE;YACvB,kGAAkG;SACnG;KACF;AACH,CAAC;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generate(): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const generator = require("./generator");
|
|
5
|
+
function generate() {
|
|
6
|
+
const files = [
|
|
7
|
+
{
|
|
8
|
+
name: 'Parse.csproj',
|
|
9
|
+
contents: `
|
|
10
|
+
<Project Sdk='Microsoft.NET.Sdk'>
|
|
11
|
+
<PropertyGroup>
|
|
12
|
+
<OutputType>Exe</OutputType>
|
|
13
|
+
<TargetFramework>net7.0</TargetFramework>
|
|
14
|
+
<ImplicitUsings>enable</ImplicitUsings>
|
|
15
|
+
<Nullable>enable</Nullable>
|
|
16
|
+
<RootNamespace>ShortNameToLongName</RootNamespace>
|
|
17
|
+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
|
18
|
+
</PropertyGroup>
|
|
19
|
+
|
|
20
|
+
<ItemGroup>
|
|
21
|
+
<PackageReference Include='Newtonsoft.Json' Version='13.0.3' />
|
|
22
|
+
<PackageReference Include='NuGet.Frameworks' Version='6.7.0' />
|
|
23
|
+
</ItemGroup>
|
|
24
|
+
</Project>
|
|
25
|
+
`,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Program.cs',
|
|
29
|
+
contents: `
|
|
30
|
+
using NuGet.Frameworks;
|
|
31
|
+
using Newtonsoft.Json;
|
|
32
|
+
|
|
33
|
+
namespace ShortNameToLongName;
|
|
34
|
+
|
|
35
|
+
class Program
|
|
36
|
+
{
|
|
37
|
+
static void Main(string[] args)
|
|
38
|
+
{
|
|
39
|
+
if (args.Length < 1)
|
|
40
|
+
{
|
|
41
|
+
Console.WriteLine("Usage: dotnet run <shortTargetFramework>");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
string shortName = args[0];
|
|
46
|
+
|
|
47
|
+
try
|
|
48
|
+
{
|
|
49
|
+
NuGetFramework framework = NuGetFramework.Parse(shortName);
|
|
50
|
+
string json = JsonConvert.SerializeObject(new
|
|
51
|
+
{
|
|
52
|
+
framework.Framework,
|
|
53
|
+
framework.Version,
|
|
54
|
+
framework.Platform,
|
|
55
|
+
framework.PlatformVersion,
|
|
56
|
+
framework.HasPlatform,
|
|
57
|
+
framework.HasProfile,
|
|
58
|
+
framework.Profile,
|
|
59
|
+
framework.DotNetFrameworkName,
|
|
60
|
+
framework.DotNetPlatformName,
|
|
61
|
+
framework.IsPCL,
|
|
62
|
+
framework.IsPackageBased,
|
|
63
|
+
framework.AllFrameworkVersions,
|
|
64
|
+
framework.IsUnsupported,
|
|
65
|
+
framework.IsAgnostic,
|
|
66
|
+
framework.IsAny,
|
|
67
|
+
framework.IsSpecificFramework,
|
|
68
|
+
ShortName = shortName
|
|
69
|
+
}, Formatting.None);
|
|
70
|
+
Console.Write(json);
|
|
71
|
+
}
|
|
72
|
+
catch (Exception ex)
|
|
73
|
+
{
|
|
74
|
+
Console.WriteLine($"Error: {ex.Message}");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`,
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
const tempDir = generator.generate('csharp', files);
|
|
82
|
+
return tempDir;
|
|
83
|
+
}
|
|
84
|
+
exports.generate = generate;
|
|
85
|
+
//# sourceMappingURL=nugetframeworks_parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nugetframeworks_parser.js","sourceRoot":"","sources":["../../../lib/nuget-parser/csharp/nugetframeworks_parser.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AAEzC,SAAgB,QAAQ;IACtB,MAAM,KAAK,GAAuB;QAChC;YACE,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE;;;;;;;;;;;;;;;;CAgBf;SACI;QACD;YACE,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDf;SACI;KACF,CAAC;IAEF,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC;AACjB,CAAC;AA/ED,4BA+EC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ManifestType } from './types';
|
|
2
|
+
import * as depGraphLib from '@snyk/dep-graph';
|
|
3
|
+
export declare function buildDepGraphFromFiles(root: string | undefined, targetFile: string | undefined, manifestType: ManifestType, useProjectNameFromAssetsFile: boolean, projectNamePrefix?: string, targetFramework?: string): Promise<{
|
|
4
|
+
dependencyGraph: depGraphLib.DepGraph;
|
|
5
|
+
targetFramework: string | undefined;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function buildDepTreeFromFiles(root: string | undefined, targetFile: string | undefined, packagesFolderPath: string | undefined, manifestType: ManifestType, useProjectNameFromAssetsFile: boolean, projectNamePrefix?: string): Promise<any>;
|
|
@@ -13,6 +13,7 @@ const packagesConfigParser = require("./parsers/packages-config-parser");
|
|
|
13
13
|
const errors_1 = require("../errors");
|
|
14
14
|
const types_1 = require("./types");
|
|
15
15
|
const dotnet = require("./cli/dotnet");
|
|
16
|
+
const nugetFrameworksParser = require("./csharp/nugetframeworks_parser");
|
|
16
17
|
const runtimeAssembly = require("./runtime-assembly");
|
|
17
18
|
const debug = debugModule('snyk');
|
|
18
19
|
const PARSERS = {
|
|
@@ -56,16 +57,18 @@ function getFileContents(fileContentPath) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
async function buildDepGraphFromFiles(root, targetFile, manifestType, useProjectNameFromAssetsFile, projectNamePrefix, targetFramework) {
|
|
59
|
-
var _a, _b;
|
|
60
|
+
var _a, _b, _c;
|
|
60
61
|
const safeRoot = root || '.';
|
|
61
62
|
const safeTargetFile = targetFile || '.';
|
|
62
63
|
const fileContentPath = path.resolve(safeRoot, safeTargetFile);
|
|
63
64
|
const fileContent = getFileContents(fileContentPath);
|
|
64
65
|
const projectRootFolder = path.resolve(fileContentPath, '../../');
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
66
|
+
const parser = PARSERS['dotnet-core-v2'];
|
|
67
|
+
const manifest = await parser.fileContentParser.parse(fileContent);
|
|
68
|
+
if (!((_a = manifest.project) === null || _a === void 0 ? void 0 : _a.frameworks)) {
|
|
69
|
+
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.`);
|
|
70
|
+
}
|
|
71
|
+
const targetFrameworks = Object.keys(manifest.project.frameworks);
|
|
69
72
|
if (targetFrameworks.length <= 0) {
|
|
70
73
|
throw new errors_1.FileNotProcessableError(`unable to detect a target framework in ${projectRootFolder}, a valid one is needed to continue down this path.`);
|
|
71
74
|
}
|
|
@@ -74,10 +77,8 @@ async function buildDepGraphFromFiles(root, targetFile, manifestType, useProject
|
|
|
74
77
|
manifest file. Available targetFrameworks detected was \x1b[1m${targetFrameworks.join(',')}\x1b[0m.
|
|
75
78
|
Will attempt to build dependency graph anyway, but the operation might fail.`);
|
|
76
79
|
}
|
|
77
|
-
const parser = PARSERS['dotnet-core-v2'];
|
|
78
|
-
const manifest = await parser.fileContentParser.parse(fileContent);
|
|
79
80
|
let resolvedProjectName = getRootName(root, projectRootFolder, projectNamePrefix);
|
|
80
|
-
const projectNameFromManifestFile = (
|
|
81
|
+
const projectNameFromManifestFile = (_c = (_b = manifest === null || manifest === void 0 ? void 0 : manifest.project) === null || _b === void 0 ? void 0 : _b.restore) === null || _c === void 0 ? void 0 : _c.projectName;
|
|
81
82
|
if (manifestType === types_1.ManifestType.DOTNET_CORE &&
|
|
82
83
|
useProjectNameFromAssetsFile) {
|
|
83
84
|
if (projectNameFromManifestFile) {
|
|
@@ -107,7 +108,16 @@ Supply a targetFramework by using the \x1b[1m--target-framework\x1b[0m argument.
|
|
|
107
108
|
// Then inspect the dependency graph for the runtimepackage's assembly versions.
|
|
108
109
|
const depsFile = path.resolve(publishDir, `${projectNameFromManifestFile}.deps.json`);
|
|
109
110
|
const assemblyVersions = runtimeAssembly.generateRuntimeAssemblies(depsFile);
|
|
110
|
-
|
|
111
|
+
// Parse the TargetFramework using Nuget.Frameworks itself, instead of trying to reinvent the wheel, thus ensuring
|
|
112
|
+
// we have maximum context to use later when building the depGraph.
|
|
113
|
+
const location = nugetFrameworksParser.generate();
|
|
114
|
+
await dotnet.restore(location);
|
|
115
|
+
const response = await dotnet.run(location, [decidedTargetFramework]);
|
|
116
|
+
const targetFrameworkInfo = JSON.parse(response);
|
|
117
|
+
if (targetFrameworkInfo.IsUnsupported) {
|
|
118
|
+
throw new errors_1.InvalidManifestError(`dotnet was not able to parse the target framework ${decidedTargetFramework}, it was reported unsupported by the dotnet runtime`);
|
|
119
|
+
}
|
|
120
|
+
const depGraph = parser.depParser.parse(resolvedProjectName, manifest, assemblyVersions, targetFrameworkInfo);
|
|
111
121
|
return {
|
|
112
122
|
dependencyGraph: depGraph,
|
|
113
123
|
targetFramework: decidedTargetFramework,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/nuget-parser/index.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,wDAAwD;AACxD,qCAAqC;AACrC,iEAAiE;AACjE,sEAAsE;AACtE,2EAA2E;AAC3E,mEAAmE;AACnE,yEAAyE;AACzE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/nuget-parser/index.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAC7B,wDAAwD;AACxD,qCAAqC;AACrC,iEAAiE;AACjE,sEAAsE;AACtE,2EAA2E;AAC3E,mEAAmE;AACnE,yEAAyE;AACzE,sCAA0E;AAC1E,mCAKiB;AAEjB,uCAAuC;AACvC,yEAAyE;AACzE,sDAAsD;AAEtD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAElC,MAAM,OAAO,GAAG;IACd,aAAa,EAAE;QACb,SAAS,EAAE,gBAAgB;QAC3B,iBAAiB,EAAE,IAAI;KACxB;IACD,gBAAgB,EAAE;QAChB,SAA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AACJ,CAAC;AAtFD,sDAsFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parse(tree: any, manifest: any): any;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as depGraphLib from '@snyk/dep-graph';
|
|
2
|
+
import { AssemblyVersions, ProjectAssets, TargetFrameworkInfo } from '../types';
|
|
3
|
+
export declare function parse(projectName: string, projectAssets: ProjectAssets, runtimeAssembly: AssemblyVersions, targetFrameworkInfo: TargetFrameworkInfo): depGraphLib.DepGraph;
|
|
@@ -7,6 +7,31 @@ const errors_1 = require("../../errors");
|
|
|
7
7
|
const debug = debugModule('snyk');
|
|
8
8
|
// Dependencies that starts with these are discarded
|
|
9
9
|
const FILTERED_DEPENDENCY_PREFIX = ['runtime'];
|
|
10
|
+
// The list of top level dependencies and transitive dependencies differ based on the target runtime we've defined.
|
|
11
|
+
// In the generated dependency file created by the `dotnet` CLI, this is organized by the target framework moniker (TFM).
|
|
12
|
+
// Unfortunately, Microsoft has changed the way it denominates their targets throughout the different versions,
|
|
13
|
+
// see: https://learn.microsoft.com/en-us/nuget/reference/target-frameworks#supported-frameworks.
|
|
14
|
+
// So the logic has to be unnecessarily complex, as we cannot just access the key in the target dictionary
|
|
15
|
+
// for versions different from the newest ones of .NET 5+.
|
|
16
|
+
// Even better, it changes between how it defines them inside project.frameworks and the root targets object interchangeably.
|
|
17
|
+
function findTargetFrameworkMonikerInManifest(targetFrameworkInfo, frameworks) {
|
|
18
|
+
const shortName = targetFrameworkInfo.ShortName;
|
|
19
|
+
const longName = targetFrameworkInfo.DotNetFrameworkName;
|
|
20
|
+
const parsedFrameworks = Object.keys(frameworks);
|
|
21
|
+
debug(`parsed the following frameworks in the manifest file: ${parsedFrameworks.join(',')}`);
|
|
22
|
+
// Try and find the "longName" (or DotNetFrameworkName) in the list of targets.
|
|
23
|
+
// The format is usually something like ".NETCoreApp,Version=v6.0". That seems to happen for older .NET target frameworks.
|
|
24
|
+
if (longName in frameworks) {
|
|
25
|
+
debug(`detected ${longName} in assets file, returning that`);
|
|
26
|
+
return longName;
|
|
27
|
+
}
|
|
28
|
+
// If that doesn't work, for newer versions of .NET core, they index the frameworks object by the 'shortname'.
|
|
29
|
+
if (shortName in frameworks) {
|
|
30
|
+
debug(`detected ${shortName} in assets file, returning that`);
|
|
31
|
+
return shortName;
|
|
32
|
+
}
|
|
33
|
+
throw new errors_1.FileNotProcessableError(`unable to find the determined target framework (${targetFrameworkInfo.ShortName}) in any of the available target frameworks: ${parsedFrameworks}`);
|
|
34
|
+
}
|
|
10
35
|
function recursivelyPopulateNodes(depGraphBuilder, targetDeps, node, runtimeAssembly, visited) {
|
|
11
36
|
const parentId = node.type === 'root' ? 'root-node' : `${node.name}@${node.version}`;
|
|
12
37
|
for (const depNode of Object.entries(node.dependencies || {})) {
|
|
@@ -42,24 +67,28 @@ function recursivelyPopulateNodes(depGraphBuilder, targetDeps, node, runtimeAsse
|
|
|
42
67
|
recursivelyPopulateNodes(depGraphBuilder, targetDeps, childNode, runtimeAssembly, localVisited);
|
|
43
68
|
}
|
|
44
69
|
}
|
|
45
|
-
function buildGraph(projectName, projectAssets, runtimeAssembly) {
|
|
70
|
+
function buildGraph(projectName, projectAssets, runtimeAssembly, targetFrameworkInfo) {
|
|
46
71
|
const depGraphBuilder = new dep_graph_1.DepGraphBuilder({ name: 'nuget' }, {
|
|
47
72
|
name: projectName,
|
|
48
73
|
version: projectAssets.project.version,
|
|
49
74
|
});
|
|
50
75
|
if (Object.keys(projectAssets.project.frameworks).length <= 0) {
|
|
51
|
-
throw new errors_1.
|
|
76
|
+
throw new errors_1.InvalidManifestError('no target frameworks found in assets file (project.assets.json -> project -> frameworks -> []), cannot continue without that');
|
|
52
77
|
}
|
|
53
|
-
|
|
54
|
-
const
|
|
78
|
+
// Access all top-level dependencies from the right target point in the project.assets.json, or fail trying.
|
|
79
|
+
const directDepsMoniker = findTargetFrameworkMonikerInManifest(targetFrameworkInfo, projectAssets.project.frameworks);
|
|
80
|
+
// Those dependencies are referenced in the 'targets' member in the same assets file.
|
|
81
|
+
const topLevelDeps = Object.keys(projectAssets.project.frameworks[directDepsMoniker].dependencies);
|
|
55
82
|
// The list of targets gets decorated differently depending on version of the TargetFramework, (.NET 5+ versions
|
|
56
83
|
// just have their key as the target (net6.0), but .NET Standard append a version, such as .NETStandard,Version=VN.N.N).
|
|
57
84
|
if (Object.keys(projectAssets.targets).length <= 0) {
|
|
58
|
-
throw new errors_1.
|
|
85
|
+
throw new errors_1.InvalidManifestError('no target dependencies in found in assets file (project.assets.json -> targets -> []), cannot continue without that');
|
|
59
86
|
}
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
|
|
87
|
+
// Further, they decorate them differently depending on where in the assets file it is.
|
|
88
|
+
// E.g., a direct dependency target moniker can be project -> frameworks -> 'netstandard2.0', while the
|
|
89
|
+
// transitive dependency line can be targets -> .NETStandard,Version=v2.1.
|
|
90
|
+
const transitiveDepsMoniker = findTargetFrameworkMonikerInManifest(targetFrameworkInfo, projectAssets.targets);
|
|
91
|
+
const targetFrameworkDependencies = projectAssets.targets[transitiveDepsMoniker];
|
|
63
92
|
// Iterate over all the dependencies found in the target dependency list, and build the depGraph based off of that.
|
|
64
93
|
const targetDeps = Object.entries(targetFrameworkDependencies).reduce((acc, entry) => {
|
|
65
94
|
const [nameWithVersion, pkg] = entry;
|
|
@@ -72,7 +101,7 @@ function buildGraph(projectName, projectAssets, runtimeAssembly) {
|
|
|
72
101
|
const topLevelDepPackages = topLevelDeps.reduce((acc, topLevelDepName) => {
|
|
73
102
|
const nameWithVersion = Object.keys(targetDeps).find((targetDep) => targetDep.startsWith(topLevelDepName));
|
|
74
103
|
if (!nameWithVersion) {
|
|
75
|
-
throw new
|
|
104
|
+
throw new errors_1.InvalidManifestError(`cant find a name and a version in assets file, something's very malformed`);
|
|
76
105
|
}
|
|
77
106
|
const [name, version] = nameWithVersion.split('/');
|
|
78
107
|
return { ...acc, [name]: version };
|
|
@@ -84,9 +113,9 @@ function buildGraph(projectName, projectAssets, runtimeAssembly) {
|
|
|
84
113
|
recursivelyPopulateNodes(depGraphBuilder, targetDeps, rootNode, runtimeAssembly);
|
|
85
114
|
return depGraphBuilder.build();
|
|
86
115
|
}
|
|
87
|
-
function parse(projectName, projectAssets, runtimeAssembly) {
|
|
116
|
+
function parse(projectName, projectAssets, runtimeAssembly, targetFrameworkInfo) {
|
|
88
117
|
debug('Trying to parse .net core manifest with v2 depGraph builder');
|
|
89
|
-
const result = buildGraph(projectName, projectAssets, runtimeAssembly);
|
|
118
|
+
const result = buildGraph(projectName, projectAssets, runtimeAssembly, targetFrameworkInfo);
|
|
90
119
|
return result;
|
|
91
120
|
}
|
|
92
121
|
exports.parse = parse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotnet-core-v2-parser.js","sourceRoot":"","sources":["../../../lib/nuget-parser/parsers/dotnet-core-v2-parser.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,+CAAkD;AAElD,
|
|
1
|
+
{"version":3,"file":"dotnet-core-v2-parser.js","sourceRoot":"","sources":["../../../lib/nuget-parser/parsers/dotnet-core-v2-parser.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,+CAAkD;AAElD,yCAA6E;AAE7E,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAYlC,oDAAoD;AACpD,MAAM,0BAA0B,GAAG,CAAC,SAAS,CAAC,CAAC;AAE/C,mHAAmH;AACnH,yHAAyH;AACzH,+GAA+G;AAC/G,iGAAiG;AACjG,0GAA0G;AAC1G,0DAA0D;AAC1D,6HAA6H;AAC7H,SAAS,oCAAoC,CAC3C,mBAAwC,EACxC,UAA+B;IAE/B,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;IAChD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,mBAAmB,CAAC;IACzD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC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,EAAE,EAAE;QACvE,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CACjE,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CACtC,CAAC;QACF,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,6BAAoB,CAC5B,2EAA2E,CAC5E,CAAC;SACH;QAED,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE,mBAAmB;KACjB,CAAC;IAEnB,wBAAwB,CACtB,eAAe,EACf,UAAU,EACV,QAAQ,EACR,eAAe,CAChB,CAAC;IAEF,OAAO,eAAe,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC;AAED,SAAgB,KAAK,CACnB,WAAmB,EACnB,aAA4B,EAC5B,eAAiC,EACjC,mBAAwC;IAExC,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,UAAU,CACvB,WAAW,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,CACpB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,sBAeC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dependency } from '../types';
|
|
2
|
+
export declare function cloneShallow(dep: Dependency): Dependency;
|
|
3
|
+
export declare function fromFolderName(folderName: any): {
|
|
4
|
+
dependencies: {};
|
|
5
|
+
name: any;
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function parse(tree: any, manifest: any, targetFramework: any, packagesFolder: any): Promise<any>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DependencyInfo, DependencyTree, TargetFramework } from '../types';
|
|
2
|
+
export declare function parse(nuspecContent: string, targetFramework: TargetFramework, depName: string): Promise<DependencyTree>;
|
|
3
|
+
export declare function parseNuspec(dep: DependencyInfo, targetFramework: TargetFramework): Promise<DependencyTree | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dependency, TargetFramework } from '../types';
|
|
2
|
+
export declare function fromPackagesConfigEntry(manifest: any): {
|
|
3
|
+
dependencies: {};
|
|
4
|
+
name: any;
|
|
5
|
+
version: any;
|
|
6
|
+
};
|
|
7
|
+
export declare function parse(fileContent: any): Dependency[];
|
|
8
|
+
export declare function getMinimumTargetFramework(fileContent: string): Promise<TargetFramework | undefined>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface TargetFramework {
|
|
2
|
+
framework: string;
|
|
3
|
+
original: string;
|
|
4
|
+
version: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TargetFrameworkInfo {
|
|
7
|
+
Framework: string;
|
|
8
|
+
Version: string;
|
|
9
|
+
Platform: string;
|
|
10
|
+
PlatformVersion: string;
|
|
11
|
+
HasPlatform: boolean;
|
|
12
|
+
HasProfile: boolean;
|
|
13
|
+
Profile: string;
|
|
14
|
+
DotNetFrameworkName: string;
|
|
15
|
+
DotNetPlatformName: string;
|
|
16
|
+
IsPCL: boolean;
|
|
17
|
+
IsPackageBased: boolean;
|
|
18
|
+
AllFrameworkVersions: boolean;
|
|
19
|
+
IsUnsupported: boolean;
|
|
20
|
+
IsAgnostic: boolean;
|
|
21
|
+
IsAny: boolean;
|
|
22
|
+
IsSpecificFramework: boolean;
|
|
23
|
+
ShortName: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Dependency {
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
dependencies?: any;
|
|
29
|
+
}
|
|
30
|
+
export interface DependencyInfo {
|
|
31
|
+
name: string;
|
|
32
|
+
path: string;
|
|
33
|
+
version: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DependencyTree {
|
|
36
|
+
name: string;
|
|
37
|
+
children: Dependency[];
|
|
38
|
+
}
|
|
39
|
+
export declare enum ManifestType {
|
|
40
|
+
PROJECT_JSON = "project.json",
|
|
41
|
+
DOTNET_CORE = "dotnet-core",
|
|
42
|
+
PACKAGES_CONFIG = "packages.config",
|
|
43
|
+
PAKET = "paket"
|
|
44
|
+
}
|
|
45
|
+
interface Project {
|
|
46
|
+
version: string;
|
|
47
|
+
restore: Record<string, any>;
|
|
48
|
+
frameworks: Record<string, any>;
|
|
49
|
+
runtimeIdentifierGraphPath: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ProjectAssets {
|
|
52
|
+
version: number;
|
|
53
|
+
targets: Record<string, any>;
|
|
54
|
+
libraries: Record<string, any>;
|
|
55
|
+
projectFileDependencyGroups: Record<string, any>;
|
|
56
|
+
packageFolders: Record<string, any>;
|
|
57
|
+
project: Project;
|
|
58
|
+
}
|
|
59
|
+
export type AssemblyVersions = Record<string, string>;
|
|
60
|
+
export type RuntimeAssemblyVersions = Record<string, AssemblyVersions>;
|
|
61
|
+
export interface DotNetFile {
|
|
62
|
+
name: string;
|
|
63
|
+
contents: string;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/nuget-parser/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/nuget-parser/types.ts"],"names":[],"mappings":";;;AA+CA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,2CAA2B,CAAA;IAC3B,mDAAmC,CAAA;IACnC,+BAAe,CAAA;AACjB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"test": "npm run test:unit",
|
|
8
8
|
"test:unit": "jest --coverage --runInBand",
|
|
9
9
|
"lint": "npm run lint:prettier && npm run lint:eslint",
|
|
10
|
-
"lint:eslint": "eslint .
|
|
10
|
+
"lint:eslint": "eslint -c .eslintrc '{lib,test}/**/*.ts'",
|
|
11
11
|
"lint:prettier": "prettier --check '{lib,test}/**/*.{ts,csproj,json}' --log-level 'warn'",
|
|
12
12
|
"lint:fix": "prettier --write '{lib,test}/**/*.{ts,csproj,json}' && eslint -c .eslintrc --fix '{lib,test}/**/*.ts'",
|
|
13
13
|
"build": "tsc",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"dotnet-deps-parser": "5.3.0",
|
|
43
43
|
"jszip": "3.10.1",
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
|
+
"node-cache": "^5.1.2",
|
|
45
46
|
"snyk-paket-parser": "1.6.0",
|
|
46
47
|
"tslib": "^2.6.1",
|
|
47
48
|
"xml2js": "^0.6.2"
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"ts-jest": "^29.1.1",
|
|
58
59
|
"typescript": "^5.1.6"
|
|
59
60
|
},
|
|
60
|
-
"version": "1.
|
|
61
|
+
"version": "1.38.0"
|
|
61
62
|
}
|