snyk 1.1177.0 → 1.1179.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/784.index.js +40 -9
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/95.index.js +1 -0
- package/dist/cli/95.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/dist/lib/ecosystems/unmanaged/utils.d.ts +4 -0
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +10 -10
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +10 -10
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/784.index.js
CHANGED
|
@@ -1047,10 +1047,6 @@ async function resolveAndTestFacts(ecosystem, scans, options) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
1049
|
exports.resolveAndTestFacts = resolveAndTestFacts;
|
|
1050
|
-
async function getOrgDefaultContext() {
|
|
1051
|
-
var _a;
|
|
1052
|
-
return (_a = (await utils_1.getSelf())) === null || _a === void 0 ? void 0 : _a.data.attributes.default_org_context;
|
|
1053
|
-
}
|
|
1054
1050
|
async function submitHashes(hashes, orgId) {
|
|
1055
1051
|
const response = await polling_test_1.createDepGraph(hashes, orgId);
|
|
1056
1052
|
return response.data.id;
|
|
@@ -1113,7 +1109,7 @@ async function resolveAndTestFactsUnmanagedDeps(scans, options) {
|
|
|
1113
1109
|
const errors = [];
|
|
1114
1110
|
const packageManager = 'Unmanaged (C/C++)';
|
|
1115
1111
|
const displayTargetFile = '';
|
|
1116
|
-
const orgId = options.org
|
|
1112
|
+
const orgId = await utils_1.getOrg(options.org);
|
|
1117
1113
|
const target_severity = options.severityThreshold || common_2.SEVERITY.LOW;
|
|
1118
1114
|
if (orgId === '') {
|
|
1119
1115
|
errors.push('organisation-id missing');
|
|
@@ -1377,11 +1373,12 @@ async function testDependencies(scans, options) {
|
|
|
1377
1373
|
"use strict";
|
|
1378
1374
|
|
|
1379
1375
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1380
|
-
exports.getUnmanagedDepGraph = exports.getSelf = exports.convertDepGraph = exports.convertObjectArrayCasing = exports.convertMapCasing = exports.convertToCamelCase = void 0;
|
|
1376
|
+
exports.getUnmanagedDepGraph = exports.getOrg = exports.isUUID = exports.getOrgDefaultContext = exports.getSelf = exports.getOrgIdFromSlug = exports.convertDepGraph = exports.convertObjectArrayCasing = exports.convertMapCasing = exports.convertToCamelCase = void 0;
|
|
1381
1377
|
const camelCase = __webpack_require__(76884);
|
|
1382
1378
|
const config_1 = __webpack_require__(25425);
|
|
1383
1379
|
const promise_1 = __webpack_require__(90430);
|
|
1384
1380
|
const resolve_test_facts_1 = __webpack_require__(85164);
|
|
1381
|
+
const api_token_1 = __webpack_require__(95181);
|
|
1385
1382
|
function mapKey(object, iteratee) {
|
|
1386
1383
|
object = Object(object);
|
|
1387
1384
|
const result = {};
|
|
@@ -1419,6 +1416,22 @@ function convertDepGraph(depGraphOpenApi) {
|
|
|
1419
1416
|
return depGraph;
|
|
1420
1417
|
}
|
|
1421
1418
|
exports.convertDepGraph = convertDepGraph;
|
|
1419
|
+
async function getOrgIdFromSlug(slug) {
|
|
1420
|
+
const res = await promise_1.makeRequest({
|
|
1421
|
+
method: 'GET',
|
|
1422
|
+
headers: {
|
|
1423
|
+
Authorization: api_token_1.getAuthHeader(),
|
|
1424
|
+
},
|
|
1425
|
+
url: config_1.default.API + '/orgs',
|
|
1426
|
+
});
|
|
1427
|
+
for (const org of res.orgs) {
|
|
1428
|
+
if (org.slug === slug) {
|
|
1429
|
+
return org.id;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
return '';
|
|
1433
|
+
}
|
|
1434
|
+
exports.getOrgIdFromSlug = getOrgIdFromSlug;
|
|
1422
1435
|
function getSelf() {
|
|
1423
1436
|
return promise_1.makeRequestRest({
|
|
1424
1437
|
method: 'GET',
|
|
@@ -1426,13 +1439,31 @@ function getSelf() {
|
|
|
1426
1439
|
});
|
|
1427
1440
|
}
|
|
1428
1441
|
exports.getSelf = getSelf;
|
|
1442
|
+
async function getOrgDefaultContext() {
|
|
1443
|
+
var _a;
|
|
1444
|
+
return (_a = (await getSelf())) === null || _a === void 0 ? void 0 : _a.data.attributes.default_org_context;
|
|
1445
|
+
}
|
|
1446
|
+
exports.getOrgDefaultContext = getOrgDefaultContext;
|
|
1447
|
+
function isUUID(str) {
|
|
1448
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1449
|
+
return uuidRegex.test(str);
|
|
1450
|
+
}
|
|
1451
|
+
exports.isUUID = isUUID;
|
|
1452
|
+
async function getOrg(org) {
|
|
1453
|
+
let orgId = org || (await getOrgDefaultContext()) || '';
|
|
1454
|
+
if (!isUUID(orgId)) {
|
|
1455
|
+
orgId = await getOrgIdFromSlug(orgId);
|
|
1456
|
+
}
|
|
1457
|
+
return orgId;
|
|
1458
|
+
}
|
|
1459
|
+
exports.getOrg = getOrg;
|
|
1429
1460
|
async function getUnmanagedDepGraph(scans) {
|
|
1430
|
-
var _a
|
|
1461
|
+
var _a;
|
|
1431
1462
|
const results = [];
|
|
1432
|
-
const orgId =
|
|
1463
|
+
const orgId = await getOrgDefaultContext();
|
|
1433
1464
|
for (const [, scanResults] of Object.entries(scans)) {
|
|
1434
1465
|
for (const scanResult of scanResults) {
|
|
1435
|
-
const taskId = await resolve_test_facts_1.submitHashes({ hashes: (
|
|
1466
|
+
const taskId = await resolve_test_facts_1.submitHashes({ hashes: (_a = scanResult === null || scanResult === void 0 ? void 0 : scanResult.facts[0]) === null || _a === void 0 ? void 0 : _a.data }, orgId);
|
|
1436
1467
|
const { dep_graph_data } = await resolve_test_facts_1.pollDepGraphAttributes(taskId, orgId);
|
|
1437
1468
|
if (dep_graph_data) {
|
|
1438
1469
|
results.push(dep_graph_data);
|