snyk 1.882.0 → 1.883.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/477.index.js +12 -3
- package/dist/cli/477.index.js.map +1 -1
- package/dist/cli/535.index.js +40 -3
- package/dist/cli/535.index.js.map +1 -1
- package/dist/cli/917.index.js +1 -1
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/package.json +1 -1
package/dist/cli/477.index.js
CHANGED
|
@@ -44,22 +44,31 @@ const snyk_policy_1 = __webpack_require__(70535);
|
|
|
44
44
|
const config_1 = __webpack_require__(22541);
|
|
45
45
|
async function display(policy) {
|
|
46
46
|
const p = snyk_policy_1.demunge(policy, config_1.default.ROOT);
|
|
47
|
+
const delimiter = '\n\n------------------------\n';
|
|
47
48
|
let res = chalk_1.default.bold('Current Snyk policy, read from ' + policy.__filename + ' file') + '\n';
|
|
48
49
|
res += 'Modified: ' + policy.__modified + '\n';
|
|
49
50
|
res += 'Created: ' + policy.__created + '\n';
|
|
50
51
|
res += p.patch.map(displayRule('Patch vulnerability')).join('\n');
|
|
51
52
|
if (p.patch.length && p.ignore.length) {
|
|
52
|
-
res +=
|
|
53
|
+
res += delimiter;
|
|
53
54
|
}
|
|
54
55
|
res += p.ignore.map(displayRule('Ignore')).join('\n');
|
|
56
|
+
if (p.ignore.length && p.exclude.length) {
|
|
57
|
+
res += delimiter;
|
|
58
|
+
}
|
|
59
|
+
res += p.exclude.map(displayRule('Exclude')).join('\n');
|
|
55
60
|
return Promise.resolve(res);
|
|
56
61
|
}
|
|
57
62
|
exports.display = display;
|
|
58
63
|
function displayRule(title) {
|
|
59
64
|
return (rule, i) => {
|
|
60
65
|
i += 1;
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
const formattedTitle = title === 'Exclude'
|
|
67
|
+
? chalk_1.default.bold(`\n#${i} ${title}`) +
|
|
68
|
+
` the following ${chalk_1.default.bold(rule.id)} items/paths:\n`
|
|
69
|
+
: chalk_1.default.bold(`\n#${i} ${title} ${rule.url}`) +
|
|
70
|
+
' in the following paths:\n';
|
|
71
|
+
return (formattedTitle +
|
|
63
72
|
rule.paths
|
|
64
73
|
.map((p) => {
|
|
65
74
|
return (p.path +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"477.index.js","mappings":";;;;;;;;;;AAAA,0CAAsC;AACtC,oDAAmD;AACnD,4CAI0B;AAEX,KAAK,UAAU,aAAa,CAAC,IAAa;IACvD,IAAI;QACF,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAE7D,CAAC;QACF,OAAO,MAAM,wBAAO,CAAC,YAAY,CAAC,CAAC;KACpC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,YAAyB,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC3B,YAAY,GAAG,IAAI,4BAAmB,EAAE,CAAC;SAC1C;aAAM;YACL,YAAY,GAAG,IAAI,gCAAuB,EAAE,CAAC;YAC7C,YAAY,CAAC,UAAU,GAAG,KAAK,CAAC;SACjC;QACD,MAAM,YAAY,CAAC;KACpB;AACH,CAAC;AAhBD,gCAgBC;;;;;;;;;;;ACxBD,2CAA0B;AAC1B,iDAAsC;AACtC,4CAA8B;AAEvB,KAAK,UAAU,OAAO,CAAC,MAAM;IAClC,MAAM,CAAC,GAAG,qBAAO,CAAC,MAAM,EAAE,gBAAM,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,GAAG,GACL,eAAK,CAAC,IAAI,CACR,iCAAiC,GAAG,MAAM,CAAC,UAAU,GAAG,OAAO,CAChE,GAAG,IAAI,CAAC;IACX,GAAG,IAAI,YAAY,GAAG,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;IAC/C,GAAG,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;IA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P,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,OAAO,CACL,CAAC,CAAC,IAAI;oBACN,CAAC,CAAC,CAAC,MAAM;wBACP,CAAC,CAAC,YAAY;4BACZ,CAAC,CAAC,MAAM;4BACR,aAAa;4BACb,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE;4BACvB,IAAI;wBACN,CAAC,CAAC,EAAE,CAAC;oBACP,IAAI,CACL,CAAC;YACJ,CAAC,CAAC;iBACD,IAAI,CAAC,EAAE,CAAC;iBACR,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sources":["webpack://snyk/./src/cli/commands/policy.ts","webpack://snyk/./src/lib/display-policy.ts"],"sourcesContent":["import * as policy from 'snyk-policy';\nimport { display } from '../../lib/display-policy';\nimport {\n FailedToLoadPolicyError,\n PolicyNotFoundError,\n CustomError,\n} from '../../lib/errors';\n\nexport default async function displayPolicy(path?: string): Promise<string> {\n try {\n const loadedPolicy = (await policy.load(path || process.cwd())) as Promise<\n string\n >;\n return await display(loadedPolicy);\n } catch (error) {\n let adaptedError: CustomError;\n if (error.code === 'ENOENT') {\n adaptedError = new PolicyNotFoundError();\n } else {\n adaptedError = new FailedToLoadPolicyError();\n adaptedError.innerError = error;\n }\n throw adaptedError;\n }\n}\n","import chalk from 'chalk';\nimport { demunge } from 'snyk-policy';\nimport config from './config';\n\nexport async function display(policy) {\n const p = demunge(policy, config.ROOT);\n const delimiter = '\\n\\n------------------------\\n';\n\n let res =\n chalk.bold(\n 'Current Snyk policy, read from ' + policy.__filename + ' file',\n ) + '\\n';\n res += 'Modified: ' + policy.__modified + '\\n';\n res += 'Created: ' + policy.__created + '\\n';\n\n res += p.patch.map(displayRule('Patch vulnerability')).join('\\n');\n if (p.patch.length && p.ignore.length) {\n res += delimiter;\n }\n\n res += p.ignore.map(displayRule('Ignore')).join('\\n');\n if (p.ignore.length && p.exclude.length) {\n res += delimiter;\n }\n\n res += p.exclude.map(displayRule('Exclude')).join('\\n');\n\n return Promise.resolve(res);\n}\n\nfunction displayRule(title) {\n return (rule, i) => {\n i += 1;\n\n const formattedTitle =\n title === 'Exclude'\n ? chalk.bold(`\\n#${i} ${title}`) +\n ` the following ${chalk.bold(rule.id)} items/paths:\\n`\n : chalk.bold(`\\n#${i} ${title} ${rule.url}`) +\n ' in the following paths:\\n';\n\n return (\n formattedTitle +\n rule.paths\n .map((p) => {\n return (\n p.path +\n (p.reason\n ? '\\nReason: ' +\n p.reason +\n '\\nExpires: ' +\n p.expires.toUTCString() +\n '\\n'\n : '') +\n '\\n'\n );\n })\n .join('')\n .replace(/\\s*$/, '')\n );\n };\n}\n"],"names":[],"sourceRoot":""}
|
package/dist/cli/535.index.js
CHANGED
|
@@ -12836,6 +12836,34 @@ try {
|
|
|
12836
12836
|
} catch (er) {}
|
|
12837
12837
|
|
|
12838
12838
|
|
|
12839
|
+
/***/ }),
|
|
12840
|
+
|
|
12841
|
+
/***/ 70382:
|
|
12842
|
+
/***/ ((module) => {
|
|
12843
|
+
|
|
12844
|
+
module.exports = addExclude;
|
|
12845
|
+
|
|
12846
|
+
function addExclude(policy, pattern, group='global') {
|
|
12847
|
+
if (!isPatternGroupValid(group)) {
|
|
12848
|
+
throw new Error('invalid file pattern-group');
|
|
12849
|
+
}
|
|
12850
|
+
|
|
12851
|
+
policy.exclude = policy.exclude ? policy.exclude: {};
|
|
12852
|
+
|
|
12853
|
+
const patterns = policy.exclude[group] ? policy.exclude[group]: [];
|
|
12854
|
+
|
|
12855
|
+
if (patterns.includes(pattern)) {
|
|
12856
|
+
return; // Exit early, to prevent duplication
|
|
12857
|
+
}
|
|
12858
|
+
|
|
12859
|
+
policy.exclude[group] = [...patterns, pattern];
|
|
12860
|
+
}
|
|
12861
|
+
|
|
12862
|
+
function isPatternGroupValid(group) {
|
|
12863
|
+
return ['global', 'code'].includes(group);
|
|
12864
|
+
}
|
|
12865
|
+
|
|
12866
|
+
|
|
12839
12867
|
/***/ }),
|
|
12840
12868
|
|
|
12841
12869
|
/***/ 24763:
|
|
@@ -13373,6 +13401,7 @@ const parse = __webpack_require__(791);
|
|
|
13373
13401
|
const tryRequire = __webpack_require__(14402);
|
|
13374
13402
|
const filter = __webpack_require__(10877);
|
|
13375
13403
|
const add = __webpack_require__(24763);
|
|
13404
|
+
const addExclude = __webpack_require__(70382);
|
|
13376
13405
|
|
|
13377
13406
|
module.exports = {
|
|
13378
13407
|
filter: filter,
|
|
@@ -13383,6 +13412,7 @@ module.exports = {
|
|
|
13383
13412
|
matchToRule: match.matchToRule,
|
|
13384
13413
|
loadFromText: loadFromText,
|
|
13385
13414
|
add: add,
|
|
13415
|
+
addExclude: addExclude,
|
|
13386
13416
|
create: create,
|
|
13387
13417
|
};
|
|
13388
13418
|
|
|
@@ -13410,6 +13440,7 @@ function attachMethods(policy) {
|
|
|
13410
13440
|
policy.add = add.bind(null, policy);
|
|
13411
13441
|
policy.addIgnore = add.bind(null, policy, 'ignore');
|
|
13412
13442
|
policy.addPatch = add.bind(null, policy, 'patch');
|
|
13443
|
+
policy.addExclude = addExclude.bind(null, policy);
|
|
13413
13444
|
return policy;
|
|
13414
13445
|
}
|
|
13415
13446
|
|
|
@@ -13840,15 +13871,21 @@ function demunge(policy, apiRoot) {
|
|
|
13840
13871
|
apiRoot = '';
|
|
13841
13872
|
}
|
|
13842
13873
|
|
|
13843
|
-
const res = ['ignore', 'patch'].reduce(function (acc, type) {
|
|
13874
|
+
const res = ['ignore', 'patch', 'exclude'].reduce(function (acc, type) {
|
|
13844
13875
|
acc[type] = policy[type]
|
|
13845
13876
|
? Object.keys(policy[type]).map(function (id) {
|
|
13846
13877
|
const paths = policy[type][id].map(function (pathObj) {
|
|
13878
|
+
if (type === 'exclude' && typeof pathObj === 'string') {
|
|
13879
|
+
return {
|
|
13880
|
+
path: pathObj,
|
|
13881
|
+
};
|
|
13882
|
+
}
|
|
13883
|
+
|
|
13847
13884
|
const path = Object.keys(pathObj).pop();
|
|
13848
13885
|
const res = {
|
|
13849
13886
|
path: path,
|
|
13850
13887
|
};
|
|
13851
|
-
if (type === 'ignore') {
|
|
13888
|
+
if (type === 'ignore' || type === 'exclude') {
|
|
13852
13889
|
res.reason = pathObj[path].reason;
|
|
13853
13890
|
res.expires =
|
|
13854
13891
|
pathObj[path].expires && new Date(pathObj[path].expires);
|
|
@@ -17804,7 +17841,7 @@ try {
|
|
|
17804
17841
|
/***/ ((module) => {
|
|
17805
17842
|
|
|
17806
17843
|
"use strict";
|
|
17807
|
-
module.exports = JSON.parse('{"name":"snyk-policy","description":"Snyk\'s policy parser and matching logic","main":"lib/index.js","scripts":{"lint":"run-p --max-parallel=${JOBS:-6} --aggregate-output lint:*","lint:eslint":"eslint -c .eslintrc lib","lint:commits":"commitlint --from=HEAD~20","format":"prettier --write \'{lib,test}/**/*.?s\'","check-tests":"! grep \'test.only\' test/**/*.test.js -n","env":"node -e \'console.log(process.env, process.versions)\'","tap":"tap test/**/*.test.js -R spec --timeout=60","test":"npm run check-tests && npm run tap"},"keywords":["snyk"],"author":"Remy Sharp","license":"Apache-2.0","devDependencies":{"@commitlint/cli":"^12.1.4","eslint":"^5.0.0","eslint-config-prettier":"^5.0.0","npm-run-all":"^4.1.5","prettier":"^2.0.5","proxyquire":"^2.1.0","sinon":"^4.0.0","tap":"^12.0.1","tap-only":"0.0.5"},"dependencies":{"debug":"^4.1.1","email-validator":"^2.0.4","js-yaml":"^3.13.1","lodash.clonedeep":"^4.5.0","promise-fs":"^2.1.1","semver":"^7.3.4","snyk-module":"^3.0.0","snyk-resolve":"^1.1.0","snyk-try-require":"^2.0.2"},"repository":{"type":"git","url":"https://github.com/snyk/policy.git"},"version":"1.
|
|
17844
|
+
module.exports = JSON.parse('{"name":"snyk-policy","description":"Snyk\'s policy parser and matching logic","main":"lib/index.js","scripts":{"lint":"run-p --max-parallel=${JOBS:-6} --aggregate-output lint:*","lint:eslint":"eslint -c .eslintrc lib","lint:commits":"commitlint --from=HEAD~20","format":"prettier --write \'{lib,test}/**/*.?s\'","check-tests":"! grep \'test.only\' test/**/*.test.js -n","env":"node -e \'console.log(process.env, process.versions)\'","tap":"tap test/**/*.test.js -R spec --timeout=60","test":"npm run check-tests && npm run tap"},"keywords":["snyk"],"author":"Remy Sharp","license":"Apache-2.0","devDependencies":{"@commitlint/cli":"^12.1.4","eslint":"^5.0.0","eslint-config-prettier":"^5.0.0","npm-run-all":"^4.1.5","prettier":"^2.0.5","proxyquire":"^2.1.0","sinon":"^4.0.0","tap":"^12.0.1","tap-only":"0.0.5"},"dependencies":{"debug":"^4.1.1","email-validator":"^2.0.4","js-yaml":"^3.13.1","lodash.clonedeep":"^4.5.0","promise-fs":"^2.1.1","semver":"^7.3.4","snyk-module":"^3.0.0","snyk-resolve":"^1.1.0","snyk-try-require":"^2.0.2"},"repository":{"type":"git","url":"https://github.com/snyk/policy.git"},"version":"1.24.0"}');
|
|
17808
17845
|
|
|
17809
17846
|
/***/ })
|
|
17810
17847
|
|