snyk 1.1244.0 → 1.1246.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 +109 -106
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/784.index.js +25 -3
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/dist/lib/plugins/sast/errors/code-client-error.d.ts +3 -0
- package/dist/lib/plugins/sast/errors/index.d.ts +1 -1
- package/help/cli-commands/code-test.md +7 -7
- package/help/cli-commands/container-monitor.md +7 -3
- package/help/cli-commands/container-sbom.md +1 -1
- package/help/cli-commands/iac-test.md +1 -1
- package/help/cli-commands/log4shell.md +1 -1
- package/help/cli-commands/monitor.md +11 -3
- package/help/cli-commands/sbom.md +3 -1
- package/help/cli-commands/test.md +1 -1
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +8 -8
- package/src/generated/version +1 -1
- package/tsconfig.tsbuildinfo +2 -2
- package/wrapper_dist/generated/sha256sums.txt +8 -8
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -11391,7 +11391,7 @@ exports.readJSON = readJSON;
|
|
|
11391
11391
|
"use strict";
|
|
11392
11392
|
|
|
11393
11393
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11394
|
-
exports.DEFAULT_ERROR_MESSAGES = exports.NETWORK_ERRORS = exports.ErrorCodes = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.REQUEST_RETRY_DELAY = exports.MAX_RETRY_ATTEMPTS = exports.POLLING_INTERVAL = exports.UPLOAD_CONCURRENCY = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DOTSNYK_FILENAME = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.MAX_FILE_SIZE = exports.MAX_PAYLOAD = void 0;
|
|
11394
|
+
exports.DEFAULT_ERROR_MESSAGES = exports.NETWORK_ERRORS = exports.ErrorCodes = exports.DCIGNORE_DRAFTS = exports.IGNORE_FILES_NAMES = exports.IGNORES_DEFAULT = exports.ORG_ID_REGEXP = exports.REQUEST_RETRY_DELAY = exports.MAX_RETRY_ATTEMPTS = exports.POLLING_INTERVAL = exports.UPLOAD_CONCURRENCY = exports.MAX_UPLOAD_ATTEMPTS = exports.CACHE_KEY = exports.EXCLUDED_NAMES = exports.DOTSNYK_FILENAME = exports.DCIGNORE_FILENAME = exports.GITIGNORE_FILENAME = exports.GIT_FILENAME = exports.ENCODE_TYPE = exports.HASH_ALGORITHM = exports.MAX_FILE_SIZE = exports.MAX_PAYLOAD = void 0;
|
|
11395
11395
|
const dcignore_1 = __webpack_require__(55086);
|
|
11396
11396
|
exports.MAX_PAYLOAD = 4 * 1024 * 1024;
|
|
11397
11397
|
exports.MAX_FILE_SIZE = 1024 * 1024;
|
|
@@ -11408,6 +11408,7 @@ exports.UPLOAD_CONCURRENCY = 2;
|
|
|
11408
11408
|
exports.POLLING_INTERVAL = 500;
|
|
11409
11409
|
exports.MAX_RETRY_ATTEMPTS = 10; // Request retries on network errors
|
|
11410
11410
|
exports.REQUEST_RETRY_DELAY = 5 * 1000; // delay between retries in milliseconds
|
|
11411
|
+
exports.ORG_ID_REGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
11411
11412
|
exports.IGNORES_DEFAULT = [`**/${exports.GIT_FILENAME}/**`];
|
|
11412
11413
|
exports.IGNORE_FILES_NAMES = [exports.GITIGNORE_FILENAME, exports.DCIGNORE_FILENAME, exports.DOTSNYK_FILENAME];
|
|
11413
11414
|
exports.DCIGNORE_DRAFTS = {
|
|
@@ -12014,17 +12015,17 @@ const httpUtils_1 = __webpack_require__(11294);
|
|
|
12014
12015
|
// The trick to typecast union type alias
|
|
12015
12016
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12016
12017
|
function isSubsetErrorCode(code, messages) {
|
|
12017
|
-
|
|
12018
|
-
return true;
|
|
12019
|
-
}
|
|
12020
|
-
return false;
|
|
12018
|
+
return code in messages;
|
|
12021
12019
|
}
|
|
12022
|
-
function generateError(errorCode, messages, apiName,
|
|
12020
|
+
function generateError(errorCode, messages, apiName, errorMessage, jsonApiError) {
|
|
12021
|
+
if (jsonApiError) {
|
|
12022
|
+
return httpUtils_1.generateErrorWithDetail(jsonApiError, errorCode, apiName);
|
|
12023
|
+
}
|
|
12023
12024
|
if (!isSubsetErrorCode(errorCode, messages)) {
|
|
12024
|
-
throw { errorCode,
|
|
12025
|
+
throw { statusCode: errorCode, statusText: errorMessage || 'unknown error occurred', apiName };
|
|
12025
12026
|
}
|
|
12026
12027
|
const statusCode = errorCode;
|
|
12027
|
-
const statusText =
|
|
12028
|
+
const statusText = errorMessage !== null && errorMessage !== void 0 ? errorMessage : messages[errorCode];
|
|
12028
12029
|
return {
|
|
12029
12030
|
type: 'error',
|
|
12030
12031
|
error: {
|
|
@@ -12045,8 +12046,7 @@ const GENERIC_ERROR_MESSAGES = {
|
|
|
12045
12046
|
async function compressAndEncode(payload) {
|
|
12046
12047
|
// encode payload and compress;
|
|
12047
12048
|
const deflate = util_1.promisify(zlib_1.gzip);
|
|
12048
|
-
|
|
12049
|
-
return compressedPayload;
|
|
12049
|
+
return await deflate(Buffer.from(JSON.stringify(payload)).toString('base64'));
|
|
12050
12050
|
}
|
|
12051
12051
|
exports.compressAndEncode = compressAndEncode;
|
|
12052
12052
|
function startSession(options) {
|
|
@@ -12123,7 +12123,7 @@ async function getFilters(baseURL, source, attempts = constants_1.MAX_RETRY_ATTE
|
|
|
12123
12123
|
if (res.success) {
|
|
12124
12124
|
return { type: 'success', value: res.body };
|
|
12125
12125
|
}
|
|
12126
|
-
return generateError(res.errorCode, GENERIC_ERROR_MESSAGES, apiName);
|
|
12126
|
+
return generateError(res.errorCode, GENERIC_ERROR_MESSAGES, apiName, undefined, res.jsonApiError);
|
|
12127
12127
|
}
|
|
12128
12128
|
exports.getFilters = getFilters;
|
|
12129
12129
|
function commonHttpHeaders(options) {
|
|
@@ -12167,7 +12167,7 @@ async function createBundle(options) {
|
|
|
12167
12167
|
if (res.success) {
|
|
12168
12168
|
return { type: 'success', value: res.body };
|
|
12169
12169
|
}
|
|
12170
|
-
return generateError(res.errorCode, CREATE_BUNDLE_ERROR_MESSAGES, 'createBundle');
|
|
12170
|
+
return generateError(res.errorCode, CREATE_BUNDLE_ERROR_MESSAGES, 'createBundle', undefined, res.jsonApiError);
|
|
12171
12171
|
}
|
|
12172
12172
|
exports.createBundle = createBundle;
|
|
12173
12173
|
const CHECK_BUNDLE_ERROR_MESSAGES = {
|
|
@@ -12193,7 +12193,7 @@ async function checkBundle(options) {
|
|
|
12193
12193
|
});
|
|
12194
12194
|
if (res.success)
|
|
12195
12195
|
return { type: 'success', value: res.body };
|
|
12196
|
-
return generateError(res.errorCode, CHECK_BUNDLE_ERROR_MESSAGES, 'checkBundle');
|
|
12196
|
+
return generateError(res.errorCode, CHECK_BUNDLE_ERROR_MESSAGES, 'checkBundle', undefined, res.jsonApiError);
|
|
12197
12197
|
}
|
|
12198
12198
|
exports.checkBundle = checkBundle;
|
|
12199
12199
|
const EXTEND_BUNDLE_ERROR_MESSAGES = {
|
|
@@ -12226,7 +12226,7 @@ async function extendBundle(options) {
|
|
|
12226
12226
|
});
|
|
12227
12227
|
if (res.success)
|
|
12228
12228
|
return { type: 'success', value: res.body };
|
|
12229
|
-
return generateError(res.errorCode, EXTEND_BUNDLE_ERROR_MESSAGES, 'extendBundle');
|
|
12229
|
+
return generateError(res.errorCode, EXTEND_BUNDLE_ERROR_MESSAGES, 'extendBundle', undefined, res.jsonApiError);
|
|
12230
12230
|
}
|
|
12231
12231
|
exports.extendBundle = extendBundle;
|
|
12232
12232
|
// eslint-disable-next-line no-shadow
|
|
@@ -12272,9 +12272,10 @@ async function getAnalysis(options) {
|
|
|
12272
12272
|
},
|
|
12273
12273
|
};
|
|
12274
12274
|
const res = await needle_1.makeRequest(config);
|
|
12275
|
-
if (res.success)
|
|
12275
|
+
if (res.success) {
|
|
12276
12276
|
return { type: 'success', value: res.body };
|
|
12277
|
-
|
|
12277
|
+
}
|
|
12278
|
+
return generateError(res.errorCode, GET_ANALYSIS_ERROR_MESSAGES, 'getAnalysis', undefined, res.jsonApiError);
|
|
12278
12279
|
}
|
|
12279
12280
|
exports.getAnalysis = getAnalysis;
|
|
12280
12281
|
const REPORT_ERROR_MESSAGES = {
|
|
@@ -12321,7 +12322,7 @@ async function initReport(options) {
|
|
|
12321
12322
|
const res = await needle_1.makeRequest(config);
|
|
12322
12323
|
if (res.success)
|
|
12323
12324
|
return { type: 'success', value: res.body.reportId };
|
|
12324
|
-
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport');
|
|
12325
|
+
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.jsonApiError);
|
|
12325
12326
|
}
|
|
12326
12327
|
exports.initReport = initReport;
|
|
12327
12328
|
/**
|
|
@@ -12346,7 +12347,7 @@ async function getReport(options) {
|
|
|
12346
12347
|
const res = await needle_1.makeRequest(config);
|
|
12347
12348
|
if (res.success)
|
|
12348
12349
|
return { type: 'success', value: res.body };
|
|
12349
|
-
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
12350
|
+
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message, res.jsonApiError);
|
|
12350
12351
|
}
|
|
12351
12352
|
exports.getReport = getReport;
|
|
12352
12353
|
/**
|
|
@@ -12377,7 +12378,7 @@ async function initScmReport(options) {
|
|
|
12377
12378
|
const res = await needle_1.makeRequest(config);
|
|
12378
12379
|
if (res.success)
|
|
12379
12380
|
return { type: 'success', value: res.body.testId };
|
|
12380
|
-
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport');
|
|
12381
|
+
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'initReport', undefined, res.jsonApiError);
|
|
12381
12382
|
}
|
|
12382
12383
|
exports.initScmReport = initScmReport;
|
|
12383
12384
|
/**
|
|
@@ -12402,7 +12403,7 @@ async function getScmReport(options) {
|
|
|
12402
12403
|
const res = await needle_1.makeRequest(config);
|
|
12403
12404
|
if (res.success)
|
|
12404
12405
|
return { type: 'success', value: res.body };
|
|
12405
|
-
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
12406
|
+
return generateError(res.errorCode, REPORT_ERROR_MESSAGES, 'getReport', (_a = res.error) === null || _a === void 0 ? void 0 : _a.message, res.jsonApiError);
|
|
12406
12407
|
}
|
|
12407
12408
|
exports.getScmReport = getScmReport;
|
|
12408
12409
|
//# sourceMappingURL=http.js.map
|
|
@@ -12517,6 +12518,7 @@ const https_1 = __importDefault(__webpack_require__(95687));
|
|
|
12517
12518
|
const url_1 = __webpack_require__(57310);
|
|
12518
12519
|
const emitter_1 = __webpack_require__(37544);
|
|
12519
12520
|
const constants_1 = __webpack_require__(65765);
|
|
12521
|
+
const httpUtils_1 = __webpack_require__(11294);
|
|
12520
12522
|
const sleep = (duration) => new Promise(resolve => setTimeout(resolve, duration));
|
|
12521
12523
|
const TIMEOUT_DEFAULT = 600000;
|
|
12522
12524
|
const agentOptions = {
|
|
@@ -12529,7 +12531,7 @@ const agentOptions = {
|
|
|
12529
12531
|
rejectUnauthorized: !global.ignoreUnknownCA,
|
|
12530
12532
|
};
|
|
12531
12533
|
async function makeRequest(payload, attempts = constants_1.MAX_RETRY_ATTEMPTS) {
|
|
12532
|
-
var _a;
|
|
12534
|
+
var _a, _b;
|
|
12533
12535
|
let data;
|
|
12534
12536
|
if (!payload.isJson && payload.body) {
|
|
12535
12537
|
data = payload.body;
|
|
@@ -12564,6 +12566,7 @@ async function makeRequest(payload, attempts = constants_1.MAX_RETRY_ATTEMPTS) {
|
|
|
12564
12566
|
do {
|
|
12565
12567
|
let errorCode;
|
|
12566
12568
|
let error;
|
|
12569
|
+
let jsonApiError;
|
|
12567
12570
|
let response;
|
|
12568
12571
|
try {
|
|
12569
12572
|
response = await needle_1.default(method, url, data, options);
|
|
@@ -12580,6 +12583,11 @@ async function makeRequest(payload, attempts = constants_1.MAX_RETRY_ATTEMPTS) {
|
|
|
12580
12583
|
}
|
|
12581
12584
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
12582
12585
|
const errorMessage = (_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.error;
|
|
12586
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
|
12587
|
+
const errors = (_b = response === null || response === void 0 ? void 0 : response.body) === null || _b === void 0 ? void 0 : _b.errors;
|
|
12588
|
+
if (httpUtils_1.isJsonApiErrors(errors)) {
|
|
12589
|
+
jsonApiError = errors[0];
|
|
12590
|
+
}
|
|
12583
12591
|
if (errorMessage) {
|
|
12584
12592
|
error = error !== null && error !== void 0 ? error : new Error(errorMessage);
|
|
12585
12593
|
}
|
|
@@ -12599,7 +12607,7 @@ async function makeRequest(payload, attempts = constants_1.MAX_RETRY_ATTEMPTS) {
|
|
|
12599
12607
|
}
|
|
12600
12608
|
else {
|
|
12601
12609
|
attempts = 0;
|
|
12602
|
-
return { success: false, errorCode, error };
|
|
12610
|
+
return { success: false, errorCode, error, jsonApiError };
|
|
12603
12611
|
}
|
|
12604
12612
|
} while (attempts > 0);
|
|
12605
12613
|
return { success: false, errorCode: constants_1.ErrorCodes.serviceUnavailable, error: undefined };
|
|
@@ -12737,16 +12745,17 @@ exports.reportScm = reportScm;
|
|
|
12737
12745
|
/***/ }),
|
|
12738
12746
|
|
|
12739
12747
|
/***/ 11294:
|
|
12740
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
12748
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12741
12749
|
|
|
12742
12750
|
"use strict";
|
|
12743
12751
|
|
|
12744
12752
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12745
|
-
exports.getURL = void 0;
|
|
12753
|
+
exports.generateErrorWithDetail = exports.isJsonApiErrors = exports.getURL = void 0;
|
|
12754
|
+
const constants_1 = __webpack_require__(65765);
|
|
12746
12755
|
function getURL(baseURL, path, orgId) {
|
|
12747
12756
|
if (routeToGateway(baseURL)) {
|
|
12748
|
-
if (!orgId) {
|
|
12749
|
-
throw new Error('Org is required for this operation');
|
|
12757
|
+
if (!isValidOrg(orgId)) {
|
|
12758
|
+
throw new Error('A valid Org id is required for this operation');
|
|
12750
12759
|
}
|
|
12751
12760
|
return `${baseURL}/hidden/orgs/${orgId}/code${path}`;
|
|
12752
12761
|
}
|
|
@@ -12756,6 +12765,41 @@ exports.getURL = getURL;
|
|
|
12756
12765
|
function routeToGateway(baseURL) {
|
|
12757
12766
|
return baseURL.includes('snykgov.io');
|
|
12758
12767
|
}
|
|
12768
|
+
function isValidOrg(orgId) {
|
|
12769
|
+
return orgId !== undefined && constants_1.ORG_ID_REGEXP.test(orgId);
|
|
12770
|
+
}
|
|
12771
|
+
function isJsonApiErrors(input) {
|
|
12772
|
+
if (!Array.isArray(input) || input.length < 1) {
|
|
12773
|
+
return false;
|
|
12774
|
+
}
|
|
12775
|
+
for (const element of input) {
|
|
12776
|
+
if (typeof element !== 'object' ||
|
|
12777
|
+
!('status' in element) ||
|
|
12778
|
+
!('code' in element) ||
|
|
12779
|
+
!('title' in element) ||
|
|
12780
|
+
!('detail' in element)) {
|
|
12781
|
+
return false;
|
|
12782
|
+
}
|
|
12783
|
+
}
|
|
12784
|
+
return true;
|
|
12785
|
+
}
|
|
12786
|
+
exports.isJsonApiErrors = isJsonApiErrors;
|
|
12787
|
+
function generateErrorWithDetail(error, statusCode, apiName) {
|
|
12788
|
+
var _a;
|
|
12789
|
+
const errorLink = (_a = error.links) === null || _a === void 0 ? void 0 : _a.about;
|
|
12790
|
+
const detail = `${error.title}${error.detail ? `: ${error.detail}` : ''}${errorLink ? ` (more info: ${errorLink})` : ``}`;
|
|
12791
|
+
const statusText = error.title;
|
|
12792
|
+
return {
|
|
12793
|
+
type: 'error',
|
|
12794
|
+
error: {
|
|
12795
|
+
apiName,
|
|
12796
|
+
statusCode: statusCode,
|
|
12797
|
+
statusText,
|
|
12798
|
+
detail,
|
|
12799
|
+
},
|
|
12800
|
+
};
|
|
12801
|
+
}
|
|
12802
|
+
exports.generateErrorWithDetail = generateErrorWithDetail;
|
|
12759
12803
|
//# sourceMappingURL=httpUtils.js.map
|
|
12760
12804
|
|
|
12761
12805
|
/***/ }),
|
|
@@ -231577,6 +231621,8 @@ const debugModule = __webpack_require__(15158);
|
|
|
231577
231621
|
const errors_1 = __webpack_require__(62153);
|
|
231578
231622
|
const path = __webpack_require__(71017);
|
|
231579
231623
|
const subprocess = __webpack_require__(24862);
|
|
231624
|
+
const fs = __webpack_require__(57147);
|
|
231625
|
+
const os = __webpack_require__(22037);
|
|
231580
231626
|
const debug = debugModule('snyk');
|
|
231581
231627
|
async function handle(operation, command, args) {
|
|
231582
231628
|
debug(`running dotnet command: ${operation}: ${command}`);
|
|
@@ -231621,59 +231667,28 @@ async function run(projectPath, options) {
|
|
|
231621
231667
|
}
|
|
231622
231668
|
exports.run = run;
|
|
231623
231669
|
async function publish(projectPath, targetFramework) {
|
|
231624
|
-
var _a;
|
|
231625
231670
|
const command = 'dotnet';
|
|
231626
231671
|
const args = ['publish', '--nologo'];
|
|
231627
231672
|
// Self-contained: Create all required .dlls for version investigation, don't rely on the environment.
|
|
231628
231673
|
args.push('--sc');
|
|
231674
|
+
// Use the current runtime of whatever platform we are on.
|
|
231675
|
+
// This ensures that .dlls will be packaged containing the runtime assembly versions.
|
|
231676
|
+
// TODO: (OSM-521) if/when we allow this to be dynamic based on user input, remember to change this.
|
|
231677
|
+
args.push('--use-current-runtime');
|
|
231629
231678
|
// If your .csproj file contains multiple <TargetFramework> references, you need to supply which one you want to publish.
|
|
231630
231679
|
if (targetFramework) {
|
|
231631
231680
|
args.push('--framework');
|
|
231632
231681
|
args.push(targetFramework);
|
|
231633
231682
|
}
|
|
231683
|
+
// Define a temporary output dir to use for detecting .dlls to use for runtime version assembly detection.
|
|
231684
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), `snyk-nuget-plugin-publish-csharp-`));
|
|
231685
|
+
args.push('--output');
|
|
231686
|
+
args.push(tempDir);
|
|
231634
231687
|
// The path that contains either some form of project file, or a .sln one.
|
|
231635
231688
|
// See: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish#arguments
|
|
231636
231689
|
args.push(projectPath);
|
|
231637
|
-
|
|
231638
|
-
|
|
231639
|
-
// for a self-contained executable. Specifically determining an output folder with --output is deprecated,
|
|
231640
|
-
// as it leads to unpredictable results for multiple target frameworks and runtimes, so we have to cherry-pick
|
|
231641
|
-
// the folders.
|
|
231642
|
-
// See: https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/7.0/solution-level-output-no-longer-valid.
|
|
231643
|
-
// FIXME: As we're not supporting multiple frameworks all over the place, we have to just take the first one.
|
|
231644
|
-
// It's probably safe, as runtime dll versions most likely don't differ much across *most* dependencies, but
|
|
231645
|
-
// OS-specific ones (e.g. crypto) might.
|
|
231646
|
-
// Looking for something like <project_name> -> /path/to/<project_name>/bin/Debug/<target_framework>/publish/ on Unix.
|
|
231647
|
-
// We could also just hope Microsoft never changes their naming convention, but I think this is less error-prone,
|
|
231648
|
-
// and will potentially also support multiple target frameworks.
|
|
231649
|
-
const publishDirLine = response.stdout
|
|
231650
|
-
.split(/[\r\n]+/)
|
|
231651
|
-
// Projects that are referring to other local projects in their PackageReference item groups will also be restored
|
|
231652
|
-
// in a chained operation. The project we're interested in will be shown last, thus we reverse it.
|
|
231653
|
-
.reverse()
|
|
231654
|
-
// TODO: For multiple target frameworks, replace `find` with a map or something of that kind to return more than the first.
|
|
231655
|
-
// The first thing to get published ought to be the project's own .dll or .exe file, depending on the architecture.
|
|
231656
|
-
// E.g., something like:
|
|
231657
|
-
// dotnet_6 -> /foo/bar/project/bin/Debug/net6.0/osx-arm64/project_name.dll
|
|
231658
|
-
// Either way, since we're forcing a publish of a self-contained project, all .dlls should be placed there.
|
|
231659
|
-
// PRs are welcome!
|
|
231660
|
-
.find((line) => line.endsWith('.dll') || line.endsWith('.exe'));
|
|
231661
|
-
if (!publishDirLine) {
|
|
231662
|
-
const err = `Could not find a valid publish path while reading stdout: ${response.stdout}`;
|
|
231663
|
-
debug(err);
|
|
231664
|
-
throw new errors_1.CliCommandError(`Unable to find a publish dir: ${err}`);
|
|
231665
|
-
}
|
|
231666
|
-
// dotnet_6 -> /foo/bar/project/bin/Debug/net6.0/osx-arm64/project_name.dll will then have the first part removed:
|
|
231667
|
-
const [, publishedDllPath] = (_a = publishDirLine.split('->')) !== null && _a !== void 0 ? _a : [];
|
|
231668
|
-
if (!publishedDllPath) {
|
|
231669
|
-
const err = `Could not find a valid publish dir while splitting the line: ${publishDirLine}`;
|
|
231670
|
-
debug(err);
|
|
231671
|
-
throw new errors_1.CliCommandError(`Unable to find a publish dir: ${err}`);
|
|
231672
|
-
}
|
|
231673
|
-
// /foo/bar/project/bin/Debug/net6.0/osx-arm64/project_name.dll will then need to be stripped from a file name,
|
|
231674
|
-
// in order to return just the so-called "publish dir":
|
|
231675
|
-
const dirName = path.dirname(publishedDllPath.trim());
|
|
231676
|
-
return dirName;
|
|
231690
|
+
await handle('publish', command, args);
|
|
231691
|
+
return tempDir;
|
|
231677
231692
|
}
|
|
231678
231693
|
exports.publish = publish;
|
|
231679
231694
|
//# sourceMappingURL=dotnet.js.map
|
|
@@ -232522,7 +232537,9 @@ function buildGraph(projectName, projectAssets, runtimeAssembly, targetFramework
|
|
|
232522
232537
|
return { ...acc, [nameWithVersion]: pkg };
|
|
232523
232538
|
}, {});
|
|
232524
232539
|
const topLevelDepPackages = topLevelDeps.reduce((acc, topLevelDepName) => {
|
|
232525
|
-
const nameWithVersion = Object.keys(targetDeps).find((targetDep) =>
|
|
232540
|
+
const nameWithVersion = Object.keys(targetDeps).find((targetDep) =>
|
|
232541
|
+
// Lowercase the comparison, as .csproj <PackageReference>s are not case-sensitive, and can be written however you like.
|
|
232542
|
+
targetDep.toLowerCase().startsWith(topLevelDepName.toLowerCase()));
|
|
232526
232543
|
if (!nameWithVersion) {
|
|
232527
232544
|
throw new errors_1.InvalidManifestError(`cant find a name and a version in assets file, something's very malformed`);
|
|
232528
232545
|
}
|
|
@@ -233078,7 +233095,6 @@ exports.generateRuntimeAssemblies = void 0;
|
|
|
233078
233095
|
const errors = __webpack_require__(62153);
|
|
233079
233096
|
const fs = __webpack_require__(57147);
|
|
233080
233097
|
const lodash_1 = __webpack_require__(96486);
|
|
233081
|
-
const path = __webpack_require__(71017);
|
|
233082
233098
|
const debugModule = __webpack_require__(15158);
|
|
233083
233099
|
const debug = debugModule('snyk');
|
|
233084
233100
|
// The Nuget dependency resolution rule of lowest applicable version
|
|
@@ -233101,44 +233117,30 @@ function generateRuntimeAssemblies(filePath) {
|
|
|
233101
233117
|
// .NETCoreApp,Version=v6.0/alpine-armv6
|
|
233102
233118
|
// ... etc.
|
|
233103
233119
|
// See all: https://github.com/dotnet/runtime/blob/bd83e17052d3c09022bad1d91dca860ca6b27ab9/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
|
|
233104
|
-
|
|
233120
|
+
let runtimeAssemblyVersions = {};
|
|
233105
233121
|
Object.entries(deps.targets).forEach(([target, dependencies]) => {
|
|
233106
233122
|
// Ignore target frameworks without dependencies, as they hold no dlls and thus no assembly versions to gauge.
|
|
233107
233123
|
if ((0, lodash_1.isEmpty)(dependencies)) {
|
|
233108
233124
|
return;
|
|
233109
233125
|
}
|
|
233110
|
-
//
|
|
233111
|
-
//
|
|
233112
|
-
|
|
233113
|
-
|
|
233114
|
-
|
|
233115
|
-
|
|
233116
|
-
//
|
|
233117
|
-
//
|
|
233118
|
-
|
|
233119
|
-
|
|
233120
|
-
|
|
233121
|
-
|
|
233122
|
-
|
|
233123
|
-
|
|
233124
|
-
|
|
233125
|
-
|
|
233126
|
-
|
|
233127
|
-
|
|
233128
|
-
for (const [fullName, version] of Object.entries(runtime)) {
|
|
233129
|
-
if ((0, lodash_1.isEmpty)(version)) {
|
|
233130
|
-
continue;
|
|
233131
|
-
}
|
|
233132
|
-
// For some versions of .NET, the dependency version generated can be more than just the System.* name, but a
|
|
233133
|
-
// full path-like structure, such as lib/netstandard2.0/System.Buffers.dll, so extract as needed:
|
|
233134
|
-
name = path.basename(fullName);
|
|
233135
|
-
runtimes[name] = version;
|
|
233136
|
-
}
|
|
233137
|
-
}
|
|
233138
|
-
}
|
|
233139
|
-
if (!runtimes) {
|
|
233140
|
-
throw new errors.FileNotProcessableError(`could not find any runtime dependencies in the ${target} dependency`);
|
|
233141
|
-
}
|
|
233126
|
+
// Since we're running `dotnet publish` with `--use-current-runtime`, this should exist in the dependency list,
|
|
233127
|
+
// but guard against it to ensure good user feedback in case we did something wrong.
|
|
233128
|
+
const runtimePack = Object.keys(dependencies).find((dep) => dep.startsWith('runtimepack'));
|
|
233129
|
+
if (!runtimePack) {
|
|
233130
|
+
throw new errors.FileNotProcessableError(`could not find any runtimepack.* identifier in the ${target} dependency`);
|
|
233131
|
+
}
|
|
233132
|
+
// The runtimepack contains all the current RuntimeIdentifier (RID) assemblies which we are interested in.
|
|
233133
|
+
// Such as
|
|
233134
|
+
// "runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/6.0.16": {
|
|
233135
|
+
// "runtime": {
|
|
233136
|
+
// "Microsoft.CSharp.dll": { .. assembly version 6.0.0 }
|
|
233137
|
+
// }
|
|
233138
|
+
// }
|
|
233139
|
+
// We traverse all those and store them for the dependency graph build.
|
|
233140
|
+
if (!('runtime' in dependencies[runtimePack])) {
|
|
233141
|
+
throw new errors.FileNotProcessableError(`could not find any runtime list in the ${runtimePack} dependency`);
|
|
233142
|
+
}
|
|
233143
|
+
const runtimes = dependencies[runtimePack]['runtime'];
|
|
233142
233144
|
// Dig down into the specific runtimepack which contains all the assembly versions of
|
|
233143
233145
|
// the bundled DLLs for the given runtime, as:
|
|
233144
233146
|
// "runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/6.0.16": {
|
|
@@ -233154,19 +233156,20 @@ function generateRuntimeAssemblies(filePath) {
|
|
|
233154
233156
|
// (...)
|
|
233155
233157
|
// We currently only address assemblyVersions. FileVersion might become relevant, depending
|
|
233156
233158
|
// on how vulnerabilities are reported in the future.
|
|
233157
|
-
runtimeAssemblyVersions
|
|
233159
|
+
runtimeAssemblyVersions = Object.entries(runtimes).reduce((acc, [dll, versions]) => {
|
|
233158
233160
|
// Take the version number (N.N.N.N) and remove the last element, in order for vulndb to understand anything.
|
|
233159
233161
|
acc[dll] = versions.assemblyVersion.split('.').slice(0, -1).join('.');
|
|
233160
233162
|
return acc;
|
|
233161
233163
|
}, {});
|
|
233164
|
+
// `dotnet publish` does not support multiple consecutive `--runtime` parameters, so there should really only
|
|
233165
|
+
// be one. Thus, drop iterating more.
|
|
233166
|
+
return;
|
|
233162
233167
|
});
|
|
233163
233168
|
if ((0, lodash_1.isEmpty)(runtimeAssemblyVersions)) {
|
|
233164
233169
|
throw new errors.FileNotProcessableError('collection of runtime assembly versions was empty, that should not happen');
|
|
233165
233170
|
}
|
|
233166
233171
|
debug('finished extracting runtime assemblies from ' + filePath);
|
|
233167
|
-
|
|
233168
|
-
// RIDs. Currently, we are only looking at the first one.
|
|
233169
|
-
return Object.values(runtimeAssemblyVersions)[0];
|
|
233172
|
+
return runtimeAssemblyVersions;
|
|
233170
233173
|
}
|
|
233171
233174
|
exports.generateRuntimeAssemblies = generateRuntimeAssemblies;
|
|
233172
233175
|
//# sourceMappingURL=runtime-assembly.js.map
|