API/api.medcify.app/node_modules/snyk/dist/cli/784.index.js.map
2022-09-26 11:41:44 +05:30

1 line
481 KiB
Plaintext

{"version":3,"file":"784.index.js","mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACRA,2CAA0B;AAC1B,sCAAyB;AACzB,yCAA+B;AAC/B,4CAAiC;AACjC,mDAAgE;AAChE,sDAAiE;AACjE,iDAAyD;AAEzD,2CAW4B;AAC5B,4CAAyC;AACzC,0CAA8C;AAE9C,6CAA+C;AAC/C,6CAAoD;AAEpD,+CAA+D;AAC/D,gDAAgF;AAChF,4CAA8D;AAC9D,0DAAoE;AACpE,uCAAsC,CAAC,6BAA6B;AACpE,gDAA8D;AAC9D,yDAA8E;AAC9E,6DAAoF;AACpF,6DAAqF;AAErF,8EAAgH;AAChH,gFAAmH;AAEnH,wDAA0E;AAC1E,4CAK6B;AAC7B,2DAAwE;AACxE,+CAAyE;AACzE,6CAA4E;AAC5E,0DAA6D;AAE7D,MAAM,SAAS,GAAG,6DAA6D,CAAC;AAChF,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAE5B,oFAAoF;AACpF,iDAAiD;AACjD,KAAK,UAAU,gBAAgB,CAC7B,CAAa,EACb,OAAqB;IAErB,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACvB,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,iGAAiG;AACjG,uBAAuB;AACR,KAAK,UAAU,OAAO,CAAC,GAAG,KAAiB;;IACxD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,yCAAkB,CAAC,GAAG,KAAK,CAAC,CAAC;IACxD,MAAM,OAAO,GAAkC,EAAE,CAAC;IAElD,IAAI,OAAO,CAAC,EAAE,EAAE;QACd,IAAI,C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AChDA;;AAEA,eAAe,mBAAO,CAAC,KAAW;AAClC,QAAQ,UAAU,EAAE,mBAAO,CAAC,IAAY;AACxC,cAAc,mBAAO,CAAC,KAAO;AAC7B,WAAW,mBAAO,CAAC,KAAqB;AACxC,QAAQ,iCAAiC,EAAE,mBAAO,CAAC,KAAW;AAC9D,QAAQ,qBAAqB,EAAE,mBAAO,CAAC,KAA0B;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://snyk/./node_modules/@yarnpkg/core/lib|sync","webpack://snyk/./node_modules/keyv/src|sync","webpack://snyk/./src/cli/commands/monitor/index.ts","webpack://snyk/./src/cli/commands/monitor/process-json-monitor.ts","webpack://snyk/./src/cli/commands/process-command-args.ts","webpack://snyk/./src/cli/commands/types.ts","webpack://snyk/./src/lib/check-paths.ts","webpack://snyk/./src/lib/code-config.ts","webpack://snyk/./src/lib/constants.ts","webpack://snyk/./src/lib/ecosystems/common.ts","webpack://snyk/./src/lib/ecosystems/index.ts","webpack://snyk/./src/lib/ecosystems/monitor.ts","webpack://snyk/./src/lib/ecosystems/plugin-analytics.ts","webpack://snyk/./src/lib/ecosystems/plugins.ts","webpack://snyk/./src/lib/ecosystems/policy.ts","webpack://snyk/./src/lib/ecosystems/resolve-monitor-facts.ts","webpack://snyk/./src/lib/ecosystems/resolve-test-facts.ts","webpack://snyk/./src/lib/ecosystems/test.ts","webpack://snyk/./src/lib/error-format.ts","webpack://snyk/./src/lib/errors/invalid-remote-url-error.ts","webpack://snyk/./src/lib/feature-flags/index.ts","webpack://snyk/./src/lib/find-files.ts","webpack://snyk/./src/lib/formatters/docker/format-docker-advice.ts","webpack://snyk/./src/lib/formatters/docker/format-docker-binary-heading.ts","webpack://snyk/./src/lib/formatters/docker/format-docker-binary-issues.ts","webpack://snyk/./src/lib/formatters/docker/index.ts","webpack://snyk/./src/lib/formatters/format-error-result-summary.ts","webpack://snyk/./src/lib/formatters/format-monitor-response.ts","webpack://snyk/./src/lib/formatters/format-reachability.ts","webpack://snyk/./src/lib/formatters/format-test-meta.ts","webpack://snyk/./src/lib/formatters/format-vulnerable-result-summary.ts","webpack://snyk/./src/lib/formatters/get-severity-value.ts","webpack://snyk/./src/lib/formatters/iac-output/index.ts","webpack://snyk/./src/lib/formatters/iac-output/v1/index.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/failures/index.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/failures/list.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/failures/tip.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/formatters.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/index.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/issues-list/index.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/issues-list/issue.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/share-results.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/test-summary.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/user-messages.ts","webpack://snyk/./src/lib/formatters/iac-output/v2/utils.ts","webpack://snyk/./src/lib/formatters/index.ts","webpack://snyk/./src/lib/formatters/legacy-format-issue.ts","webpack://snyk/./src/lib/formatters/legal-license-instructions.ts","webpack://snyk/./src/lib/formatters/remediation-based-format-issues.ts","webpack://snyk/./src/lib/formatters/sarif-output.ts","webpack://snyk/./src/lib/formatters/show-all-projects-tip.ts","webpack://snyk/./src/lib/formatters/show-all-sub-projects-tip.ts","webpack://snyk/./src/lib/formatters/show-multi-scan-tip.ts","webpack://snyk/./src/lib/get-file-contents.ts","webpack://snyk/./src/lib/iac/constants.ts","webpack://snyk/./src/lib/iac/git.ts","webpack://snyk/./src/lib/is-multi-project-scan.ts","webpack://snyk/./src/lib/json.ts","webpack://snyk/./src/lib/module-info/index.ts","webpack://snyk/./src/lib/monitor/count-total-deps-in-tree.ts","webpack://snyk/./src/lib/monitor/dev-count-analysis.ts","webpack://snyk/./src/lib/monitor/drop-empty-deps.ts","webpack://snyk/./src/lib/monitor/filter-out-missing-deps.ts","webpack://snyk/./src/lib/monitor/index.ts","webpack://snyk/./src/lib/monitor/prune-dep-tree.ts","webpack://snyk/./src/lib/monitor/utils.ts","webpack://snyk/./src/lib/options-validator.ts","webpack://snyk/./src/lib/plugins/convert-multi-plugin-res-to-multi-custom.ts","webpack://snyk/./src/lib/plugins/convert-scanned-projects-to-custom.ts","webpack://snyk/./src/lib/plugins/convert-single-splugin-res-to-multi-custom.ts","webpack://snyk/./src/lib/plugins/extract-package-manager.ts","webpack://snyk/./src/lib/plugins/get-deps-from-plugin.ts","webpack://snyk/./src/lib/plugins/get-extra-project-count.ts","webpack://snyk/./src/lib/plugins/get-multi-plugin-result.ts","webpack://snyk/./src/lib/plugins/get-single-plugin-result.ts","webpack://snyk/./src/lib/plugins/index.ts","webpack://snyk/./src/lib/plugins/nodejs-plugin/index.ts","webpack://snyk/./src/lib/plugins/nodejs-plugin/npm-lock-parser.ts","webpack://snyk/./src/lib/plugins/nodejs-plugin/npm-modules-parser.ts","webpack://snyk/./src/lib/plugins/nodejs-plugin/yarn-workspaces-parser.ts","webpack://snyk/./src/lib/plugins/rubygems/index.ts","webpack://snyk/./src/lib/plugins/rubygems/inspectors/gemfile.ts","webpack://snyk/./src/lib/plugins/rubygems/inspectors/gemspec.ts","webpack://snyk/./src/lib/plugins/rubygems/inspectors/index.ts","webpack://snyk/./src/lib/plugins/rubygems/inspectors/try-get-spec.ts","webpack://snyk/./src/lib/plugins/sast/analysis.ts","webpack://snyk/./src/lib/plugins/sast/checks.ts","webpack://snyk/./src/lib/plugins/sast/errors/index.ts","webpack://snyk/./src/lib/plugins/sast/errors/missing-configuration-error.ts","webpack://snyk/./src/lib/plugins/sast/errors/unsupported-feature-snyk-code-error.ts","webpack://snyk/./src/lib/plugins/sast/format/output-format.ts","webpack://snyk/./src/lib/plugins/sast/index.ts","webpack://snyk/./src/lib/plugins/sast/settings.ts","webpack://snyk/./src/lib/plugins/sast/utils/index.ts","webpack://snyk/./src/lib/plugins/sast/utils/testEmitter.ts","webpack://snyk/./src/lib/policy/find-and-load-policy.ts","webpack://snyk/./src/lib/policy/index.ts","webpack://snyk/./src/lib/policy/pluck-policies.ts","webpack://snyk/./src/lib/polling/common.ts","webpack://snyk/./src/lib/polling/polling-monitor.ts","webpack://snyk/./src/lib/polling/polling-test.ts","webpack://snyk/./src/lib/print-deps.ts","webpack://snyk/./src/lib/project-metadata/index.ts","webpack://snyk/./src/lib/project-metadata/target-builders/container.ts","webpack://snyk/./src/lib/project-metadata/target-builders/git.ts","webpack://snyk/./src/lib/project-metadata/types.ts","webpack://snyk/./src/lib/prune.ts","webpack://snyk/./src/lib/reachable-vulns.ts","webpack://snyk/./src/lib/request/promise.ts","webpack://snyk/./src/lib/right-pad.ts","webpack://snyk/./src/lib/snyk-test/assemble-payloads.ts","webpack://snyk/./src/lib/snyk-test/legacy.ts","webpack://snyk/./src/lib/snyk-test/run-test.ts","webpack://snyk/./src/lib/sub-process.ts","webpack://snyk/./src/lib/index.js","webpack://snyk/./src/lib/plugins/rubygems/gemfile-lock-to-dependencies.js","webpack://snyk/./src/lib/snyk-test/index.js"],"sourcesContent":["function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = () => ([]);\nwebpackEmptyContext.resolve = webpackEmptyContext;\nwebpackEmptyContext.id = 61452;\nmodule.exports = webpackEmptyContext;","function webpackEmptyContext(req) {\n\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\te.code = 'MODULE_NOT_FOUND';\n\tthrow e;\n}\nwebpackEmptyContext.keys = () => ([]);\nwebpackEmptyContext.resolve = webpackEmptyContext;\nwebpackEmptyContext.id = 3196;\nmodule.exports = webpackEmptyContext;","import chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as Debug from 'debug';\nimport * as pathUtil from 'path';\nimport { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { validateOptions } from '../../../lib/options-validator';\nimport { checkOSSPaths } from '../../../lib/check-paths';\n\nimport {\n MonitorOptions,\n MonitorMeta,\n MonitorResult,\n Options,\n Contributor,\n ProjectAttributes,\n PROJECT_CRITICALITY,\n PROJECT_ENVIRONMENT,\n PROJECT_LIFECYCLE,\n Tag,\n} from '../../../lib/types';\nimport config from '../../../lib/config';\nimport * as detect from '../../../lib/detect';\nimport { GoodResult, BadResult } from './types';\nimport { spinner } from '../../../lib/spinner';\nimport * as analytics from '../../../lib/analytics';\nimport { MethodArgs } from '../../args';\nimport { apiOrOAuthTokenExists } from '../../../lib/api-token';\nimport { maybePrintDepTree, maybePrintDepGraph } from '../../../lib/print-deps';\nimport { monitor as snykMonitor } from '../../../lib/monitor';\nimport { processJsonMonitorResponse } from './process-json-monitor';\nimport snyk = require('../../../lib'); // TODO(kyegupov): fix import\nimport { formatMonitorOutput } from '../../../lib/formatters';\nimport { getDepsFromPlugin } from '../../../lib/plugins/get-deps-from-plugin';\nimport { getExtraProjectCount } from '../../../lib/plugins/get-extra-project-count';\nimport { extractPackageManager } from '../../../lib/plugins/extract-package-manager';\nimport { MultiProjectResultCustom } from '../../../lib/plugins/get-multi-plugin-result';\nimport { convertMultiResultToMultiCustom } from '../../../lib/plugins/convert-multi-plugin-res-to-multi-custom';\nimport { convertSingleResultToMultiCustom } from '../../../lib/plugins/convert-single-splugin-res-to-multi-custom';\nimport { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';\nimport { getContributors } from '../../../lib/monitor/dev-count-analysis';\nimport {\n FailedToRunTestError,\n MonitorError,\n MissingArgError,\n ValidationError,\n} from '../../../lib/errors';\nimport { isMultiProjectScan } from '../../../lib/is-multi-project-scan';\nimport { getEcosystem, monitorEcosystem } from '../../../lib/ecosystems';\nimport { getFormattedMonitorOutput } from '../../../lib/ecosystems/monitor';\nimport { processCommandArgs } from '../process-command-args';\n\nconst SEPARATOR = '\\n-------------------------------------------------------\\n';\nconst debug = Debug('snyk');\n\n// This is used instead of `let x; try { x = await ... } catch { cleanup }` to avoid\n// declaring the type of x as possibly undefined.\nasync function promiseOrCleanup<T>(\n p: Promise<T>,\n cleanup: (x?) => void,\n): Promise<T> {\n return p.catch((error) => {\n cleanup();\n throw error;\n });\n}\n\n// Returns an array of Registry responses (one per every sub-project scanned), a single response,\n// or an error message.\nexport default async function monitor(...args0: MethodArgs): Promise<any> {\n const { options, paths } = processCommandArgs(...args0);\n const results: Array<GoodResult | BadResult> = [];\n\n if (options.id) {\n snyk.id = options.id;\n }\n\n if (options.allSubProjects && options['project-name']) {\n throw new Error(\n '`--all-sub-projects` is currently not compatible with `--project-name`',\n );\n }\n\n if (!options.docker) {\n checkOSSPaths(paths, options);\n }\n\n if (options.docker && options['remote-repo-url']) {\n throw new Error('`--remote-repo-url` is not supported for container scans');\n }\n\n // TODO remove once https://github.com/snyk/cli/pull/3433 is merged\n if (options.docker && !options['app-vulns']) {\n options['exclude-app-vulns'] = true;\n }\n\n // Handles no image arg provided to the container command until\n // a validation interface is implemented in the docker plugin.\n if (options.docker && paths.length === 0) {\n throw new MissingArgError();\n }\n\n apiOrOAuthTokenExists();\n\n let contributors: Contributor[] = [];\n if (!options.docker && analytics.allowAnalytics()) {\n try {\n contributors = await getContributors();\n } catch (err) {\n debug('error getting repo contributors', err);\n }\n }\n\n const ecosystem = getEcosystem(options);\n if (ecosystem) {\n const commandResult = await monitorEcosystem(\n ecosystem,\n paths,\n options,\n contributors,\n );\n\n const [monitorResults, monitorErrors] = commandResult;\n\n return await getFormattedMonitorOutput(\n results,\n monitorResults,\n monitorErrors,\n options,\n );\n }\n\n // Part 1: every argument is a scan target; process them sequentially\n for (const path of paths) {\n debug(`Processing ${path}...`);\n try {\n validateMonitorPath(path, options.docker);\n let analysisType = 'all';\n let packageManager;\n if (isMultiProjectScan(options)) {\n analysisType = 'all';\n } else if (options.docker) {\n analysisType = 'docker';\n } else {\n packageManager = detect.detectPackageManager(path, options);\n }\n\n await validateOptions(\n options as Options & MonitorOptions,\n packageManager,\n );\n\n const targetFile =\n !options.scanAllUnmanaged && options.docker && !options.file // snyk monitor --docker (without --file)\n ? undefined\n : options.file || detect.detectPackageFile(path);\n\n const displayPath = pathUtil.relative(\n '.',\n pathUtil.join(path, targetFile || ''),\n );\n\n const analyzingDepsSpinnerLabel =\n 'Analyzing ' +\n (packageManager ? packageManager : analysisType) +\n ' dependencies for ' +\n displayPath;\n\n await spinner(analyzingDepsSpinnerLabel);\n\n // Scan the project dependencies via a plugin\n debug('getDepsFromPlugin ...');\n\n // each plugin will be asked to scan once per path\n // some return single InspectResult & newer ones return Multi\n const inspectResult = await promiseOrCleanup(\n getDepsFromPlugin(path, {\n ...options,\n path,\n packageManager,\n }),\n spinner.clear(analyzingDepsSpinnerLabel),\n );\n analytics.add('pluginName', inspectResult.plugin.name);\n\n // We send results from \"all-sub-projects\" scanning as different Monitor objects\n // multi result will become default, so start migrating code to always work with it\n let perProjectResult: MultiProjectResultCustom;\n\n if (!pluginApi.isMultiResult(inspectResult)) {\n perProjectResult = convertSingleResultToMultiCustom(inspectResult);\n } else {\n perProjectResult = convertMultiResultToMultiCustom(inspectResult);\n }\n\n const failedResults = (inspectResult as MultiProjectResultCustom)\n .failedResults;\n if (failedResults?.length) {\n failedResults.forEach((result) => {\n results.push({\n ok: false,\n data: new MonitorError(500, result.errMessage),\n path: result.targetFile || '',\n });\n });\n }\n\n const postingMonitorSpinnerLabel =\n 'Posting monitor snapshot for ' + displayPath + ' ...';\n await spinner(postingMonitorSpinnerLabel);\n\n // Post the project dependencies to the Registry\n for (const projectDeps of perProjectResult.scannedProjects) {\n try {\n if (!projectDeps.depGraph && !projectDeps.depTree) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n 'Your monitor request could not be completed. Please email support@snyk.io',\n );\n }\n const extractedPackageManager = extractPackageManager(\n projectDeps,\n perProjectResult,\n options as MonitorOptions & Options,\n );\n\n analytics.add('packageManager', extractedPackageManager);\n\n const projectName = getProjectName(projectDeps);\n if (projectDeps.depGraph) {\n debug(`Processing ${projectDeps.depGraph.rootPkg?.name}...`);\n maybePrintDepGraph(options, projectDeps.depGraph);\n }\n\n if (projectDeps.depTree) {\n debug(`Processing ${projectDeps.depTree.name}...`);\n maybePrintDepTree(options, projectDeps.depTree);\n }\n\n const tFile = projectDeps.targetFile || targetFile;\n const targetFileRelativePath =\n projectDeps.plugin.targetFile ||\n (tFile && pathUtil.join(pathUtil.resolve(path), tFile)) ||\n '';\n\n const res: MonitorResult = await promiseOrCleanup(\n snykMonitor(\n path,\n generateMonitorMeta(options, extractedPackageManager),\n projectDeps,\n options,\n projectDeps.plugin as PluginMetadata,\n targetFileRelativePath,\n contributors,\n generateProjectAttributes(options),\n generateTags(options),\n ),\n spinner.clear(postingMonitorSpinnerLabel),\n );\n\n res.path = path;\n const monOutput = formatMonitorOutput(\n extractedPackageManager,\n res,\n options,\n projectName,\n await getExtraProjectCount(path, options, inspectResult),\n );\n // push a good result\n results.push({ ok: true, data: monOutput, path, projectName });\n } catch (err) {\n // pushing this error allow this inner loop to keep scanning the projects\n // even if 1 in 100 fails\n results.push({ ok: false, data: err, path });\n }\n }\n } catch (err) {\n // push this error, the loop continues\n results.push({ ok: false, data: err, path });\n } finally {\n spinner.clearAll();\n }\n }\n // Part 2: process the output from the Registry\n if (options.json) {\n return processJsonMonitorResponse(results);\n }\n\n const output = results\n .map((res) => {\n if (res.ok) {\n return res.data;\n }\n\n const errorMessage =\n res.data && res.data.userMessage\n ? chalk.bold.red(res.data.userMessage)\n : res.data\n ? res.data.message\n : 'Unknown error occurred.';\n\n return (\n chalk.bold.white('\\nMonitoring ' + res.path + '...\\n\\n') + errorMessage\n );\n })\n .join('\\n' + SEPARATOR);\n\n if (results.every((res) => res.ok)) {\n return output;\n }\n\n throw new Error(output);\n}\n\nfunction generateMonitorMeta(options, packageManager?): MonitorMeta {\n return {\n method: 'cli',\n packageManager,\n 'policy-path': options['policy-path'],\n 'project-name': options['project-name'] || config.PROJECT_NAME,\n isDocker: !!options.docker,\n prune: !!options.pruneRepeatedSubdependencies,\n 'remote-repo-url': options['remote-repo-url'],\n targetReference: options['target-reference'],\n };\n}\n\n/**\n * Parse an attribute from the CLI into the relevant enum type.\n *\n * @param attribute The project attribute (e.g. environment)\n * @param permitted Permitted options\n * @param options CLI options provided\n * @returns An array of attributes to set on the project or undefined to mean \"do not touch\".\n */\nfunction getProjectAttribute<T>(\n attribute: string,\n permitted: Record<string, T>,\n options: Options,\n): T[] | undefined {\n const permittedValues: T[] = Object.values(permitted);\n\n if (options[attribute] === undefined) {\n return undefined;\n }\n\n // Explicit flag to clear the existing values for this attribute already set on the project\n // e.g. if you specify --environment=\n // then this means you want to remove existing environment values on the project.\n if (options[attribute] === '') {\n return [];\n }\n\n // When it's specified without the =, we raise an explicit error to avoid\n // accidentally clearing the existing values.\n if (options[attribute] === true) {\n throw new ValidationError(\n `--${attribute} must contain an '=' with a comma-separated list of values. To clear all existing values, pass no values i.e. --${attribute}=`,\n );\n }\n\n const values = options[attribute].split(',');\n const extra = values.filter((value) => !permittedValues.includes(value));\n if (extra.length > 0) {\n throw new ValidationError(\n `${extra.length} invalid ${attribute}: ${extra.join(', ')}. ` +\n `Possible values are: ${permittedValues.join(', ')}`,\n );\n }\n\n return values;\n}\n\nexport function validateProjectAttributes(options): void {\n // The validation is deep within the parsing, so call the generate but throw away the return for simplicity.\n // Using this method makes it much clearer what the intent is of the caller.\n generateProjectAttributes(options);\n}\n\nexport function generateProjectAttributes(options): ProjectAttributes {\n return {\n criticality: getProjectAttribute(\n 'project-business-criticality',\n PROJECT_CRITICALITY,\n options,\n ),\n environment: getProjectAttribute(\n 'project-environment',\n PROJECT_ENVIRONMENT,\n options,\n ),\n lifecycle: getProjectAttribute(\n 'project-lifecycle',\n PROJECT_LIFECYCLE,\n options,\n ),\n };\n}\n\n/**\n * Parse CLI --tags options into an internal data structure.\n *\n * If this returns undefined, it means \"do not touch the existing tags on the project\".\n *\n * Anything else means \"replace existing tags on the project with this list\" even if empty.\n *\n * @param options CLI options\n * @returns List of parsed tags or undefined if they are to be left untouched.\n */\nexport function generateTags(options): Tag[] | undefined {\n if (options['project-tags'] === undefined && options['tags'] === undefined) {\n return undefined;\n }\n\n if (options['project-tags'] !== undefined && options['tags'] !== undefined) {\n throw new ValidationError(\n 'Only one of --tags or --project-tags may be specified, not both',\n );\n }\n\n const rawTags =\n options['tags'] === undefined ? options['project-tags'] : options['tags'];\n\n if (rawTags === '') {\n return [];\n }\n\n // When it's specified without the =, we raise an explicit error to avoid\n // accidentally clearing the existing tags;\n if (rawTags === true) {\n throw new ValidationError(\n `--project-tags must contain an '=' with a comma-separated list of pairs (also separated with an '='). To clear all existing values, pass no values i.e. --project-tags=`,\n );\n }\n\n const keyEqualsValuePairs = rawTags.split(',');\n\n const tags: Tag[] = [];\n for (const keyEqualsValue of keyEqualsValuePairs) {\n const parts = keyEqualsValue.split('=');\n if (parts.length !== 2) {\n throw new ValidationError(\n `The tag \"${keyEqualsValue}\" does not have an \"=\" separating the key and value. For example: --project-tag=KEY=VALUE`,\n );\n }\n tags.push({\n key: parts[0],\n value: parts[1],\n });\n }\n\n return tags;\n}\n\nexport function validateTags(options): void {\n // The validation is deep within the parsing, so call the generate but throw away the return for simplicity.\n // Using this method makes it much clearer what the intent is of the caller.\n generateTags(options);\n}\n\nfunction validateMonitorPath(path: string, isDocker?: boolean): void {\n const exists = fs.existsSync(path);\n if (!exists && !isDocker) {\n throw new Error('\"' + path + '\" is not a valid path for \"snyk monitor\"');\n }\n}\n\nfunction getProjectName(projectDeps): string {\n return (\n projectDeps.meta?.gradleProjectName ||\n projectDeps.depGraph?.rootPkg?.name ||\n projectDeps.depTree?.name\n );\n}\n","import { GoodResult, BadResult } from './types';\n\nexport function processJsonMonitorResponse(\n results: Array<GoodResult | BadResult>,\n): string {\n let dataToSend = results.map((result) => {\n if (result.ok) {\n const jsonData = JSON.parse(result.data);\n if (result.projectName) {\n jsonData.projectName = result.projectName;\n }\n return jsonData;\n }\n return { ok: false, error: result.data.message, path: result.path };\n });\n // backwards compat - strip array if only one result\n dataToSend = dataToSend.length === 1 ? dataToSend[0] : dataToSend;\n const stringifiedData = JSON.stringify(dataToSend, null, 2);\n\n if (results.every((res) => res.ok)) {\n return stringifiedData;\n }\n const err = new Error(stringifiedData) as any;\n err.json = stringifiedData;\n throw err;\n}\n","import { Options } from '../../lib/types';\n\nexport function processCommandArgs<CommandOptions>(\n ...args\n): { paths: string[]; options: Options & CommandOptions } {\n let options = ({} as any) as Options & CommandOptions;\n\n if (typeof args[args.length - 1] === 'object') {\n options = (args.pop() as any) as Options & CommandOptions;\n }\n args = args.filter(Boolean);\n\n // For repository scanning, populate with default path (cwd) if no path given\n if (args.length === 0 && !options.docker) {\n args.unshift(process.cwd());\n }\n\n return { options, paths: args };\n}\n","export type MethodResult = CommandResult | string | void;\n\nexport class CommandResult {\n result: string;\n constructor(result: string) {\n this.result = result;\n }\n\n public toString(): string {\n return this.result;\n }\n\n public getDisplayResults() {\n return this.result;\n }\n}\n\nexport abstract class TestCommandResult extends CommandResult {\n protected jsonResult = '';\n protected sarifResult = '';\n\n public getJsonResult(): string {\n return this.jsonResult;\n }\n\n public getSarifResult(): string {\n return this.sarifResult;\n }\n\n public static createHumanReadableTestCommandResult(\n humanReadableResult: string,\n jsonResult: string,\n sarifResult?: string,\n ): HumanReadableTestCommandResult {\n return new HumanReadableTestCommandResult(\n humanReadableResult,\n jsonResult,\n sarifResult,\n );\n }\n\n public static createJsonTestCommandResult(\n stdout: string,\n jsonResult?: string,\n sarifResult?: string,\n ): JsonTestCommandResult {\n return new JsonTestCommandResult(stdout, jsonResult, sarifResult);\n }\n}\n\nclass HumanReadableTestCommandResult extends TestCommandResult {\n protected jsonResult = '';\n protected sarifResult = '';\n\n constructor(\n humanReadableResult: string,\n jsonResult: string,\n sarifResult?: string,\n ) {\n super(humanReadableResult);\n this.jsonResult = jsonResult;\n if (sarifResult) {\n this.sarifResult = sarifResult;\n }\n }\n\n public getJsonResult(): string {\n return this.jsonResult;\n }\n\n public getSarifResult(): string {\n return this.sarifResult;\n }\n}\n\nclass JsonTestCommandResult extends TestCommandResult {\n constructor(stdout: string, jsonResult?: string, sarifResult?: string) {\n super(stdout);\n if (jsonResult) {\n this.jsonResult = jsonResult;\n }\n if (sarifResult) {\n this.sarifResult = sarifResult;\n } else {\n this.jsonResult = stdout;\n }\n }\n\n public getJsonResult(): string {\n return this.jsonResult;\n }\n\n public getSarifResult(): string {\n return this.sarifResult;\n }\n}\n\nexport interface IgnoreMetadata {\n reason: string;\n expires: Date;\n created: Date;\n}\n\nexport interface IgnoreRulePathData {\n [path: string]: IgnoreMetadata;\n}\n\nexport interface IgnoreRules {\n [issueId: string]: IgnoreRulePathData[];\n}\n","import {\n MissingTargetFileError,\n UnsupportedOptionCombinationError,\n} from './errors';\nimport { isPathToPackageFile } from './detect';\nimport { Options } from './types';\n\n// Throw error if user specifies package file name as part of path,\n// and if user specifies multiple paths and used project-name option.\nexport function checkOSSPaths(paths: string[], options: Options) {\n let count = 0;\n for (const path of paths) {\n if (typeof path === 'string' && isPathToPackageFile(path)) {\n throw MissingTargetFileError(path);\n } else if (typeof path === 'string') {\n if (++count > 1 && options['project-name']) {\n throw new UnsupportedOptionCombinationError([\n 'multiple paths',\n 'project-name',\n ]);\n }\n }\n }\n}\n","import config from './config';\nimport { config as userConfig } from './user-config';\n\nexport function getCodeClientProxyUrl() {\n const url = new URL(config.API);\n const domain = url.origin;\n return (\n config.CODE_CLIENT_PROXY_URL ||\n domain.replace(/\\/\\/(ap[pi]\\.)?/, '//deeproxy.')\n );\n}\n\nexport function getBase64Encoding(\n enabled = userConfig.get('use-base64-encoding'),\n): boolean {\n if (enabled) {\n return enabled.toLowerCase() === 'true';\n }\n return false;\n}\n","// Separator used while displaying various paths (e.g. package paths, call\n// paths) to the user\nexport const PATH_SEPARATOR = ' > ';\n\n// String used to signify hidden path elements e.g. for abbreviated paths\nexport const PATH_HIDDEN_ELEMENTS = '...';\n\n// Number of function names to show in the beginning of an abbreviated call path\nexport const CALL_PATH_LEADING_ELEMENTS = 2;\n\n// Number of function names to show in the end of an abbreviated call path\nexport const CALL_PATH_TRAILING_ELEMENTS = 2;\n","import { Ecosystem } from './types';\n\nexport function isUnmanagedEcosystem(ecosystem: Ecosystem): boolean {\n return ecosystem === 'cpp';\n}\n","import { Options } from '../types';\nimport { Ecosystem } from './types';\n\nexport { testEcosystem } from './test';\nexport { monitorEcosystem } from './monitor';\nexport { getPlugin } from './plugins';\n\n/**\n * Ecosystems are listed here if you opt in to the new plugin test flow.\n * This is a breaking change to the old plugin formats, so only a select few\n * plugins currently work with it.\n *\n * Currently container scanning is not yet ready to work with this flow,\n * hence this is in a separate function from getEcosystem().\n */\nexport function getEcosystemForTest(options: Options): Ecosystem | null {\n if (options.unmanaged) {\n return 'cpp';\n }\n if (options.code) {\n return 'code';\n }\n return null;\n}\n\nexport function getEcosystem(options: Options): Ecosystem | null {\n if (options.unmanaged) {\n return 'cpp';\n }\n\n if (options.docker) {\n return 'docker';\n }\n return null;\n}\n","import { InspectResult } from '@snyk/cli-interface/legacy/plugin';\nimport chalk from 'chalk';\nimport config from '../config';\nimport { isCI } from '../is-ci';\nimport { makeRequest } from '../request/promise';\nimport { Contributor, MonitorResult, Options, PolicyOptions } from '../types';\nimport { spinner } from '../../lib/spinner';\nimport { getPlugin } from './plugins';\nimport { BadResult, GoodResult } from '../../cli/commands/monitor/types';\nimport { formatErrorMonitorOutput, formatMonitorOutput } from '../formatters';\nimport { getExtraProjectCount } from '../plugins/get-extra-project-count';\nimport {\n AuthFailedError,\n DockerImageNotFoundError,\n MonitorError,\n} from '../errors';\nimport {\n Ecosystem,\n ScanResult,\n EcosystemMonitorResult,\n EcosystemMonitorError,\n MonitorDependenciesRequest,\n MonitorDependenciesResponse,\n} from './types';\nimport { findAndLoadPolicyForScanResult } from './policy';\nimport { getAuthHeader } from '../api-token';\nimport { resolveAndMonitorFacts } from './resolve-monitor-facts';\nimport {\n generateProjectAttributes,\n generateTags,\n validateProjectAttributes,\n validateTags,\n} from '../../cli/commands/monitor';\nimport { isUnmanagedEcosystem } from './common';\nimport { findAndLoadPolicy } from '../policy';\n\nconst SEPARATOR = '\\n-------------------------------------------------------\\n';\n\nexport async function monitorEcosystem(\n ecosystem: Ecosystem,\n paths: string[],\n options: Options & PolicyOptions,\n contributors?: Contributor[],\n): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]> {\n const plugin = getPlugin(ecosystem);\n\n validateTags(options);\n validateProjectAttributes(options);\n\n const scanResultsByPath: { [dir: string]: ScanResult[] } = {};\n for (const path of paths) {\n try {\n await spinner(`Analyzing dependencies in ${path}`);\n options.path = path;\n const pluginResponse = await plugin.scan(options);\n scanResultsByPath[path] = pluginResponse.scanResults;\n\n const policy = await findAndLoadPolicy(path, 'cpp', options);\n if (policy) {\n scanResultsByPath[path].forEach(\n (scanResult) => (scanResult.policy = policy.toString()),\n );\n }\n } catch (error) {\n if (\n ecosystem === 'docker' &&\n error.statusCode === 401 &&\n error.message === 'authentication required'\n ) {\n throw new DockerImageNotFoundError(path);\n }\n if (ecosystem === 'docker' && error.message === 'invalid image format') {\n throw new DockerImageNotFoundError(path);\n }\n\n throw error;\n } finally {\n spinner.clearAll();\n }\n }\n const [monitorResults, errors] = await selectAndExecuteMonitorStrategy(\n ecosystem,\n scanResultsByPath,\n options,\n contributors,\n );\n return [monitorResults, errors];\n}\n\nasync function selectAndExecuteMonitorStrategy(\n ecosystem: Ecosystem,\n scanResultsByPath: { [dir: string]: ScanResult[] },\n options: Options,\n contributors?: Contributor[],\n): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]> {\n return isUnmanagedEcosystem(ecosystem)\n ? await resolveAndMonitorFacts(scanResultsByPath, options, contributors)\n : await monitorDependencies(scanResultsByPath, options);\n}\n\nexport async function generateMonitorDependenciesRequest(\n scanResult: ScanResult,\n options: Options,\n): Promise<MonitorDependenciesRequest> {\n // WARNING! This mutates the payload. The project name logic should be handled in the plugin.\n scanResult.name =\n options['project-name'] || config.PROJECT_NAME || scanResult.name;\n // WARNING! This mutates the payload. Policy logic should be in the plugin.\n const policy = await findAndLoadPolicyForScanResult(scanResult, options);\n if (policy !== undefined) {\n scanResult.policy = policy.toString();\n }\n\n return {\n scanResult,\n method: 'cli',\n projectName: options['project-name'] || config.PROJECT_NAME || undefined,\n tags: generateTags(options),\n attributes: generateProjectAttributes(options),\n };\n}\n\nasync function monitorDependencies(\n scans: {\n [dir: string]: ScanResult[];\n },\n options: Options,\n): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]> {\n const results: EcosystemMonitorResult[] = [];\n const errors: EcosystemMonitorError[] = [];\n for (const [path, scanResults] of Object.entries(scans)) {\n await spinner(`Monitoring dependencies in ${path}`);\n for (const scanResult of scanResults) {\n const monitorDependenciesRequest = await generateMonitorDependenciesRequest(\n scanResult,\n options,\n );\n\n const configOrg = config.org ? decodeURIComponent(config.org) : undefined;\n\n const payload = {\n method: 'PUT',\n url: `${config.API}/monitor-dependencies`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n body: monitorDependenciesRequest,\n qs: {\n org: options.org || configOrg,\n },\n };\n try {\n const response = await makeRequest<MonitorDependenciesResponse>(\n payload,\n );\n results.push({\n ...response,\n path,\n scanResult,\n });\n } catch (error) {\n if (error.code === 401) {\n throw AuthFailedError();\n }\n if (error.code >= 400 && error.code < 500) {\n throw new MonitorError(error.code, error.message);\n }\n errors.push({\n error: 'Could not monitor dependencies in ' + path,\n path,\n scanResult,\n });\n }\n }\n spinner.clearAll();\n }\n return [results, errors];\n}\n\nexport async function getFormattedMonitorOutput(\n results: Array<GoodResult | BadResult>,\n monitorResults: EcosystemMonitorResult[],\n errors: EcosystemMonitorError[],\n options: Options,\n): Promise<string> {\n for (const monitorResult of monitorResults) {\n let monOutput = '';\n if (monitorResult.ok) {\n monOutput = formatMonitorOutput(\n monitorResult.scanResult.identity.type,\n monitorResult as MonitorResult,\n options,\n monitorResult.projectName,\n await getExtraProjectCount(\n monitorResult.path,\n options,\n // TODO: Fix to pass the old \"inspectResult.plugin.meta.allSubProjectNames\", which ecosystem uses this?\n // \"allSubProjectNames\" can become a Fact returned by a plugin.\n {} as InspectResult,\n ),\n );\n } else {\n monOutput = formatErrorMonitorOutput(\n monitorResult.scanResult.identity.type,\n monitorResult as MonitorResult,\n options,\n );\n }\n results.push({\n ok: true,\n data: monOutput,\n path: monitorResult.path,\n projectName: monitorResult.id,\n });\n }\n for (const monitorError of errors) {\n results.push({\n ok: false,\n data: new MonitorError(500, monitorError.error),\n path: monitorError.path,\n });\n }\n\n const outputString = results\n .map((res) => {\n if (res.ok) {\n return res.data;\n }\n\n const errorMessage =\n res.data && res.data.userMessage\n ? chalk.bold.red(res.data.userMessage)\n : res.data\n ? res.data.message\n : 'Unknown error occurred.';\n\n return (\n chalk.bold.white('\\nMonitoring ' + res.path + '...\\n\\n') + errorMessage\n );\n })\n .join('\\n' + SEPARATOR);\n\n if (results.every((res) => res.ok)) {\n return outputString;\n }\n\n throw new Error(outputString);\n}\n","import { Analytics } from './types';\nimport * as analytics from '../../lib/analytics';\n\nexport function extractAndApplyPluginAnalytics(\n pluginAnalytics: Analytics[],\n asyncRequestToken?: string,\n): void {\n if (asyncRequestToken) {\n analytics.add('asyncRequestToken', asyncRequestToken);\n }\n for (const { name, data } of pluginAnalytics) {\n analytics.add(name, data);\n }\n}\n","import * as cppPlugin from 'snyk-cpp-plugin';\nimport * as dockerPlugin from 'snyk-docker-plugin';\nimport { codePlugin } from '../plugins/sast';\nimport { Ecosystem, EcosystemPlugin } from './types';\n\nconst EcosystemPlugins: {\n readonly [ecosystem in Ecosystem]: EcosystemPlugin;\n} = {\n cpp: cppPlugin as EcosystemPlugin,\n // TODO: not any\n docker: dockerPlugin as any,\n code: codePlugin,\n};\n\nexport function getPlugin(ecosystem: Ecosystem): EcosystemPlugin {\n return EcosystemPlugins[ecosystem];\n}\n","import * as path from 'path';\n\nimport { SupportedPackageManagers } from '../package-managers';\nimport { findAndLoadPolicy } from '../policy';\nimport { Options, PolicyOptions } from '../types';\nimport { Issue, IssuesData, ScanResult } from './types';\nimport { Policy } from '../policy/find-and-load-policy';\n\nexport async function findAndLoadPolicyForScanResult(\n scanResult: ScanResult,\n options: Options & PolicyOptions,\n): Promise<object | undefined> {\n const targetFileRelativePath = scanResult.identity.targetFile\n ? path.join(path.resolve(`${options.path}`), scanResult.identity.targetFile)\n : undefined;\n const targetFileDir = targetFileRelativePath\n ? path.parse(targetFileRelativePath).dir\n : undefined;\n const scanType = options.docker\n ? 'docker'\n : (scanResult.identity.type as SupportedPackageManagers);\n // TODO: fix this and send only send when we used resolve-deps for node\n // it should be a ExpandedPkgTree type instead\n const packageExpanded = undefined;\n\n const policy = (await findAndLoadPolicy(\n options.path,\n scanType,\n options,\n packageExpanded,\n targetFileDir,\n )) as object | undefined; // TODO: findAndLoadPolicy() does not return a string!\n return policy;\n}\n\nexport function filterIgnoredIssues(\n issues: Issue[],\n issuesData: IssuesData,\n policy?: Policy,\n): [Issue[], IssuesData] {\n if (!policy?.ignore) {\n return [issues, issuesData];\n }\n\n const filteredIssuesData: IssuesData = { ...issuesData };\n const filteredIssues: Issue[] = issues.filter((issue) => {\n const ignoredIssue = policy.ignore[issue.issueId];\n if (!ignoredIssue) {\n return true;\n }\n\n const allResourcesRule = ignoredIssue.find((element) => '*' in element);\n if (!allResourcesRule) {\n return true;\n }\n\n const expiredIgnoreRule =\n new Date(allResourcesRule['*'].expires) < new Date();\n if (!expiredIgnoreRule) {\n delete filteredIssuesData[issue.issueId];\n return false;\n }\n\n return true;\n });\n\n return [filteredIssues, filteredIssuesData];\n}\n","import { Contributor, Options } from '../types';\nimport { spinner } from '../../lib/spinner';\nimport {\n ScanResult,\n EcosystemMonitorError,\n EcosystemMonitorResult,\n} from './types';\nimport {\n requestMonitorPollingToken,\n pollingMonitorWithTokenUntilDone,\n} from '../polling/polling-monitor';\nimport { extractAndApplyPluginAnalytics } from './plugin-analytics';\nimport { AuthFailedError, MonitorError } from '../errors';\nimport { extractResolutionMetaFromScanResult } from '../polling/common';\n\nexport async function resolveAndMonitorFacts(\n scans: {\n [dir: string]: ScanResult[];\n },\n options: Options,\n contributors?: Contributor[],\n): Promise<[EcosystemMonitorResult[], EcosystemMonitorError[]]> {\n const results: EcosystemMonitorResult[] = [];\n const errors: EcosystemMonitorError[] = [];\n\n for (const [path, scanResults] of Object.entries(scans)) {\n await spinner(`Resolving and Monitoring fileSignatures in ${path}`);\n for (const scanResult of scanResults) {\n try {\n const res = await requestMonitorPollingToken(options, true, scanResult);\n if (scanResult.analytics) {\n extractAndApplyPluginAnalytics(scanResult.analytics, res.token);\n }\n const resolutionMeta = extractResolutionMetaFromScanResult(scanResult);\n const { maxAttempts, pollInterval } = res.pollingTask;\n const attemptsCount = 0;\n const response = await pollingMonitorWithTokenUntilDone(\n res.token,\n true,\n options,\n pollInterval,\n attemptsCount,\n maxAttempts,\n resolutionMeta,\n contributors,\n );\n\n const ecosystemMonitorResult: EcosystemMonitorResult = {\n ...response,\n path,\n scanResult,\n };\n\n results.push(ecosystemMonitorResult);\n } catch (error) {\n if (error.code === 401) {\n throw AuthFailedError();\n }\n\n if (error.code >= 400 && error.code < 500) {\n throw new MonitorError(error.code, error.message);\n }\n errors.push({\n error: 'Could not monitor dependencies in ' + path,\n path,\n scanResult,\n });\n }\n }\n spinner.clearAll();\n }\n\n return [results, errors];\n}\n","import { Options, PolicyOptions } from '../types';\nimport { spinner } from '../../lib/spinner';\nimport { Ecosystem, ScanResult, TestResult } from './types';\nimport {\n requestTestPollingToken,\n pollingTestWithTokenUntilDone,\n} from '../polling/polling-test';\nimport { extractAndApplyPluginAnalytics } from './plugin-analytics';\nimport { findAndLoadPolicy } from '../policy';\nimport { filterIgnoredIssues } from './policy';\nimport { IssueData, Issue } from '../snyk-test/legacy';\n\nexport async function resolveAndTestFacts(\n ecosystem: Ecosystem,\n scans: {\n [dir: string]: ScanResult[];\n },\n options: Options & PolicyOptions,\n): Promise<[TestResult[], string[]]> {\n const results: any[] = [];\n const errors: string[] = [];\n const packageManager = 'Unmanaged (C/C++)';\n\n for (const [path, scanResults] of Object.entries(scans)) {\n await spinner(`Resolving and Testing fileSignatures in ${path}`);\n for (const scanResult of scanResults) {\n try {\n const res = await requestTestPollingToken(options, true, scanResult);\n if (scanResult.analytics) {\n extractAndApplyPluginAnalytics(scanResult.analytics, res.token);\n }\n const { maxAttempts, pollInterval } = res.pollingTask;\n const attemptsCount = 0;\n const response = await pollingTestWithTokenUntilDone(\n res.token,\n ecosystem,\n options,\n pollInterval,\n attemptsCount,\n maxAttempts,\n );\n\n const policy = await findAndLoadPolicy(path, 'cpp', options);\n const [issues, issuesData] = filterIgnoredIssues(\n response.issues,\n response.issuesData,\n policy,\n );\n\n const issuesMap: Map<string, Issue> = new Map();\n response.issues.forEach((i) => {\n issuesMap[i.issueId] = i;\n });\n\n const vulnerabilities: IssueData[] = [];\n for (const issuesDataKey in response.issuesData) {\n const issueData = response.issuesData[issuesDataKey];\n const pkgCoordinate = `${issuesMap[issuesDataKey].pkgName}@${issuesMap[issuesDataKey].pkgVersion}`;\n issueData.from = [pkgCoordinate];\n issueData.name = pkgCoordinate;\n issueData.packageManager = packageManager;\n vulnerabilities.push(issueData);\n }\n\n const dependencyCount = response?.depGraphData?.graph?.nodes?.find(\n (graphNode) => {\n return graphNode.nodeId === 'root-node';\n },\n )?.deps?.length;\n\n results.push({\n issues,\n issuesData,\n depGraphData: response?.depGraphData,\n depsFilePaths: response?.depsFilePaths,\n fileSignaturesDetails: response?.fileSignaturesDetails,\n vulnerabilities,\n path,\n dependencyCount,\n packageManager,\n });\n } catch (error) {\n const hasStatusCodeError = error.code >= 400 && error.code <= 500;\n if (hasStatusCodeError) {\n errors.push(error.message);\n continue;\n }\n const failedPath = path ? `in ${path}` : '.';\n errors.push(`Could not test dependencies ${failedPath}`);\n }\n }\n }\n spinner.clearAll();\n return [results, errors];\n}\n","import config from '../config';\nimport { isCI } from '../is-ci';\nimport { makeRequest } from '../request/promise';\nimport { Options, PolicyOptions } from '../types';\nimport { TestCommandResult } from '../../cli/commands/types';\nimport { spinner } from '../../lib/spinner';\nimport { Ecosystem, ScanResult, TestResult } from './types';\nimport { getPlugin } from './plugins';\nimport { TestDependenciesResponse } from '../snyk-test/legacy';\nimport { assembleQueryString } from '../snyk-test/common';\nimport { getAuthHeader } from '../api-token';\nimport { resolveAndTestFacts } from './resolve-test-facts';\nimport { isUnmanagedEcosystem } from './common';\n\nexport async function testEcosystem(\n ecosystem: Ecosystem,\n paths: string[],\n options: Options & PolicyOptions,\n): Promise<TestCommandResult> {\n const plugin = getPlugin(ecosystem);\n // TODO: this is an intermediate step before consolidating ecosystem plugins\n // to accept flows that act differently in the testDependencies step\n if (plugin.test) {\n const { readableResult: res, sarifResult: sarifRes } = await plugin.test(\n paths,\n options,\n );\n return TestCommandResult.createHumanReadableTestCommandResult(\n res,\n '',\n sarifRes,\n );\n }\n const scanResultsByPath: { [dir: string]: ScanResult[] } = {};\n for (const path of paths) {\n await spinner(`Scanning dependencies in ${path}`);\n options.path = path;\n const pluginResponse = await plugin.scan(options);\n scanResultsByPath[path] = pluginResponse.scanResults;\n }\n spinner.clearAll();\n\n const [testResults, errors] = await selectAndExecuteTestStrategy(\n ecosystem,\n scanResultsByPath,\n options,\n );\n\n const stringifiedData = JSON.stringify(testResults, null, 2);\n if (options.json) {\n return TestCommandResult.createJsonTestCommandResult(stringifiedData);\n }\n const emptyResults: ScanResult[] = [];\n const scanResults = emptyResults.concat(...Object.values(scanResultsByPath));\n\n const readableResult = await plugin.display(\n scanResults,\n testResults,\n errors,\n options,\n );\n\n return TestCommandResult.createHumanReadableTestCommandResult(\n readableResult,\n stringifiedData,\n );\n}\n\nexport async function selectAndExecuteTestStrategy(\n ecosystem: Ecosystem,\n scanResultsByPath: { [dir: string]: ScanResult[] },\n options: Options & PolicyOptions,\n): Promise<[TestResult[], string[]]> {\n return isUnmanagedEcosystem(ecosystem)\n ? await resolveAndTestFacts(ecosystem, scanResultsByPath, options)\n : await testDependencies(scanResultsByPath, options);\n}\n\nasync function testDependencies(\n scans: {\n [dir: string]: ScanResult[];\n },\n options: Options,\n): Promise<[TestResult[], string[]]> {\n const results: TestResult[] = [];\n const errors: string[] = [];\n for (const [path, scanResults] of Object.entries(scans)) {\n await spinner(`Testing dependencies in ${path}`);\n for (const scanResult of scanResults) {\n const payload = {\n method: 'POST',\n url: `${config.API}/test-dependencies`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n body: {\n scanResult,\n },\n qs: assembleQueryString(options),\n };\n try {\n const response = await makeRequest<TestDependenciesResponse>(payload);\n results.push({\n issues: response.result.issues,\n issuesData: response.result.issuesData,\n depGraphData: response.result.depGraphData,\n });\n } catch (error) {\n if (error.code >= 400 && error.code < 500) {\n throw new Error(error.message);\n }\n errors.push('Could not test dependencies in ' + path);\n }\n }\n }\n spinner.clearAll();\n return [results, errors];\n}\n","export function abridgeErrorMessage(\n msg: string,\n maxLen: number,\n ellipsis = ' ... ',\n): string {\n if (msg.length <= maxLen) {\n return msg;\n }\n const toKeep = Math.floor((maxLen - ellipsis.length) / 2);\n return (\n msg.slice(0, toKeep) + ellipsis + msg.slice(msg.length - toKeep, msg.length)\n );\n}\n","import { CustomError } from './custom-error';\n\nexport class InvalidRemoteUrlError extends CustomError {\n private static ERROR_MESSAGE =\n 'Invalid argument provided for --remote-repo-url. Value must be a string.';\n\n constructor() {\n super(InvalidRemoteUrlError.ERROR_MESSAGE);\n }\n}\n","import { makeRequest } from '../request';\nimport { getAuthHeader } from '../api-token';\nimport config from '../config';\nimport { assembleQueryString } from '../snyk-test/common';\nimport { OrgFeatureFlagResponse } from './types';\nimport { Options } from '../types';\nimport { AuthFailedError } from '../errors';\n\nexport async function isFeatureFlagSupportedForOrg(\n featureFlag: string,\n org,\n): Promise<OrgFeatureFlagResponse> {\n const response = await makeRequest({\n method: 'GET',\n headers: {\n Authorization: getAuthHeader(),\n },\n qs: assembleQueryString({ org }),\n url: `${config.API}/cli-config/feature-flags/${featureFlag}`,\n gzip: true,\n json: true,\n });\n\n return (response as any).body;\n}\n\nexport async function hasFeatureFlag(\n featureFlag: string,\n options: Options,\n): Promise<boolean | undefined> {\n const { code, error, ok } = await isFeatureFlagSupportedForOrg(\n featureFlag,\n options.org,\n );\n\n if (code === 401 || code === 403) {\n throw AuthFailedError(error, code);\n }\n return ok;\n}\n","import * as fs from 'fs';\nimport * as pathLib from 'path';\nconst sortBy = require('lodash.sortby');\nconst groupBy = require('lodash.groupby');\nimport { detectPackageManagerFromFile } from './detect';\nimport * as debugModule from 'debug';\nconst debug = debugModule('snyk:find-files');\n\n// TODO: use util.promisify once we move to node 8\n\n/**\n * Returns files inside given file path.\n *\n * @param path file path.\n */\nexport async function readDirectory(path: string): Promise<string[]> {\n return await new Promise((resolve, reject) => {\n fs.readdir(path, (err, files) => {\n if (err) {\n reject(err);\n }\n resolve(files);\n });\n });\n}\n\n/**\n * Returns file stats object for given file path.\n *\n * @param path path to file or directory.\n */\nexport async function getStats(path: string): Promise<fs.Stats> {\n return await new Promise((resolve, reject) => {\n fs.stat(path, (err, stats) => {\n if (err) {\n reject(err);\n }\n resolve(stats);\n });\n });\n}\n\ninterface FindFilesRes {\n files: string[];\n allFilesFound: string[];\n}\n\n/**\n * Find all files in given search path. Returns paths to files found.\n *\n * @param path file path to search.\n * @param ignore (optional) files to ignore. Will always ignore node_modules.\n * @param filter (optional) file names to find. If not provided all files are returned.\n * @param levelsDeep (optional) how many levels deep to search, defaults to two, this path and one sub directory.\n */\nexport async function find(\n path: string,\n ignore: string[] = [],\n filter: string[] = [],\n levelsDeep = 4,\n): Promise<FindFilesRes> {\n const found: string[] = [];\n const foundAll: string[] = [];\n\n // ensure we ignore find against node_modules path.\n if (path.endsWith('node_modules')) {\n return { files: found, allFilesFound: foundAll };\n }\n // ensure node_modules is always ignored\n if (!ignore.includes('node_modules')) {\n ignore.push('node_modules');\n }\n try {\n if (levelsDeep < 0) {\n return { files: found, allFilesFound: foundAll };\n } else {\n levelsDeep--;\n }\n const fileStats = await getStats(path);\n if (fileStats.isDirectory()) {\n const { files, allFilesFound } = await findInDirectory(\n path,\n ignore,\n filter,\n levelsDeep,\n );\n found.push(...files);\n foundAll.push(...allFilesFound);\n } else if (fileStats.isFile()) {\n const fileFound = findFile(path, filter);\n if (fileFound) {\n found.push(fileFound);\n foundAll.push(fileFound);\n }\n }\n const filteredOutFiles = foundAll.filter((f) => !found.includes(f));\n if (filteredOutFiles.length) {\n debug(\n `Filtered out ${filteredOutFiles.length}/${\n foundAll.length\n } files: ${filteredOutFiles.join(', ')}`,\n );\n }\n return { files: filterForDefaultManifests(found), allFilesFound: foundAll };\n } catch (err) {\n throw new Error(`Error finding files in path '${path}'.\\n${err.message}`);\n }\n}\n\nfunction findFile(path: string, filter: string[] = []): string | null {\n if (filter.length > 0) {\n const filename = pathLib.basename(path);\n if (filter.includes(filename)) {\n return path;\n }\n } else {\n return path;\n }\n return null;\n}\n\nasync function findInDirectory(\n path: string,\n ignore: string[] = [],\n filter: string[] = [],\n levelsDeep = 4,\n): Promise<FindFilesRes> {\n const files = await readDirectory(path);\n const toFind = files\n .filter((file) => !ignore.includes(file))\n .map((file) => {\n const resolvedPath = pathLib.resolve(path, file);\n if (!fs.existsSync(resolvedPath)) {\n debug('File does not seem to exist, skipping: ', file);\n return { files: [], allFilesFound: [] };\n }\n return find(resolvedPath, ignore, filter, levelsDeep);\n });\n\n const found = await Promise.all(toFind);\n return {\n files: Array.prototype.concat.apply(\n [],\n found.map((f) => f.files),\n ),\n allFilesFound: Array.prototype.concat.apply(\n [],\n found.map((f) => f.allFilesFound),\n ),\n };\n}\n\nfunction filterForDefaultManifests(files: string[]): string[] {\n // take all the files in the same dir & filter out\n // based on package Manager\n if (files.length <= 1) {\n return files;\n }\n\n const filteredFiles: string[] = [];\n\n const beforeSort = files\n .filter(Boolean)\n .filter((p) => fs.existsSync(p))\n .map((p) => ({\n path: p,\n ...pathLib.parse(p),\n packageManager: detectProjectTypeFromFile(p),\n }));\n const sorted = sortBy(beforeSort, 'dir');\n const foundFiles = groupBy(sorted, 'dir');\n\n for (const directory of Object.keys(foundFiles)) {\n const filesInDirectory = foundFiles[directory];\n const beforeGroup = filesInDirectory.filter((p) => !!p.packageManager);\n\n const groupedFiles = groupBy(beforeGroup, 'packageManager');\n\n for (const packageManager of Object.keys(groupedFiles)) {\n const filesPerPackageManager = groupedFiles[packageManager];\n\n if (filesPerPackageManager.length <= 1) {\n const shouldSkip = shouldSkipAddingFile(\n packageManager,\n filesPerPackageManager[0].path,\n filteredFiles,\n );\n if (shouldSkip) {\n continue;\n }\n filteredFiles.push(filesPerPackageManager[0].path);\n continue;\n }\n const defaultManifestFileName = chooseBestManifest(\n filesPerPackageManager,\n packageManager,\n );\n if (defaultManifestFileName) {\n const shouldSkip = shouldSkipAddingFile(\n packageManager,\n filesPerPackageManager[0].path,\n filteredFiles,\n );\n if (shouldSkip) {\n continue;\n }\n filteredFiles.push(defaultManifestFileName);\n }\n }\n }\n return filteredFiles;\n}\n\nfunction detectProjectTypeFromFile(file: string): string | null {\n try {\n const packageManager = detectPackageManagerFromFile(file);\n if (['yarn', 'npm'].includes(packageManager)) {\n return 'node';\n }\n return packageManager;\n } catch (error) {\n return null;\n }\n}\n\nfunction shouldSkipAddingFile(\n packageManager: string,\n filePath: string,\n filteredFiles: string[],\n): boolean {\n if (['gradle'].includes(packageManager) && filePath) {\n const rootGradleFile = filteredFiles\n .filter(\n (targetFile) =>\n targetFile.endsWith('build.gradle') ||\n targetFile.endsWith('build.gradle.kts'),\n )\n .filter((targetFile) => {\n const parsedPath = pathLib.parse(targetFile);\n const relativePath = pathLib.relative(parsedPath.dir, filePath);\n return !relativePath.startsWith(`..${pathLib.sep}`);\n });\n return !!rootGradleFile.length;\n }\n return false;\n}\n\nfunction chooseBestManifest(\n files: Array<{ base: string; path: string }>,\n projectType: string,\n): string | null {\n switch (projectType) {\n case 'node': {\n const lockFile = files.filter((path) =>\n ['package-lock.json', 'yarn.lock'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple node lockfiles files, defaulting to ${lockFile.path}`,\n );\n if (lockFile) {\n return lockFile.path;\n }\n const packageJson = files.filter((path) =>\n ['package.json'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple npm manifest files, defaulting to ${packageJson.path}`,\n );\n return packageJson.path;\n }\n case 'rubygems': {\n const defaultManifest = files.filter((path) =>\n ['Gemfile.lock'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple gem manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n case 'cocoapods': {\n const defaultManifest = files.filter((path) =>\n ['Podfile'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple cocoapods manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n case 'pip': {\n const defaultManifest = files.filter((path) =>\n ['Pipfile'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple pip manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n case 'gradle': {\n const defaultManifest = files.filter((path) =>\n ['build.gradle'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple gradle manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n case 'poetry': {\n const defaultManifest = files.filter((path) =>\n ['pyproject.toml'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple poetry manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n case 'hex': {\n const defaultManifest = files.filter((path) =>\n ['mix.exs'].includes(path.base),\n )[0];\n debug(\n `Encountered multiple hex manifest files, defaulting to ${defaultManifest.path}`,\n );\n return defaultManifest.path;\n }\n default: {\n return null;\n }\n }\n}\n","import chalk from 'chalk';\nimport {\n TestResult,\n BaseImageRemediationAdvice,\n} from '../../../lib/snyk-test/legacy';\n\nexport function dockerRemediationForDisplay(res: TestResult) {\n if (!res.docker || !res.docker.baseImageRemediation) {\n return '';\n }\n const { advice, message } = res.docker.baseImageRemediation;\n const out = [] as any[];\n\n if (advice) {\n for (const item of advice) {\n out.push(getTerminalStringFormatter(item)(item.message));\n }\n } else if (message) {\n out.push(message);\n } else {\n return '';\n }\n return `\\n\\n${out.join('\\n')}`;\n}\n\nfunction getTerminalStringFormatter({\n color,\n bold,\n}: BaseImageRemediationAdvice) {\n let formatter = chalk;\n if (color && formatter[color]) {\n formatter = formatter[color];\n }\n if (bold) {\n formatter = formatter.bold;\n }\n return formatter;\n}\n","const values = require('lodash.values');\nimport chalk from 'chalk';\n\nexport function createDockerBinaryHeading(pkgInfo): string {\n const binaryName = pkgInfo.pkg.name;\n const binaryVersion = pkgInfo.pkg.version;\n const numOfVulns = values(pkgInfo.issues).length;\n const vulnCountText = numOfVulns > 1 ? 'vulnerabilities' : 'vulnerability';\n return numOfVulns\n ? chalk.bold.white(\n `------------ Detected ${numOfVulns} ${vulnCountText}` +\n ` for ${binaryName}@${binaryVersion} ------------`,\n '\\n',\n )\n : '';\n}\n","const values = require('lodash.values');\nimport { createDockerBinaryHeading } from './format-docker-binary-heading';\nimport { Options, TestOptions } from '../../../lib/types';\nimport { formatIssues } from '../legacy-format-issue';\n\nexport function formatDockerBinariesIssues(\n dockerBinariesSortedGroupedVulns,\n binariesVulns,\n options: Options & TestOptions,\n): string[] {\n const binariesIssuesOutput = [] as string[];\n for (const pkgInfo of values(binariesVulns.affectedPkgs)) {\n binariesIssuesOutput.push(createDockerBinaryHeading(pkgInfo));\n const binaryIssues = dockerBinariesSortedGroupedVulns.filter(\n (vuln) => vuln.metadata.name === pkgInfo.pkg.name,\n );\n const formattedBinaryIssues = binaryIssues.map((vuln) =>\n formatIssues(vuln, options),\n );\n binariesIssuesOutput.push(formattedBinaryIssues.join('\\n\\n'));\n }\n return binariesIssuesOutput;\n}\n","export { dockerRemediationForDisplay } from './format-docker-advice';\nexport { formatDockerBinariesIssues } from './format-docker-binary-issues';\nexport { createDockerBinaryHeading } from './format-docker-binary-heading';\n","import { errorMessageWithRetry } from '../errors';\n\nexport function summariseErrorResults(errorResultsLength: number): string {\n const projects = errorResultsLength > 1 ? 'projects' : 'project';\n if (errorResultsLength > 0) {\n return errorMessageWithRetry(\n ` Failed to test ${errorResultsLength} ${projects}.`,\n );\n }\n\n return '';\n}\n","const assign = require('lodash.assign');\nimport chalk from 'chalk';\nimport * as url from 'url';\n\nimport { MonitorResult } from '../types';\nimport config from '../config';\nimport { showMultiScanTip } from './show-multi-scan-tip';\n\nexport function formatErrorMonitorOutput(\n packageManager,\n res: MonitorResult,\n options,\n projectName?: string,\n): string {\n const humanReadableName = projectName\n ? `${res.path} (${projectName})`\n : res.path;\n const strOutput =\n chalk.bold.white('\\nMonitoring ' + humanReadableName + '...\\n\\n') +\n '\\n\\n' +\n (packageManager === 'maven'\n ? chalk.yellow('Detected 0 dependencies (no project created)')\n : '');\n return options.json\n ? JSON.stringify(\n assign({}, res, {\n packageManager,\n }),\n )\n : strOutput;\n}\n\nexport function formatMonitorOutput(\n packageManager,\n res: MonitorResult,\n options,\n projectName?: string,\n foundProjectCount?: number,\n): string {\n const manageUrl = buildManageUrl(res.id, res.org);\n const multiScanTip = showMultiScanTip(\n packageManager,\n options,\n foundProjectCount,\n );\n const issues = res.licensesPolicy ? 'issues' : 'vulnerabilities';\n const humanReadableName = projectName\n ? `${res.path} (${projectName})`\n : res.path;\n const strOutput =\n chalk.bold.white('\\nMonitoring ' + humanReadableName + '...\\n\\n') +\n 'Explore this snapshot at ' +\n res.uri +\n '\\n\\n' +\n (multiScanTip ? `${multiScanTip}\\n\\n` : '') +\n (res.isMonitored\n ? 'Notifications about newly disclosed ' +\n issues +\n ' related ' +\n 'to these dependencies will be emailed to you.\\n'\n : chalk.bold.red(\n 'Project is inactive, so notifications are turned ' +\n 'off.\\nActivate this project here: ' +\n manageUrl +\n '\\n\\n',\n )) +\n (res.trialStarted\n ? chalk.yellow(\n \"You're over the free plan usage limit, \\n\" +\n 'and are now on a free 14-day premium trial.\\n' +\n 'View plans here: ' +\n manageUrl +\n '\\n\\n',\n )\n : '');\n\n return options.json\n ? JSON.stringify(\n assign({}, res, {\n manageUrl,\n packageManager,\n }),\n )\n : strOutput;\n}\n\nfunction buildManageUrl(resId: string, org?: string): string {\n const endpoint = url.parse(config.API);\n let leader = '';\n if (org) {\n leader = '/org/' + org;\n }\n endpoint.pathname = leader + '/manage';\n const manageUrl = url.format(endpoint);\n\n // TODO: what was this meant to do?\n endpoint.pathname = leader + '/monitor/' + resId;\n return manageUrl;\n}\n","import * as wrap from 'wrap-ansi';\nimport chalk from 'chalk';\n\nimport {\n AnnotatedIssue,\n CallPath,\n REACHABILITY,\n} from '../../lib/snyk-test/legacy';\nimport { SampleReachablePaths } from './types';\nimport {\n CALL_PATH_LEADING_ELEMENTS,\n PATH_SEPARATOR,\n CALL_PATH_TRAILING_ELEMENTS,\n PATH_HIDDEN_ELEMENTS,\n} from '../constants';\n\nconst reachabilityLevels: {\n [key in REACHABILITY]: { color: Function; text: string; json: string };\n} = {\n [REACHABILITY.FUNCTION]: {\n color: chalk.redBright,\n text: 'Reachable',\n json: 'reachable',\n },\n [REACHABILITY.PACKAGE]: {\n color: chalk.yellow,\n text: 'Potentially reachable',\n json: 'potentially-reachable',\n },\n [REACHABILITY.NOT_REACHABLE]: {\n color: chalk.blueBright,\n text: 'Not reachable',\n json: 'not-reachable',\n },\n [REACHABILITY.NO_INFO]: {\n color: (str) => str,\n text: '',\n json: 'no-path-found',\n },\n};\n\nexport function formatReachability(reachability?: REACHABILITY): string {\n if (!reachability) {\n return '';\n }\n const reachableInfo = reachabilityLevels[reachability];\n const textFunc = reachableInfo ? reachableInfo.color : (str) => str;\n const text =\n reachableInfo && reachableInfo.text ? `[${reachableInfo.text}]` : '';\n\n return wrap(textFunc(text), 100);\n}\n\nexport function getReachabilityText(reachability?: REACHABILITY): string {\n if (!reachability) {\n return '';\n }\n const reachableInfo = reachabilityLevels[reachability];\n return reachableInfo ? reachableInfo.text : '';\n}\n\nexport function getReachabilityJson(reachability?: REACHABILITY): string {\n if (!reachability) {\n return '';\n }\n const reachableInfo = reachabilityLevels[reachability];\n return reachableInfo ? reachableInfo.json : '';\n}\n\nexport function summariseReachableVulns(\n vulnerabilities: AnnotatedIssue[],\n): string {\n const reachableVulnsCount = vulnerabilities.filter(\n (v) => v.reachability === REACHABILITY.FUNCTION,\n ).length;\n\n if (reachableVulnsCount > 0) {\n const vulnText =\n reachableVulnsCount === 1 ? 'vulnerability' : 'vulnerabilities';\n return `In addition, found ${reachableVulnsCount} ${vulnText} with a reachable path.`;\n }\n\n return '';\n}\n\nfunction getDistinctReachablePaths(\n reachablePaths: CallPath[],\n maxPathCount: number,\n): string[] {\n const uniquePaths = new Set<string>();\n for (const path of reachablePaths) {\n if (uniquePaths.size >= maxPathCount) {\n break;\n }\n uniquePaths.add(formatReachablePath(path));\n }\n return Array.from(uniquePaths.values());\n}\n\nexport function formatReachablePaths(\n sampleReachablePaths: SampleReachablePaths | undefined,\n maxPathCount: number,\n template: (samplePaths: string[], extraPathsCount: number) => string,\n): string {\n const paths = sampleReachablePaths?.paths || [];\n const pathCount = sampleReachablePaths?.pathCount || 0;\n const distinctPaths = getDistinctReachablePaths(paths, maxPathCount);\n const extraPaths = pathCount - distinctPaths.length;\n\n return template(distinctPaths, extraPaths);\n}\n\nexport function formatReachablePath(path: CallPath): string {\n const head = path.slice(0, CALL_PATH_LEADING_ELEMENTS).join(PATH_SEPARATOR);\n const tail = path\n .slice(path.length - CALL_PATH_TRAILING_ELEMENTS, path.length)\n .join(PATH_SEPARATOR);\n return `${head}${PATH_SEPARATOR}${PATH_HIDDEN_ELEMENTS}${PATH_SEPARATOR}${tail}`;\n}\n","import chalk from 'chalk';\nimport { rightPadWithSpaces } from '../../lib/right-pad';\nimport { TestOptions, Options } from '../../lib/types';\nimport { TestResult } from '../../lib/snyk-test/legacy';\nimport { IacTestResponse } from '../../lib/snyk-test/iac-test-result';\nimport { capitalizePackageManager } from './iac-output';\n\nexport function formatTestMeta(\n res: TestResult | IacTestResponse,\n options: Options & TestOptions,\n): string {\n const padToLength = 19; // chars to align\n const packageManager = res.packageManager || options.packageManager;\n const targetFile = res.targetFile || res.displayTargetFile || options.file;\n const openSource = res.isPrivate ? 'no' : 'yes';\n const meta = res.org\n ? [chalk.bold(rightPadWithSpaces('Organization: ', padToLength)) + res.org]\n : [];\n if (options.iac) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Type: ', padToLength)) +\n capitalizePackageManager(packageManager),\n );\n } else {\n meta.push(\n chalk.bold(rightPadWithSpaces('Package manager: ', padToLength)) +\n packageManager,\n );\n }\n if (targetFile) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Target file: ', padToLength)) + targetFile,\n );\n }\n if (res.projectName) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Project name: ', padToLength)) +\n res.projectName,\n );\n }\n if (options.docker) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Docker image: ', padToLength)) +\n options.path,\n );\n\n if (res.platform) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Platform: ', padToLength)) +\n res.platform,\n );\n }\n } else {\n meta.push(\n chalk.bold(rightPadWithSpaces('Open source: ', padToLength)) + openSource,\n );\n meta.push(\n chalk.bold(rightPadWithSpaces('Project path: ', padToLength)) +\n options.path,\n );\n }\n if (res.payloadType !== 'k8sconfig') {\n const legacyRes: TestResult = res as TestResult;\n if (legacyRes.docker && legacyRes.docker.baseImage) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Base image: ', padToLength)) +\n legacyRes.docker.baseImage,\n );\n }\n\n if (legacyRes.filesystemPolicy) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Local Snyk policy: ', padToLength)) +\n chalk.green('found'),\n );\n if (\n legacyRes.ignoreSettings &&\n legacyRes.ignoreSettings.disregardFilesystemIgnores\n ) {\n meta.push(\n chalk.bold(\n rightPadWithSpaces('Local Snyk policy ignored: ', padToLength),\n ) + chalk.red('yes'),\n );\n }\n }\n if (legacyRes.licensesPolicy) {\n meta.push(\n chalk.bold(rightPadWithSpaces('Licenses: ', padToLength)) +\n chalk.green('enabled'),\n );\n }\n }\n\n return meta.join('\\n');\n}\n","import { Options, TestOptions } from '../../lib/types';\n\nexport function summariseVulnerableResults(\n vulnerableResults,\n options: Options & TestOptions,\n): string {\n const vulnsLength = vulnerableResults.length;\n if (vulnsLength) {\n if (options.showVulnPaths) {\n return `, ${vulnsLength} contained ${\n options.iac ? 'issues' : 'vulnerable paths'\n }.`;\n }\n return `, ${vulnsLength} had issues.`;\n }\n\n if (options.showVulnPaths) {\n return ', no vulnerable paths were found.';\n }\n\n return ', no issues were found.';\n}\n","import { SEVERITIES, SEVERITY } from '../snyk-test/common';\n\nexport function getSeverityValue(severity: SEVERITY | 'none'): number {\n return SEVERITIES.find((s) => s.verboseName === severity)!.value;\n}\n","export {\n capitalizePackageManager,\n createSarifOutputForIac,\n shareResultsOutput,\n getIacDisplayedOutput,\n getIacDisplayErrorFileOutput,\n} from './v1';\n\nexport {\n formatIacTestSummary,\n getIacDisplayedIssues,\n formatIacTestFailures,\n formatFailuresList,\n iacTestTitle,\n spinnerMessage,\n spinnerSuccessMessage,\n customRulesMessage,\n customRulesReportMessage,\n shouldLogUserMessages,\n formatShareResultsOutput,\n failuresTipOutput,\n IaCTestFailure,\n formatSnykIacTestTestData,\n formatTestData,\n} from './v2';\n","import chalk from 'chalk';\nimport { icon } from '../../../theme';\nimport * as Debug from 'debug';\nimport * as pathLib from 'path';\nimport { pathToFileURL } from 'url';\nimport * as upperFirst from 'lodash.upperfirst';\nimport * as camelCase from 'lodash.camelcase';\n\nimport {\n IacTestResponse,\n AnnotatedIacIssue,\n} from '../../../../lib/snyk-test/iac-test-result';\nimport { printPath } from '../../remediation-based-format-issues';\nimport { titleCaseText } from '../../legacy-format-issue';\nimport * as sarif from 'sarif';\nimport { colorTextBySeverity } from '../../../../lib/snyk-test/common';\nimport { IacFileInDirectory, IacOutputMeta } from '../../../../lib/types';\nimport { isLocalFolder } from '../../../../lib/detect';\nimport { getSeverityValue } from '../../get-severity-value';\nimport { getIssueLevel } from '../../sarif-output';\nimport { getVersion } from '../../../version';\nimport config from '../../../config';\nimport { getRepositoryRoot } from '../../../iac/git';\nconst debug = Debug('iac-output');\n\nfunction formatIacIssue(\n issue: AnnotatedIacIssue,\n isNew: boolean,\n path: string[],\n): string {\n const newBadge = isNew ? ' (new)' : '';\n const name = issue.subType ? ` in ${chalk.bold(issue.subType)}` : '';\n\n let introducedBy = '';\n if (path) {\n // In this mode, we show only one path by default, for compactness\n const pathStr = printPath(path, 0);\n introducedBy = `\\n introduced by ${pathStr}`;\n }\n\n return (\n colorTextBySeverity(\n issue.severity,\n ` ${icon.ISSUE} ${chalk.bold(issue.title)}${newBadge} [${titleCaseText(\n issue.severity,\n )} Severity]`,\n ) +\n ` [${issue.id}]` +\n name +\n introducedBy +\n '\\n'\n );\n}\n\nexport function getIacDisplayedOutput(\n iacTest: IacTestResponse,\n testedInfoText: string,\n meta: string,\n prefix: string,\n): string {\n const issuesTextArray = [\n chalk.bold.white('\\nInfrastructure as code issues:'),\n ];\n\n const NotNew = false;\n\n const issues: AnnotatedIacIssue[] = iacTest.result.cloudConfigResults;\n debug(`iac display output - ${issues.length} issues`);\n\n issues\n .sort((a, b) => getSeverityValue(b.severity) - getSeverityValue(a.severity))\n .forEach((issue) => {\n issuesTextArray.push(\n formatIacIssue(issue, NotNew, issue.cloudConfigPath),\n );\n });\n\n const issuesInfoOutput: string[] = [];\n debug(`Iac display output - ${issuesTextArray.length} issues text`);\n if (issuesTextArray.length > 0) {\n issuesInfoOutput.push(issuesTextArray.join('\\n'));\n }\n\n let body = issuesInfoOutput.join('\\n\\n') + '\\n\\n' + meta;\n\n const vulnCountText = `found ${issues.length} issues`;\n const summary = testedInfoText + ', ' + chalk.red.bold(vulnCountText);\n\n body = body + '\\n\\n' + summary;\n\n return prefix + body;\n}\n\nexport function getIacDisplayErrorFileOutput(\n iacFileResult: IacFileInDirectory,\n): string {\n const fileName = pathLib.basename(iacFileResult.filePath);\n return `\n\n-------------------------------------------------------\n\nTesting ${fileName}...\n\n${iacFileResult.failureReason}`;\n}\n\nexport function capitalizePackageManager(type: string | undefined) {\n switch (type) {\n case 'k8sconfig': {\n return 'Kubernetes';\n }\n case 'helmconfig': {\n return 'Helm';\n }\n case 'terraformconfig': {\n return 'Terraform';\n }\n case 'cloudformationconfig': {\n return 'CloudFormation';\n }\n case 'armconfig': {\n return 'ARM';\n }\n default: {\n return 'Infrastructure as Code';\n }\n }\n}\n\ntype ResponseIssues = { issue: AnnotatedIacIssue; targetPath: string }[];\n\n// Used to reference the base path in results.\nconst PROJECT_ROOT_KEY = 'PROJECTROOT';\n\nexport function createSarifOutputForIac(\n iacTestResponses: IacTestResponse[],\n): sarif.Log {\n // If the CLI scans a singular file, then the base path is the current working directory\n // Otherwise it's the computed path\n const basePath = isLocalFolder(iacTestResponses[0].path)\n ? pathLib.resolve('.', iacTestResponses[0].path)\n : pathLib.resolve('.');\n let repoRoot: string;\n try {\n repoRoot = getRepositoryRoot() + '/';\n } catch {\n repoRoot = pathLib.join(basePath, '/'); // the slash at the end is required, otherwise the artifactLocation.uri starts with a slash\n }\n const issues = iacTestResponses.reduce((collect: ResponseIssues, res) => {\n if (res.result) {\n // targetFile is the computed relative path of the scanned file\n // so needs to be cleaned up before assigning to the URI\n const targetPath = getPathRelativeToRepoRoot(\n repoRoot,\n basePath,\n res.targetFile,\n );\n const mapped = res.result.cloudConfigResults.map((issue) => ({\n issue,\n targetPath,\n }));\n collect.push(...mapped);\n }\n return collect;\n }, []);\n\n const tool: sarif.Tool = {\n driver: {\n name: 'Snyk IaC',\n fullName: 'Snyk Infrastructure as Code',\n version: getVersion(),\n informationUri:\n 'https://docs.snyk.io/products/snyk-infrastructure-as-code',\n rules: extractReportingDescriptor(issues),\n },\n };\n return {\n $schema:\n 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json',\n version: '2.1.0',\n runs: [\n {\n // https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317498\n originalUriBaseIds: {\n [PROJECT_ROOT_KEY]: {\n uri: pathToFileURL(repoRoot).href,\n description: {\n text: 'The root directory for all project files.',\n },\n },\n },\n\n tool,\n automationDetails: {\n id: 'snyk-iac',\n },\n results: mapIacTestResponseToSarifResults(issues),\n },\n ],\n };\n}\n\nexport function extractReportingDescriptor(\n results: ResponseIssues,\n): sarif.ReportingDescriptor[] {\n const tool: Record<string, sarif.ReportingDescriptor> = {};\n\n results.forEach(({ issue }) => {\n if (tool[issue.id]) {\n return;\n }\n // custom rules may not have some of these fields so we check them first\n const fullDescriptionText = issue.subType\n ? `${upperFirst(issue.severity)} severity - ${issue.subType}`\n : `${upperFirst(issue.severity)} severity`;\n const issueText = issue.iacDescription.issue\n ? `The issue is... \\n${issue.iacDescription.issue}\\n\\n`\n : '';\n const issueMarkdown = issue.iacDescription.issue\n ? `**The issue is...** \\n${issue.iacDescription.issue}\\n\\n`\n : '';\n const impactText = issue.iacDescription.impact\n ? ` The impact of this is... \\n ${issue.iacDescription.impact}\\n\\n`\n : '';\n const impactMarkdown = issue.iacDescription.impact\n ? ` **The impact of this is...** \\n ${issue.iacDescription.impact}\\n\\n`\n : '';\n const resolveText = issue.iacDescription.resolve\n ? ` You can resolve this by... \\n${issue.iacDescription.resolve}`\n : '';\n const resolveMarkdown = issue.iacDescription.resolve\n ? ` **You can resolve this by...** \\n${issue.iacDescription.resolve}`\n : '';\n const tags = ['security'];\n if (issue.subType) {\n tags.push(issue.subType);\n }\n tool[issue.id] = {\n id: issue.id,\n name: upperFirst(camelCase(issue.title)).replace(/ /g, ''),\n shortDescription: {\n text: `${upperFirst(issue.severity)} severity - ${issue.title}`,\n },\n fullDescription: {\n text: fullDescriptionText,\n },\n help: {\n text: `${issueText}${impactText}${resolveText}`.replace(/^\\s+/g, ''),\n markdown: `${issueMarkdown}${impactMarkdown}${resolveMarkdown}`.replace(\n /^\\s+/g,\n '',\n ),\n },\n defaultConfiguration: {\n level: getIssueLevel(issue.severity),\n },\n properties: {\n tags,\n problem: {\n severity: issue.severity,\n },\n },\n helpUri: issue.documentation,\n };\n });\n\n return Object.values(tool);\n}\n\nexport function mapIacTestResponseToSarifResults(\n issues: ResponseIssues,\n): sarif.Result[] {\n return issues.map(({ targetPath, issue }) => {\n const hasLineNumber = issue.lineNumber && issue.lineNumber >= 0;\n // custom rules may not have some of these fields so we check them first\n const affectingText = issue.subType\n ? ` affecting the ${issue.subType}`\n : '';\n return {\n ruleId: issue.id,\n message: {\n text: `This line contains a potential ${issue.severity} severity misconfiguration${affectingText}`,\n },\n locations: [\n {\n physicalLocation: {\n artifactLocation: {\n uri: targetPath,\n uriBaseId: PROJECT_ROOT_KEY,\n },\n // We exclude the `region` key when the line number is missing or -1.\n // https://docs.oasis-open.org/sarif/sarif/v2.0/csprd02/sarif-v2.0-csprd02.html#_Toc10127873\n ...(hasLineNumber && {\n region: {\n startLine: issue.lineNumber,\n },\n }),\n },\n },\n ],\n };\n });\n}\n\nfunction getPathRelativeToRepoRoot(\n repoRoot: string,\n basePath: string,\n filePath: string,\n) {\n const fullPath = pathLib.resolve(basePath, filePath).replace(/\\\\/g, '/');\n return fullPath.replace(repoRoot, '');\n}\n\nexport function shareResultsOutput(iacOutputMeta: IacOutputMeta): string {\n let projectName: string = iacOutputMeta.projectName;\n if (iacOutputMeta?.gitRemoteUrl) {\n // from \"http://github.com/snyk/cli.git\" to \"snyk/cli\"\n projectName = iacOutputMeta.gitRemoteUrl.replace(\n /^https?:\\/\\/github.com\\/(.*)\\.git$/,\n '$1',\n );\n }\n return `Your test results are available at: ${config.ROOT}/org/${iacOutputMeta.orgName}/projects under the name ${projectName}`;\n}\n","export { formatIacTestFailures, formatFailuresList } from './list';\nexport { failuresTipOutput } from './tip';\n","import { EOL } from 'os';\n\nimport { IacFileInDirectory } from '../../../../types';\nimport { colors, contentPadding } from '../utils';\nimport { IaCTestFailure } from '../types';\n\nexport function formatIacTestFailures(testFailures: IaCTestFailure[]): string {\n const sectionComponents: string[] = [];\n\n const titleOutput = colors.title(`Test Failures`);\n sectionComponents.push(titleOutput);\n\n const testFailuresListOutput = formatFailuresList(testFailures);\n sectionComponents.push(testFailuresListOutput);\n\n return sectionComponents.join(EOL.repeat(2));\n}\n\ninterface TestFailuresByFailureReason {\n [reason: string]: IacFileInDirectory[];\n}\n\nfunction groupTestFailuresByFailureReason(\n testFailures: IaCTestFailure[],\n): TestFailuresByFailureReason {\n return testFailures.reduce((groupedFailures, failure) => {\n const reason = failure.failureReason;\n if (reason) {\n if (!groupedFailures[reason]) {\n groupedFailures[reason] = [];\n }\n\n groupedFailures[reason].push(failure);\n }\n\n return groupedFailures;\n }, {});\n}\n\nexport function formatFailuresList(testFailures: IaCTestFailure[]): string {\n const testFailuresByReason = groupTestFailuresByFailureReason(testFailures);\n return Object.entries(testFailuresByReason)\n .map(([failureReason, testFailures]) =>\n formatFailure(failureReason, testFailures),\n )\n .join(EOL.repeat(2));\n}\n\nfunction formatFailure(\n failureReason: string,\n testFailures: IacFileInDirectory[],\n): string {\n const pathPrefix = contentPadding + 'Path: ';\n const pathLeftPadding = ' '.repeat(pathPrefix.length);\n\n return (\n contentPadding +\n colors.failure.bold(failureReason) +\n EOL +\n pathPrefix +\n testFailures\n .map((testFailure) => testFailure.filePath)\n .join(EOL + pathLeftPadding)\n );\n}\n","import { EOL } from 'os';\nimport { contactSupportMessage, reTryMessage } from '../../../../common';\nimport { colors } from '../utils';\n\nexport const failuresTipOutput = colors.info.bold(\n reTryMessage + EOL + contactSupportMessage,\n);\n","import { FormattedResult } from '../../../../cli/commands/test/iac/local-execution/types';\nimport { Results, Vulnerability } from '../../../iac/test/v2/scan/results';\nimport { AnnotatedIacIssue } from '../../../snyk-test/iac-test-result';\nimport { SEVERITY } from '../../../snyk-test/legacy';\nimport { IacOutputMeta } from '../../../types';\nimport {\n FormattedOutputResultsBySeverity,\n IacTestCounts,\n IacTestData,\n} from './types';\n\ninterface FormatTestDataParams {\n oldFormattedResults: FormattedResult[];\n iacOutputMeta: IacOutputMeta | undefined;\n ignoresCount: number;\n}\n\nexport function formatTestData({\n oldFormattedResults,\n iacOutputMeta: iacTestMeta,\n ignoresCount,\n}: FormatTestDataParams): IacTestData {\n const resultsBySeverity = formatScanResultsNewOutput(oldFormattedResults);\n\n return {\n resultsBySeverity,\n metadata: iacTestMeta,\n counts: formatTestCounts(resultsBySeverity, {\n oldFormattedResults,\n ignoresCount,\n }),\n };\n}\n\nfunction formatTestCounts(\n resultsBySeverity: FormattedOutputResultsBySeverity,\n {\n oldFormattedResults,\n ignoresCount,\n }: Pick<FormatTestDataParams, 'ignoresCount' | 'oldFormattedResults'>,\n): IacTestCounts {\n const filesWithIssues = oldFormattedResults.filter(\n (result) => result.result.cloudConfigResults.length,\n ).length;\n\n const filesWithoutIssues = oldFormattedResults.length - filesWithIssues;\n\n let totalIssues = 0;\n\n const issuesCountBySeverity = {} as { [key in SEVERITY]: number };\n Object.values(SEVERITY).forEach((severity) => {\n issuesCountBySeverity[severity] = resultsBySeverity[severity]?.length || 0;\n totalIssues += issuesCountBySeverity[severity];\n });\n\n return {\n ignores: ignoresCount,\n filesWithIssues,\n filesWithoutIssues,\n issuesBySeverity: issuesCountBySeverity,\n issues: totalIssues,\n };\n}\n\nfunction formatScanResultsNewOutput(\n oldFormattedResults: FormattedResult[],\n): FormattedOutputResultsBySeverity {\n const newFormattedResults: FormattedOutputResultsBySeverity = {};\n\n oldFormattedResults.forEach((oldFormattedResult) => {\n oldFormattedResult.result.cloudConfigResults.forEach((issue) => {\n if (!newFormattedResults[issue.severity]) {\n newFormattedResults[issue.severity] = [];\n }\n\n newFormattedResults[issue.severity].push({\n issue,\n targetFile: oldFormattedResult.targetFile,\n projectType: oldFormattedResult.result.projectType,\n });\n });\n });\n\n return newFormattedResults;\n}\n\nexport function formatSnykIacTestTestData(\n snykIacTestScanResult: Results | undefined,\n projectName: string,\n orgName: string,\n): IacTestData {\n const resultsBySeverity = formatSnykIacTestScanResultNewOutput(\n snykIacTestScanResult,\n );\n\n let totalIssues = 0;\n\n const issuesCountBySeverity = {} as { [key in SEVERITY]: number };\n Object.values(SEVERITY).forEach((severity) => {\n issuesCountBySeverity[severity] = resultsBySeverity[severity]?.length || 0;\n totalIssues += issuesCountBySeverity[severity];\n });\n\n const allFilesCount = countFiles(snykIacTestScanResult);\n const filesWithIssuesCount = countFilesWithIssues(snykIacTestScanResult);\n const filesWithoutIssuesCount = allFilesCount - filesWithIssuesCount;\n\n return {\n resultsBySeverity,\n metadata: { projectName, orgName },\n counts: {\n ignores: 0,\n filesWithIssues: filesWithIssuesCount,\n filesWithoutIssues: filesWithoutIssuesCount,\n issues: totalIssues,\n issuesBySeverity: issuesCountBySeverity,\n },\n };\n}\n\nfunction countFilesWithIssues(results?: Results): number {\n if (results && results.vulnerabilities) {\n const files = new Set<string>();\n\n for (const vulnerability of results.vulnerabilities) {\n if (vulnerability.resource.file) {\n files.add(vulnerability.resource.file);\n }\n }\n\n return files.size;\n }\n\n return 0;\n}\n\nfunction countFiles(results?: Results): number {\n if (results && results?.resources) {\n const files = new Set<string>();\n\n for (const resource of results.resources) {\n if (resource.file) {\n files.add(resource.file);\n }\n }\n\n return files.size;\n }\n\n return 0;\n}\n\nfunction formatSnykIacTestScanResultNewOutput(\n snykIacTestScanResult: Results | undefined,\n): FormattedOutputResultsBySeverity {\n const resultsBySeverity = {} as FormattedOutputResultsBySeverity;\n\n if (snykIacTestScanResult?.vulnerabilities) {\n snykIacTestScanResult.vulnerabilities.forEach((vulnerability) => {\n if (!resultsBySeverity[vulnerability.severity]) {\n resultsBySeverity[vulnerability.severity] = [];\n }\n\n resultsBySeverity[vulnerability.severity]!.push({\n issue: formatSnykIacTestScanVulnerability(vulnerability),\n targetFile: vulnerability.resource.file,\n projectType: vulnerability.resource.type,\n });\n });\n }\n\n return resultsBySeverity;\n}\n\nfunction formatSnykIacTestScanVulnerability(\n vulnerability: Vulnerability,\n): AnnotatedIacIssue {\n return {\n id: vulnerability.rule.id,\n publicId: vulnerability.rule.id,\n severity: vulnerability.severity,\n title: vulnerability.rule.title,\n isIgnored: vulnerability.ignored,\n lineNumber: vulnerability.resource.line,\n cloudConfigPath: formatCloudConfigPath(vulnerability),\n subType: '',\n iacDescription: {\n issue: '',\n impact: '',\n resolve: '',\n },\n issue: '',\n impact: '',\n resolve: '',\n msg: '',\n references: [],\n };\n}\n\nfunction formatCloudConfigPath(vulnerability: Vulnerability): string[] {\n const cloudConfigPath = vulnerability.resource.id.split('.');\n\n if (vulnerability.resource.path) {\n cloudConfigPath.push(...vulnerability.resource.path);\n }\n\n return cloudConfigPath;\n}\n","export { getIacDisplayedIssues } from './issues-list';\nexport { formatIacTestSummary } from './test-summary';\nexport {\n iacTestTitle,\n spinnerMessage,\n spinnerSuccessMessage,\n shouldLogUserMessages,\n customRulesMessage,\n customRulesReportMessage,\n} from './user-messages';\nexport {\n formatShareResultsOutput,\n shareResultsTip,\n shareCustomRulesDisclaimer,\n} from './share-results';\nexport {\n formatIacTestFailures,\n formatFailuresList,\n failuresTipOutput,\n} from './failures';\nexport { IaCTestFailure } from './types';\nexport { formatSnykIacTestTestData, formatTestData } from './formatters';\n","import { EOL } from 'os';\nimport * as capitalize from 'lodash.capitalize';\nimport * as isEmpty from 'lodash.isempty';\nimport * as debug from 'debug';\n\nimport { colors, contentPadding } from '../utils';\nimport { formatIssue } from './issue';\nimport { SEVERITY } from '../../../../snyk-test/common';\nimport {\n FormattedOutputResult,\n FormattedOutputResultsBySeverity,\n} from '../types';\nimport { Options } from './types';\n\nexport function getIacDisplayedIssues(\n resultsBySeverity: FormattedOutputResultsBySeverity,\n options?: Options,\n): string {\n const titleOutput = colors.title('Issues');\n\n if (isEmpty(resultsBySeverity)) {\n return (\n titleOutput +\n EOL +\n contentPadding +\n colors.success.bold('No vulnerable paths were found!')\n );\n }\n\n const severitySectionsOutput = Object.values(SEVERITY)\n .filter((severity) => !!resultsBySeverity[severity])\n .map((severity) => {\n const severityResults: FormattedOutputResult[] =\n resultsBySeverity[severity];\n\n const titleOutput = colors.title(\n `${capitalize(severity)} Severity Issues: ${severityResults.length}`,\n );\n\n const issuesOutput = severityResults\n .sort(\n (severityResult1, severityResult2) =>\n severityResult1.targetFile.localeCompare(\n severityResult2.targetFile,\n ) ||\n severityResult1.issue.id.localeCompare(severityResult2.issue.id),\n )\n .map((result) => formatIssue(result, options))\n .join(EOL.repeat(2));\n\n debug(\n `iac display output - ${severity} severity ${severityResults.length} issues`,\n );\n\n return titleOutput + EOL.repeat(2) + issuesOutput;\n })\n .join(EOL.repeat(2));\n\n return titleOutput + EOL.repeat(2) + severitySectionsOutput;\n}\n","import * as capitalize from 'lodash.capitalize';\nimport chalk from 'chalk';\nimport { EOL } from 'os';\nimport { iacRemediationTypes } from '../../../../iac/constants';\nimport { printPath } from '../../../remediation-based-format-issues';\nimport { colors, contentPadding } from '../utils';\nimport { FormattedOutputResult } from '../types';\nimport { AnnotatedIacIssue } from '../../../../snyk-test/iac-test-result';\nimport { Options } from './types';\n\nexport function formatIssue(\n result: FormattedOutputResult,\n options?: Options,\n): string {\n const titleOutput = formatTitle(result.issue);\n\n const propertiesOutput = formatProperties(result, options);\n return (\n contentPadding +\n titleOutput +\n EOL +\n contentPadding +\n propertiesOutput.join(EOL + contentPadding)\n );\n}\n\nfunction formatTitle(issue: AnnotatedIacIssue): string {\n const severity = issue.severity;\n const titleOutput = colors.severities[severity](\n `[${capitalize([issue.severity])}] ${chalk.bold(issue.title)}`,\n );\n\n return titleOutput;\n}\n\nfunction formatInfo(issue: AnnotatedIacIssue): string | undefined {\n const issueDesc = issue.iacDescription.issue;\n const issueImpact = issue.iacDescription.impact;\n\n if (!issueDesc) {\n return issueImpact;\n }\n\n if (!issueImpact) {\n return issueDesc;\n }\n\n return `${issueDesc}${!issueDesc.endsWith('.') ? '.' : ''} ${issueImpact}`;\n}\n\nfunction formatProperties(\n result: FormattedOutputResult,\n options?: Options,\n): string[] {\n const remediationKey = iacRemediationTypes?.[result.projectType];\n\n const properties = [\n ['Info', formatInfo(result.issue)],\n [\n 'Rule',\n result.issue.isGeneratedByCustomRule\n ? `custom rule ${result.issue.id}`\n : chalk.underline(result.issue.documentation || ''),\n ],\n ['Path', printPath(result.issue.cloudConfigPath, 0)],\n [\n 'File',\n `${result.targetFile}${\n options?.shouldShowLineNumbers &&\n isValidLineNumber(result.issue.lineNumber)\n ? `:${result.issue.lineNumber}`\n : ''\n }`,\n ],\n [\n 'Resolve',\n remediationKey && result.issue.remediation?.[remediationKey]\n ? result.issue.remediation[remediationKey]\n : result.issue.iacDescription.resolve,\n ],\n ].filter(([, val]) => !!val) as [string, string][];\n\n const maxPropertyNameLength = Math.max(\n ...properties.map(([key]) => key.length),\n );\n\n return properties.map(\n ([key, value]) =>\n `${key}: ${' '.repeat(maxPropertyNameLength - key.length)}${value}`,\n );\n}\n\nfunction isValidLineNumber(lineNumber: number | undefined): boolean {\n return (\n typeof lineNumber === 'number' && lineNumber! > 0 && lineNumber! % 1 === 0\n );\n}\n","import { IacOutputMeta } from '../../../types';\nimport config from '../../../config';\nimport { EOL } from 'os';\nimport { colors, contentPadding } from './utils';\n\nexport function formatShareResultsOutput(iacOutputMeta: IacOutputMeta) {\n return (\n colors.title('Report Complete') +\n EOL +\n EOL +\n contentPadding +\n 'Your test results are available at: ' +\n colors.title(`${config.ROOT}/org/${iacOutputMeta.orgName}/projects`) +\n EOL +\n contentPadding +\n 'under the name: ' +\n colors.title(iacOutputMeta.projectName)\n );\n}\n\nexport const shareResultsTip =\n colors.title('Tip') +\n EOL +\n EOL +\n contentPadding +\n 'New: Share your test results in the Snyk Web UI with the option ' +\n colors.title('--report');\n\nexport const shareCustomRulesDisclaimer =\n contentPadding +\n colors.suggestion(\n 'Please note that your custom rules will not be sent to the platform, and will not be available on the projects page.',\n );\n","import { EOL } from 'os';\nimport { rightPadWithSpaces } from '../../../right-pad';\nimport { icon } from '../../../theme';\nimport { IacOutputMeta } from '../../../types';\nimport { colors } from './utils';\nimport { IacTestCounts, IacTestData } from './types';\n\nconst PAD_LENGTH = 19; // chars to align\nconst INDENT = ' ';\n\nexport function formatIacTestSummary(testData: IacTestData): string {\n const title = colors.title('Test Summary');\n const summarySections: string[] = [title];\n\n if (testData.metadata) {\n summarySections.push(formatTestMetaSection(testData.metadata));\n }\n\n summarySections.push(formatCountsSection(testData.counts));\n\n return summarySections.join(EOL.repeat(2));\n}\n\nfunction formatTestMetaSection(iacMeta: IacOutputMeta): string {\n const metaSectionProperties: [string, string][] = [];\n\n if (iacMeta.orgName) {\n metaSectionProperties.push(['Organization', iacMeta.orgName]);\n }\n\n if (iacMeta.projectName) {\n metaSectionProperties.push(['Project name', iacMeta.projectName]);\n }\n\n const metaSection = metaSectionProperties\n .map(([key, value]) =>\n rightPadWithSpaces(`${INDENT}${key}: ${value}`, PAD_LENGTH),\n )\n .join(EOL);\n\n return metaSection;\n}\n\nfunction formatCountsSection(testCounts: IacTestCounts): string {\n const countsSectionProperties: string[] = [];\n\n countsSectionProperties.push(\n `${colors.success.bold(\n icon.VALID,\n )} Files without issues: ${colors.info.bold(\n `${testCounts.filesWithoutIssues}`,\n )}`,\n );\n\n countsSectionProperties.push(\n `${colors.failure.bold(icon.ISSUE)} Files with issues: ${colors.info.bold(\n `${testCounts.filesWithIssues}`,\n )}`,\n );\n\n countsSectionProperties.push(\n `${INDENT}Ignored issues: ${colors.info.bold(`${testCounts.ignores}`)}`,\n );\n\n countsSectionProperties.push(\n `${INDENT}Total issues: ${colors.info.bold(\n `${testCounts.issues}`,\n )} [ ${colors.severities.critical(\n `${testCounts.issuesBySeverity.critical} critical`,\n )}, ${colors.severities.high(\n `${testCounts.issuesBySeverity.high} high`,\n )}, ${colors.severities.medium(\n `${testCounts.issuesBySeverity.medium} medium`,\n )}, ${colors.severities.low(`${testCounts.issuesBySeverity.low} low`)} ]`,\n );\n\n return countsSectionProperties.join(EOL);\n}\n","import { IaCTestFlags } from '../../../../cli/commands/test/iac/local-execution/types';\nimport { colors } from './utils';\n\n/**\n * Displayed as the title of the test output.\n */\nexport const iacTestTitle = colors.info.bold('Snyk Infrastructure as Code');\n\n/**\n * Progress indication message while files are tested.\n */\nexport const spinnerMessage = colors.info(\n 'Snyk testing Infrastructure as Code configuration issues.',\n);\n\n/**\n * Displayed when a test resolves successfully.\n */\nexport const spinnerSuccessMessage = colors.info('Test completed.');\n\n/**\n * Message for using custom rules.\n */\nexport const customRulesMessage = colors.info(\n 'Using custom rules to generate misconfigurations.',\n);\n\n/**\n * Message for using custom rules.\n */\nexport const customRulesReportMessage = colors.info(\n \"Please note that your custom rules will not be sent to the Snyk platform, and will not be available on the project's page.\",\n);\n\n/**\n * @returns whether or not to include user messages in the output.\n */\nexport function shouldLogUserMessages(\n options: IaCTestFlags,\n iacCliOutputFeatureFlag?: boolean,\n): boolean {\n return !!(\n !options.json &&\n !options.sarif &&\n !options.quiet &&\n iacCliOutputFeatureFlag\n );\n}\n","import chalk, { Chalk } from 'chalk';\nimport { SEVERITY } from '../../../snyk-test/common';\n\ninterface IacOutputColors {\n severities: SeverityColor;\n failure: Chalk;\n success: Chalk;\n info: Chalk;\n title: Chalk;\n suggestion: Chalk;\n}\n\ntype SeverityColor = {\n [severity in SEVERITY]: Chalk;\n};\n\nexport const colors: IacOutputColors = {\n severities: {\n critical: chalk.magenta,\n high: chalk.red,\n medium: chalk.yellow,\n low: chalk.reset,\n },\n failure: chalk.red,\n success: chalk.green,\n info: chalk.reset,\n title: chalk.reset.bold,\n suggestion: chalk.gray,\n};\n\nexport const contentPadding = ' '.repeat(2);\n","export { formatTestMeta } from './format-test-meta';\nexport { summariseVulnerableResults } from './format-vulnerable-result-summary';\nexport { summariseErrorResults } from './format-error-result-summary';\nexport { formatIssues } from './legacy-format-issue';\nexport { formatLegalInstructions } from './legal-license-instructions';\nexport { formatIssuesWithRemediation } from './remediation-based-format-issues';\nexport { summariseReachableVulns } from './format-reachability';\n\nexport {\n formatErrorMonitorOutput,\n formatMonitorOutput,\n} from './format-monitor-response';\n\nexport * from './docker';\n","const uniq = require('lodash.uniq');\nimport chalk from 'chalk';\n\nimport config from '../../lib/config';\nimport { Options, TestOptions, ShowVulnPaths } from '../../lib/types';\nimport { isLocalFolder } from '../../lib/detect';\nimport { parsePackageString as snykModule } from 'snyk-module';\nimport {\n PINNING_SUPPORTED_PACKAGE_MANAGERS,\n SupportedPackageManagers,\n} from '../../lib/package-managers';\nimport {\n GroupedVuln,\n AnnotatedIssue,\n DockerIssue,\n SEVERITY,\n} from '../../lib/snyk-test/legacy';\nimport { formatLegalInstructions } from './legal-license-instructions';\nimport { getReachabilityText } from './format-reachability';\nimport { colorTextBySeverity } from '../../lib/snyk-test/common';\nimport { PATH_SEPARATOR } from '../constants';\n\nexport function formatIssues(\n vuln: GroupedVuln,\n options: Options & TestOptions,\n) {\n const vulnID = vuln.list[0].id;\n const packageManager = options.packageManager!;\n const localPackageTest = isLocalFolder(options.path);\n const uniquePackages = uniq(\n vuln.list.map((i) => {\n if (i.from[1]) {\n return i.from && i.from[1];\n }\n return i.from;\n }),\n ).join(', ');\n\n const vulnOutput = {\n issueHeading: createSeverityBasedIssueHeading({\n severity: vuln.metadata.severity,\n originalSeverity: vuln.originalSeverity,\n type: vuln.metadata.type,\n packageName: vuln.metadata.name,\n isNew: false,\n }),\n introducedThrough: ' Introduced through: ' + uniquePackages,\n description: ' Description: ' + vuln.title,\n info:\n ' Info: ' +\n chalk.underline(config.PUBLIC_VULN_DB_URL + '/vuln/' + vulnID),\n fromPaths: createTruncatedVulnsPathsText(vuln.list, options.showVulnPaths),\n extraInfo: vuln.note ? chalk.bold('\\n Note: ' + vuln.note) : '',\n remediationInfo:\n vuln.metadata.type !== 'license' && localPackageTest\n ? createRemediationText(vuln, packageManager)\n : '',\n fixedIn: options.docker ? createFixedInText(vuln) : '',\n dockerfilePackage: options.docker ? dockerfileInstructionText(vuln) : '',\n legalInstructions: vuln.legalInstructionsArray\n ? chalk.bold('\\n Legal instructions:\\n') +\n ' '.repeat(2) +\n formatLegalInstructions(vuln.legalInstructionsArray, 2)\n : '',\n reachability: vuln.reachability ? createReachabilityInText(vuln) : '',\n };\n\n return (\n `${vulnOutput.issueHeading}\\n` +\n `${vulnOutput.description}\\n` +\n `${vulnOutput.info}\\n` +\n `${vulnOutput.introducedThrough}\\n` +\n vulnOutput.fromPaths +\n // Optional - not always there\n vulnOutput.reachability +\n vulnOutput.remediationInfo +\n vulnOutput.dockerfilePackage +\n vulnOutput.fixedIn +\n vulnOutput.extraInfo +\n vulnOutput.legalInstructions\n );\n}\n\ntype CreateSeverityBasedIssueHeading = {\n severity: SEVERITY;\n originalSeverity?: SEVERITY;\n type: string;\n packageName: string;\n isNew: boolean;\n};\n\nfunction createSeverityBasedIssueHeading({\n severity,\n originalSeverity,\n type,\n packageName,\n isNew,\n}: CreateSeverityBasedIssueHeading) {\n // Example: ✗ Medium severity vulnerability found in xmldom\n const vulnTypeText = type === 'license' ? 'issue' : 'vulnerability';\n\n let originalSeverityStr = '';\n if (originalSeverity && originalSeverity !== severity) {\n originalSeverityStr = ` (originally ${titleCaseText(originalSeverity)})`;\n }\n\n return (\n colorTextBySeverity(\n severity,\n '✗ ' +\n titleCaseText(severity) +\n ` severity${originalSeverityStr} ` +\n vulnTypeText +\n ' found in ' +\n chalk.underline(packageName),\n ) + chalk.bold.magenta(isNew ? ' (new)' : '')\n );\n}\n\nexport function titleCaseText(text) {\n return text[0].toUpperCase() + text.slice(1);\n}\n\nfunction dockerfileInstructionText(vuln) {\n if (vuln.dockerfileInstruction) {\n JSON.stringify(vuln.dockerfileInstruction);\n return `\\n Image layer: '${vuln.dockerfileInstruction}'`;\n }\n\n if (vuln.dockerBaseImage) {\n return `\\n Image layer: Introduced by your base image (${vuln.dockerBaseImage})`;\n }\n\n return '';\n}\nfunction createTruncatedVulnsPathsText(\n vulnList: AnnotatedIssue[],\n show: ShowVulnPaths,\n) {\n if (show === 'none') {\n return '';\n }\n const numberOfPathsToDisplay = show === 'all' ? 1000 : 3;\n const fromPathsArray = vulnList.map((i) => i.from);\n\n const formatedFromPathsArray = fromPathsArray.map((i) => {\n const fromWithoutBaseProject = i.slice(1);\n // If more than one From path\n if (fromWithoutBaseProject.length) {\n return i.slice(1).join(PATH_SEPARATOR);\n }\n // Else issue is in the core package\n return i;\n });\n\n const notShownPathsNumber = fromPathsArray.length - numberOfPathsToDisplay;\n const shouldTruncatePaths = fromPathsArray.length > numberOfPathsToDisplay;\n const truncatedText = `\\n and ${notShownPathsNumber} more...`;\n const formattedPathsText = formatedFromPathsArray\n .slice(0, numberOfPathsToDisplay)\n .join('\\n From: ');\n\n if (fromPathsArray.length > 0) {\n return (\n ' From: ' +\n formattedPathsText +\n (shouldTruncatePaths ? truncatedText : '')\n );\n }\n}\n\nfunction createFixedInText(vuln: GroupedVuln): string {\n if ((vuln as DockerIssue).nearestFixedInVersion) {\n return chalk.bold(\n '\\n Fixed in: ' + (vuln as DockerIssue).nearestFixedInVersion,\n );\n } else if (vuln.fixedIn && vuln.fixedIn.length > 0) {\n return chalk.bold('\\n Fixed in: ' + vuln.fixedIn.join(', '));\n }\n\n return '';\n}\n\nfunction createReachabilityInText(vuln: GroupedVuln): string {\n if (!vuln.reachability) {\n return '';\n }\n const reachabilityText = getReachabilityText(vuln.reachability);\n if (!reachabilityText) {\n return '';\n }\n return `\\n Reachability: ${reachabilityText}`;\n}\n\nfunction createRemediationText(\n vuln: GroupedVuln,\n packageManager: SupportedPackageManagers,\n): string {\n if (\n vuln.fixedIn &&\n PINNING_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)\n ) {\n const toVersion = vuln.fixedIn.join(' or ');\n const transitive = vuln.list.every((i) => i.from.length > 2);\n const fromVersionArray = vuln.list.map((v) => v.from[1]);\n const fromVersion = fromVersionArray[0];\n if (transitive) {\n return chalk.bold(\n `\\n Remediation:\\n Pin the transitive dependency ${vuln.name} to version ${toVersion}`,\n );\n } else {\n return chalk.bold(\n `\\n Remediation:\\n Upgrade direct dependency ${fromVersion} to ${vuln.name}@${toVersion}`,\n );\n }\n }\n\n if (vuln.isFixable === true) {\n const upgradePathsArray = uniq(\n vuln.list.map((v) => {\n const shouldUpgradeItself = !!v.upgradePath[0];\n const shouldUpgradeDirectDep = !!v.upgradePath[1];\n\n if (shouldUpgradeItself) {\n // If we are testing a library/package like express\n // Then we can suggest they get the latest version\n // Example command: snyk test express@3\n const selfUpgradeInfo =\n v.upgradePath.length > 0\n ? ` (triggers upgrades to ${v.upgradePath.join(PATH_SEPARATOR)})`\n : '';\n const testedPackageName = snykModule(v.upgradePath[0] as string);\n return (\n `You've tested an outdated version of ${testedPackageName[0]}.` +\n +` Upgrade to ${v.upgradePath[0]}${selfUpgradeInfo}`\n );\n }\n if (shouldUpgradeDirectDep) {\n const formattedUpgradePath = v.upgradePath\n .slice(1)\n .join(PATH_SEPARATOR);\n const upgradeTextInfo = v.upgradePath.length\n ? ` (triggers upgrades to ${formattedUpgradePath})`\n : '';\n\n return `Upgrade direct dependency ${v.from[1]} to ${v.upgradePath[1]}${upgradeTextInfo}`;\n }\n\n return 'Some paths have no direct dependency upgrade that can address this issue.';\n }),\n );\n return chalk.bold(\n `\\n Remediation:\\n ${upgradePathsArray.join('\\n ')}`,\n );\n }\n\n if (vuln.fixedIn && vuln.fixedIn.length > 0) {\n return createFixedInText(vuln);\n }\n\n return '';\n}\n","import * as wrap from 'wrap-ansi';\nimport chalk from 'chalk';\n\nimport { LegalInstruction } from '../../lib/snyk-test/legacy';\n\nexport function formatLegalInstructions(\n legalInstructions: LegalInstruction[],\n paddingLength = 4,\n): string {\n const legalContent: string[] = legalInstructions.map((legalData) =>\n wrap(\n chalk.bold(`○ for ${legalData.licenseName}: `) + legalData.legalContent,\n 100,\n )\n .split('\\n')\n .join('\\n' + ' '.repeat(paddingLength)),\n );\n return legalContent.join('\\n' + ' '.repeat(paddingLength));\n}\n","import chalk from 'chalk';\nimport { icon } from '../theme';\nimport config from '../../lib/config';\nimport { TestOptions } from '../../lib/types';\nimport {\n DependencyPins,\n DependencyUpdates,\n GroupedVuln,\n IssueData,\n LegalInstruction,\n PatchRemediation,\n PinRemediation,\n REACHABILITY,\n RemediationChanges,\n SEVERITY,\n UpgradeRemediation,\n} from '../../lib/snyk-test/legacy';\nimport { colorTextBySeverity } from '../../lib/snyk-test/common';\nimport { formatLegalInstructions } from './legal-license-instructions';\nimport {\n formatReachability,\n formatReachablePaths,\n} from './format-reachability';\nimport {\n BasicVulnInfo,\n SampleReachablePaths,\n UpgradesByAffectedPackage,\n} from './types';\nimport { PATH_SEPARATOR } from '../constants';\nimport { getSeverityValue } from './get-severity-value';\n\n// How many reachable paths to show in the output\nconst MAX_REACHABLE_PATHS = 2;\n\nexport function formatIssuesWithRemediation(\n vulns: GroupedVuln[],\n remediationInfo: RemediationChanges,\n options: TestOptions,\n): string[] {\n const basicVulnInfo: {\n [name: string]: BasicVulnInfo;\n } = {};\n\n const basicLicenseInfo: {\n [name: string]: BasicVulnInfo;\n } = {};\n for (const vuln of vulns) {\n const allReachablePaths: SampleReachablePaths = { pathCount: 0, paths: [] };\n for (const issue of vuln.list) {\n const issueReachablePaths = issue.reachablePaths?.paths || [];\n for (const functionReachablePaths of issueReachablePaths) {\n allReachablePaths.paths = allReachablePaths.paths.concat(\n functionReachablePaths.callPaths,\n );\n allReachablePaths.pathCount += functionReachablePaths.callPaths.length;\n }\n }\n const vulnData = {\n title: vuln.title,\n severity: vuln.severity,\n originalSeverity: vuln.originalSeverity,\n isNew: vuln.isNew,\n name: vuln.name,\n type: vuln.metadata.type,\n version: vuln.version,\n fixedIn: vuln.fixedIn,\n note: vuln.note,\n legalInstructions: vuln.legalInstructionsArray,\n paths: vuln.list.map((v) => v.from),\n reachability: vuln.reachability,\n sampleReachablePaths: allReachablePaths,\n };\n\n if (vulnData.type === 'license') {\n basicLicenseInfo[vuln.metadata.id] = vulnData;\n } else {\n basicVulnInfo[vuln.metadata.id] = vulnData;\n }\n }\n\n const results = [''];\n\n let upgradeTextArray: string[];\n if (remediationInfo.pin && Object.keys(remediationInfo.pin).length) {\n const upgradesByAffected: UpgradesByAffectedPackage = {};\n for (const topLevelPkg of Object.keys(remediationInfo.upgrade)) {\n for (const targetPkgStr of remediationInfo.upgrade[topLevelPkg]\n .upgrades) {\n if (!upgradesByAffected[targetPkgStr]) {\n upgradesByAffected[targetPkgStr] = [];\n }\n upgradesByAffected[targetPkgStr].push({\n name: topLevelPkg,\n version: remediationInfo.upgrade[topLevelPkg].upgradeTo,\n });\n }\n }\n upgradeTextArray = constructPinText(\n remediationInfo.pin,\n upgradesByAffected,\n basicVulnInfo,\n options,\n );\n const allVulnIds = new Set();\n Object.keys(remediationInfo.pin).forEach((name) =>\n remediationInfo.pin[name].vulns.forEach((vid) => allVulnIds.add(vid)),\n );\n remediationInfo.unresolved = remediationInfo.unresolved.filter(\n (issue) => !allVulnIds.has(issue.id),\n );\n } else {\n upgradeTextArray = constructUpgradesText(\n remediationInfo.upgrade,\n basicVulnInfo,\n options,\n );\n }\n if (upgradeTextArray.length > 0) {\n results.push(upgradeTextArray.join('\\n'));\n }\n\n const patchedTextArray = constructPatchesText(\n remediationInfo.patch,\n basicVulnInfo,\n options,\n );\n\n if (patchedTextArray.length > 0) {\n results.push(patchedTextArray.join('\\n'));\n }\n\n const unfixableIssuesTextArray = constructUnfixableText(\n remediationInfo.unresolved,\n basicVulnInfo,\n options,\n );\n\n if (unfixableIssuesTextArray.length > 0) {\n results.push(unfixableIssuesTextArray.join('\\n'));\n }\n\n const licenseIssuesTextArray = constructLicenseText(\n basicLicenseInfo,\n options,\n );\n\n if (licenseIssuesTextArray.length > 0) {\n results.push(licenseIssuesTextArray.join('\\n'));\n }\n\n return results;\n}\n\nfunction constructLicenseText(\n basicLicenseInfo: {\n [name: string]: BasicVulnInfo;\n },\n testOptions: TestOptions,\n): string[] {\n if (!(Object.keys(basicLicenseInfo).length > 0)) {\n return [];\n }\n\n const licenseTextArray = [chalk.bold.green('\\nLicense issues:')];\n\n for (const id of Object.keys(basicLicenseInfo)) {\n const licenseText = formatIssue(\n id,\n basicLicenseInfo[id].title,\n basicLicenseInfo[id].severity,\n basicLicenseInfo[id].isNew,\n `${basicLicenseInfo[id].name}@${basicLicenseInfo[id].version}`,\n basicLicenseInfo[id].paths,\n testOptions,\n basicLicenseInfo[id].note,\n undefined, // We can never override license rules, so no originalSeverity here\n basicLicenseInfo[id].legalInstructions,\n );\n licenseTextArray.push('\\n' + licenseText);\n }\n return licenseTextArray;\n}\n\nfunction constructPatchesText(\n patches: {\n [name: string]: PatchRemediation;\n },\n basicVulnInfo: {\n [name: string]: BasicVulnInfo;\n },\n testOptions: TestOptions,\n): string[] {\n if (!(Object.keys(patches).length > 0)) {\n return [];\n }\n const patchedTextArray = [chalk.bold.green('\\nPatchable issues:')];\n for (const id of Object.keys(patches)) {\n if (!basicVulnInfo[id]) {\n continue;\n }\n if (basicVulnInfo[id].type === 'license') {\n continue;\n }\n\n // todo: add vulnToPatch package name\n const packageAtVersion = `${basicVulnInfo[id].name}@${basicVulnInfo[id].version}`;\n const patchedText = `\\n Patch available for ${chalk.bold.whiteBright(\n packageAtVersion,\n )}\\n`;\n const thisPatchFixes = formatIssue(\n id,\n basicVulnInfo[id].title,\n basicVulnInfo[id].severity,\n basicVulnInfo[id].isNew,\n `${basicVulnInfo[id].name}@${basicVulnInfo[id].version}`,\n basicVulnInfo[id].paths,\n testOptions,\n basicVulnInfo[id].note,\n basicVulnInfo[id].originalSeverity,\n );\n patchedTextArray.push(patchedText + thisPatchFixes);\n }\n\n return patchedTextArray;\n}\n\nfunction thisUpgradeFixes(\n vulnIds: string[],\n basicVulnInfo: Record<string, BasicVulnInfo>,\n testOptions: TestOptions,\n) {\n return vulnIds\n .filter((id) => basicVulnInfo[id]) // basicVulnInfo only contains issues with the specified severity levels\n .sort(\n (a, b) =>\n getSeverityValue(basicVulnInfo[a].severity) -\n getSeverityValue(basicVulnInfo[b].severity),\n )\n .filter((id) => basicVulnInfo[id].type !== 'license')\n .map((id) =>\n formatIssue(\n id,\n basicVulnInfo[id].title,\n basicVulnInfo[id].severity,\n basicVulnInfo[id].isNew,\n `${basicVulnInfo[id].name}@${basicVulnInfo[id].version}`,\n basicVulnInfo[id].paths,\n testOptions,\n basicVulnInfo[id].note,\n basicVulnInfo[id].originalSeverity,\n [],\n basicVulnInfo[id].reachability,\n basicVulnInfo[id].sampleReachablePaths,\n ),\n )\n .join('\\n');\n}\n\nfunction processUpgrades(\n sink: string[],\n upgradesByDep: DependencyUpdates | DependencyPins,\n deps: string[],\n basicVulnInfo: Record<string, BasicVulnInfo>,\n testOptions: TestOptions,\n) {\n for (const dep of deps) {\n const data = upgradesByDep[dep];\n const upgradeDepTo = data.upgradeTo;\n const vulnIds =\n (data as UpgradeRemediation).vulns || (data as PinRemediation).vulns;\n const upgradeText = `\\n Upgrade ${chalk.bold.whiteBright(\n dep,\n )} to ${chalk.bold.whiteBright(upgradeDepTo)} to fix\\n`;\n sink.push(\n upgradeText + thisUpgradeFixes(vulnIds, basicVulnInfo, testOptions),\n );\n }\n}\n\nfunction constructUpgradesText(\n upgrades: DependencyUpdates,\n basicVulnInfo: {\n [name: string]: BasicVulnInfo;\n },\n testOptions: TestOptions,\n): string[] {\n if (!(Object.keys(upgrades).length > 0)) {\n return [];\n }\n\n const upgradeTextArray = [chalk.bold.green('\\nIssues to fix by upgrading:')];\n processUpgrades(\n upgradeTextArray,\n upgrades,\n Object.keys(upgrades),\n basicVulnInfo,\n testOptions,\n );\n return upgradeTextArray;\n}\n\nfunction constructPinText(\n pins: DependencyPins,\n upgradesByAffected: UpgradesByAffectedPackage, // classical \"remediation via top-level dep\" upgrades\n basicVulnInfo: Record<string, BasicVulnInfo>,\n testOptions: TestOptions,\n): string[] {\n if (!Object.keys(pins).length) {\n return [];\n }\n\n const upgradeTextArray: string[] = [];\n upgradeTextArray.push(\n chalk.bold.green('\\nIssues to fix by upgrading dependencies:'),\n );\n\n // First, direct upgrades\n\n const upgradeables = Object.keys(pins).filter(\n (name) => !pins[name].isTransitive,\n );\n if (upgradeables.length) {\n processUpgrades(\n upgradeTextArray,\n pins,\n upgradeables,\n basicVulnInfo,\n testOptions,\n );\n }\n\n // Second, pins\n const pinables = Object.keys(pins).filter((name) => pins[name].isTransitive);\n\n if (pinables.length) {\n for (const pkgName of pinables) {\n const data = pins[pkgName];\n const vulnIds = data.vulns;\n const upgradeDepTo = data.upgradeTo;\n const upgradeText = `\\n Pin ${chalk.bold.whiteBright(\n pkgName,\n )} to ${chalk.bold.whiteBright(upgradeDepTo)} to fix`;\n upgradeTextArray.push(upgradeText);\n upgradeTextArray.push(\n thisUpgradeFixes(vulnIds, basicVulnInfo, testOptions),\n );\n\n // Finally, if we have some upgrade paths that fix the same issues, suggest them as well.\n const topLevelUpgradesAlreadySuggested = new Set();\n for (const vid of vulnIds) {\n for (const topLevelPkg of upgradesByAffected[\n pkgName + '@' + basicVulnInfo[vid].version\n ] || []) {\n const setKey = `${topLevelPkg.name}\\n${topLevelPkg.version}`;\n if (!topLevelUpgradesAlreadySuggested.has(setKey)) {\n topLevelUpgradesAlreadySuggested.add(setKey);\n upgradeTextArray.push(\n ' The issues above can also be fixed by upgrading top-level dependency ' +\n `${topLevelPkg.name} to ${topLevelPkg.version}`,\n );\n }\n }\n }\n }\n }\n\n return upgradeTextArray;\n}\n\nfunction constructUnfixableText(\n unresolved: IssueData[],\n basicVulnInfo: Record<string, BasicVulnInfo>,\n testOptions: TestOptions,\n) {\n if (!(unresolved.length > 0)) {\n return [];\n }\n const unfixableIssuesTextArray = [\n chalk.bold.white('\\nIssues with no direct upgrade or patch:'),\n ];\n for (const issue of unresolved) {\n const issueInfo = basicVulnInfo[issue.id];\n if (!issueInfo) {\n // basicVulnInfo only contains issues with the specified severity levels\n continue;\n }\n\n const extraInfo =\n issue.fixedIn && issue.fixedIn.length\n ? `\\n This issue was fixed in versions: ${chalk.bold(\n issue.fixedIn.join(', '),\n )}`\n : '\\n No upgrade or patch available';\n unfixableIssuesTextArray.push(\n formatIssue(\n issue.id,\n issue.title,\n issue.severity,\n issue.isNew,\n `${issue.packageName}@${issue.version}`,\n issueInfo.paths,\n testOptions,\n issueInfo.note,\n issueInfo.originalSeverity,\n [],\n issue.reachability,\n ) + `${extraInfo}`,\n );\n }\n\n if (unfixableIssuesTextArray.length === 1) {\n // seems we still only have\n // the initial section title, so nothing to return\n return [];\n }\n\n return unfixableIssuesTextArray;\n}\n\nexport function printPath(path: string[], slice = 1) {\n return path.slice(slice).join(PATH_SEPARATOR);\n}\n\nexport function formatIssue(\n id: string,\n title: string,\n severity: SEVERITY,\n isNew: boolean,\n vulnerableModule: string,\n paths: string[][],\n testOptions: TestOptions,\n note: string | false,\n originalSeverity?: SEVERITY,\n legalInstructions?: LegalInstruction[],\n reachability?: REACHABILITY,\n sampleReachablePaths?: SampleReachablePaths,\n): string {\n const newBadge = isNew ? ' (new)' : '';\n const name = vulnerableModule ? ` in ${chalk.bold(vulnerableModule)}` : '';\n let legalLicenseInstructionsText;\n if (legalInstructions) {\n legalLicenseInstructionsText = formatLegalInstructions(legalInstructions);\n }\n let reachabilityText = '';\n if (reachability) {\n reachabilityText = formatReachability(reachability);\n }\n\n let introducedBy = '';\n\n if (\n testOptions.showVulnPaths === 'some' &&\n paths &&\n paths.find((p) => p.length > 1)\n ) {\n // In this mode, we show only one path by default, for compactness\n const pathStr = printPath(paths[0]);\n introducedBy =\n paths.length === 1\n ? `\\n introduced by ${pathStr}`\n : `\\n introduced by ${pathStr} and ${chalk.cyanBright(\n '' + (paths.length - 1),\n )} other path(s)`;\n } else if (testOptions.showVulnPaths === 'all' && paths) {\n introducedBy =\n '\\n introduced by:' +\n paths\n .slice(0, 1000)\n .map((p) => '\\n ' + printPath(p))\n .join('');\n if (paths.length > 1000) {\n introducedBy += `\\n and ${chalk.cyanBright(\n '' + (paths.length - 1),\n )} other path(s)`;\n }\n }\n\n const reachableVia = formatReachablePaths(\n sampleReachablePaths,\n MAX_REACHABLE_PATHS,\n reachablePathsTemplate,\n );\n\n let originalSeverityStr = '';\n if (originalSeverity && originalSeverity !== severity) {\n originalSeverityStr = ` (originally ${titleCaseText(originalSeverity)})`;\n }\n\n return (\n colorTextBySeverity(\n severity,\n ` ${icon.ISSUE} ${chalk.bold(title)}${newBadge} [${titleCaseText(\n severity,\n )} Severity${originalSeverityStr}]`,\n ) +\n reachabilityText +\n `[${config.PUBLIC_VULN_DB_URL}/vuln/${id}]` +\n name +\n reachableVia +\n introducedBy +\n (legalLicenseInstructionsText\n ? `${chalk.bold(\n '\\n Legal instructions',\n )}:\\n ${legalLicenseInstructionsText}`\n : '') +\n (note ? `${chalk.bold('\\n Note')}:\\n ${note}` : '')\n );\n}\n\nfunction titleCaseText(text) {\n return text[0].toUpperCase() + text.slice(1);\n}\n\nfunction reachablePathsTemplate(\n samplePaths: string[],\n extraPathsCount: number,\n): string {\n if (samplePaths.length === 0 && extraPathsCount === 0) {\n return '';\n }\n if (samplePaths.length === 0) {\n return `\\n reachable via at least ${extraPathsCount} paths`;\n }\n let reachableVia = '\\n reachable via:\\n';\n for (const p of samplePaths) {\n reachableVia += ` ${p}\\n`;\n }\n if (extraPathsCount > 0) {\n reachableVia += ` and at least ${chalk.cyanBright(\n '' + extraPathsCount,\n )} other path(s)`;\n }\n return reachableVia;\n}\n","import * as sarif from 'sarif';\nimport { TestResult } from '../snyk-test/legacy';\nimport { SEVERITY } from '../snyk-test/legacy';\nconst upperFirst = require('lodash.upperfirst');\n\nexport function createSarifOutputForContainers(\n testResults: TestResult[],\n): sarif.Log {\n const sarifRes: sarif.Log = {\n version: '2.1.0',\n runs: [],\n };\n\n testResults.forEach((testResult) => {\n sarifRes.runs.push({\n tool: getTool(testResult),\n results: getResults(testResult),\n });\n });\n\n return sarifRes;\n}\n\nexport function getIssueLevel(\n severity: SEVERITY | 'none',\n): sarif.ReportingConfiguration.level {\n return severity === SEVERITY.HIGH || severity === SEVERITY.CRITICAL\n ? 'error'\n : 'warning';\n}\n\nexport function getTool(testResult): sarif.Tool {\n const tool: sarif.Tool = {\n driver: {\n name: 'Snyk Container',\n rules: [],\n },\n };\n\n if (!testResult.vulnerabilities) {\n return tool;\n }\n\n const pushedIds = {};\n tool.driver.rules = testResult.vulnerabilities\n .map((vuln) => {\n if (pushedIds[vuln.id]) {\n return;\n }\n const level = getIssueLevel(vuln.severity);\n const cve = vuln['identifiers']['CVE'][0];\n pushedIds[vuln.id] = true;\n return {\n id: vuln.id,\n shortDescription: {\n text: `${upperFirst(vuln.severity)} severity - ${\n vuln.title\n } vulnerability in ${vuln.packageName}`,\n },\n fullDescription: {\n text: cve\n ? `(${cve}) ${vuln.name}@${vuln.version}`\n : `${vuln.name}@${vuln.version}`,\n },\n help: {\n text: '',\n markdown: vuln.description,\n },\n defaultConfiguration: {\n level: level,\n },\n properties: {\n tags: ['security', ...vuln.identifiers.CWE],\n },\n };\n })\n .filter(Boolean);\n return tool;\n}\n\nexport function getResults(testResult): sarif.Result[] {\n const results: sarif.Result[] = [];\n\n if (!testResult.vulnerabilities) {\n return results;\n }\n testResult.vulnerabilities.forEach((vuln) => {\n results.push({\n ruleId: vuln.id,\n message: {\n text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,\n },\n locations: [\n {\n physicalLocation: {\n artifactLocation: {\n uri: testResult.displayTargetFile,\n },\n region: {\n startLine: vuln.lineNumber || 1,\n },\n },\n },\n ],\n });\n });\n return results;\n}\n","import { isMultiProjectScan } from '../is-multi-project-scan';\n\nexport function showAllProjectsTip(\n packageManager,\n options,\n foundProjectCount,\n): string {\n if (\n packageManager === 'gradle' ||\n !foundProjectCount ||\n isMultiProjectScan(options)\n ) {\n return '';\n }\n return (\n `Tip: Detected multiple supported manifests (${foundProjectCount}), ` +\n 'use --all-projects to scan all of them at once.'\n );\n}\n","import { isMultiProjectScan } from '../is-multi-project-scan';\n\nexport function showGradleSubProjectsTip(\n packageManager,\n options,\n foundProjectCount,\n): string {\n if (\n packageManager !== 'gradle' ||\n !foundProjectCount ||\n isMultiProjectScan(options) ||\n options.allSubProjects\n ) {\n return '';\n }\n\n return (\n `Tip: This project has multiple sub-projects (${foundProjectCount}), ` +\n 'use --all-sub-projects flag to scan all sub-projects.'\n );\n}\n","import { SupportedPackageManagers } from '../package-managers';\nimport { Options, SupportedProjectTypes, TestOptions } from '../types';\n\nimport { showAllProjectsTip } from './show-all-projects-tip';\nimport { showGradleSubProjectsTip } from './show-all-sub-projects-tip';\n\nexport function showMultiScanTip(\n projectType: SupportedProjectTypes | SupportedPackageManagers,\n options: Options & TestOptions,\n foundProjectCount?: number,\n): string {\n const gradleSubProjectsTip = showGradleSubProjectsTip(\n projectType,\n options,\n foundProjectCount,\n );\n if (gradleSubProjectsTip) {\n return gradleSubProjectsTip;\n }\n const allProjectsTip = showAllProjectsTip(\n projectType,\n options,\n foundProjectCount,\n );\n if (allProjectsTip) {\n return allProjectsTip;\n }\n return '';\n}\n","import * as fs from 'fs';\nimport * as path from 'path';\n\nexport function getFileContents(\n root: string,\n fileName: string,\n): {\n content: string;\n fileName: string;\n} {\n const fullPath = path.resolve(root, fileName);\n if (!fs.existsSync(fullPath)) {\n throw new Error(\n 'Manifest ' + fileName + ' not found at location: ' + fileName,\n );\n }\n const content = fs.readFileSync(fullPath, 'utf-8');\n return {\n content,\n fileName,\n };\n}\n","import { ParserFileType } from '@snyk/cloud-config-parser';\n\nexport type IacProjectTypes =\n | 'k8sconfig'\n | 'terraformconfig'\n | 'cloudformationconfig'\n | 'armconfig'\n | 'customconfig'\n | 'multiiacconfig';\nexport type IacFileTypes = ParserFileType | 'tf' | 'tfvars';\n\nexport enum IacProjectType {\n K8S = 'k8sconfig',\n TERRAFORM = 'terraformconfig',\n CLOUDFORMATION = 'cloudformationconfig',\n ARM = 'armconfig',\n CUSTOM = 'customconfig',\n MULTI_IAC = 'multiiacconfig',\n}\n\nexport const TEST_SUPPORTED_IAC_PROJECTS: IacProjectTypes[] = [\n IacProjectType.K8S,\n IacProjectType.TERRAFORM,\n IacProjectType.CLOUDFORMATION,\n IacProjectType.ARM,\n IacProjectType.MULTI_IAC,\n IacProjectType.CUSTOM,\n];\n\nexport const iacRemediationTypes: { [k in IacProjectTypes]?: string } = {\n armconfig: 'arm',\n cloudformationconfig: 'cloudformation',\n k8sconfig: 'kubernetes',\n terraformconfig: 'terraform',\n};\n","import { statSync } from 'fs';\nimport { dirname } from 'path';\nimport * as childProcess from 'child_process';\n\nexport function getRepositoryRootForPath(p: string) {\n return getRepositoryRoot(getWorkingDirectoryForPath(p));\n}\n\nexport function getRepositoryRoot(cwd?: string) {\n const proc = childProcess.spawnSync('git', ['rev-parse', '--show-toplevel'], {\n cwd,\n });\n if (proc.status !== 0) {\n throw new Error();\n }\n return proc.stdout.toString().trim();\n}\n\nexport function getWorkingDirectoryForPath(p: string) {\n if (statSync(p).isDirectory()) {\n return p;\n }\n return dirname(p);\n}\n","import { Options, TestOptions, MonitorOptions, PolicyOptions } from './types';\n\nexport function isMultiProjectScan(\n options: Partial<Options & TestOptions & MonitorOptions & PolicyOptions>,\n): boolean {\n return !!(options.allProjects || options.yarnWorkspaces);\n}\n","const debug = require('debug')('snyk-json');\n\n/**\n * Attempt to json-stringify an object which is potentially very large and might exceed the string limit.\n * If it does exceed the string limit, try again without pretty-print to hopefully come out below the string limit.\n * @param obj the object from which you want to get a JSON string\n */\nexport function jsonStringifyLargeObject(obj: any): string {\n let res = '';\n try {\n // first try pretty-print\n res = JSON.stringify(obj, null, 2);\n return res;\n } catch (err) {\n // if that doesn't work, try non-pretty print\n debug('JSON.stringify failed - trying again without pretty print', err);\n res = JSON.stringify(obj);\n return res;\n }\n}\n","const merge = require('lodash.merge');\nimport * as Debug from 'debug';\nimport { legacyPlugin as pluginApi } from '@snyk/cli-interface';\n\nconst debug = Debug('snyk-module-info');\n\nexport function ModuleInfo(plugin, policy) {\n return {\n async inspect(\n root,\n targetFile,\n options,\n ): Promise<pluginApi.SinglePackageResult | pluginApi.MultiProjectResult> {\n const pluginOptions = merge(\n {\n args: options._doubleDashArgs,\n },\n options,\n );\n\n debug('calling plugin inspect()', { root, targetFile, pluginOptions });\n const info = await plugin.inspect(root, targetFile, pluginOptions);\n debug('plugin inspect() done');\n\n // attach policy if not provided by plugin\n if (policy && !info.package.policy) {\n info.package.policy = policy.toString();\n }\n\n return info;\n },\n };\n}\n","import { DepTree } from '../types';\n\nexport function countTotalDependenciesInTree(depTree: DepTree): number {\n let count = 0;\n if (depTree.dependencies) {\n for (const name of Object.keys(depTree.dependencies)) {\n const dep = depTree.dependencies[name];\n if (dep) {\n count += 1 + countTotalDependenciesInTree(dep);\n }\n }\n }\n return count;\n}\n","/**\n * This is to count the number of \"contributing\" developers using Snyk on a given repo.\n * \"Contributing\" is defined as having contributed a commit in the last 90 days.\n * This is use only on the `snyk monitor` command as that is used to monitor a project's dependencies in an\n * on-going manner.\n * It collects the email of a git user and the most recent commit timestamp (both per the `git log`\n * output) and can be disabled by config (see https://snyk.io/policies/tracking-and-analytics/).\n */\nimport { exec } from 'child_process';\nimport { Contributor } from '../types';\n\nexport const SERIOUS_DELIMITER = '_SNYK_SEPARATOR_';\nexport const CONTRIBUTING_DEVELOPER_PERIOD_DAYS = 90;\n// Limit the number of commits returned from `git log` command to stay within maxBuffer limit\nexport const MAX_COMMITS_IN_GIT_LOG = 500;\n\nexport async function getContributors(\n { endDate, periodDays, repoPath } = {\n endDate: new Date(),\n periodDays: CONTRIBUTING_DEVELOPER_PERIOD_DAYS,\n repoPath: process.cwd(),\n },\n): Promise<Contributor[]> {\n const timestampStartOfContributingDeveloperPeriod = getTimestampStartOfContributingDevTimeframe(\n endDate,\n periodDays,\n );\n const gitLogResults = await runGitLog(\n timestampStartOfContributingDeveloperPeriod,\n Math.floor(endDate.getTime() / 1000),\n repoPath,\n execShell,\n );\n const stats: GitRepoCommitStats = parseGitLog(gitLogResults);\n return stats.getRepoContributors();\n}\n\nexport class GitCommitInfo {\n authorEmail: string;\n commitTimestamp: string; // use ISO 8601 format\n\n constructor(authorEmail: string, commitTimestamp: string) {\n this.authorEmail = authorEmail;\n this.commitTimestamp = commitTimestamp;\n }\n}\n\nexport class GitRepoCommitStats {\n commitInfos: GitCommitInfo[];\n\n constructor(commitInfos: GitCommitInfo[]) {\n this.commitInfos = commitInfos;\n }\n\n public static empty(): GitRepoCommitStats {\n return new GitRepoCommitStats([]);\n }\n\n public addCommitInfo(info: GitCommitInfo): void {\n this.commitInfos.push(info);\n }\n\n public getUniqueAuthorsCount(): number {\n const uniqueAuthorEmails = this.getUniqueAuthorEmails();\n return uniqueAuthorEmails.size;\n }\n\n public getCommitsCount(): number {\n return this.commitInfos.length;\n }\n\n public getUniqueAuthorEmails(): Set<string> {\n const allCommitAuthorHashedEmails: string[] = this.commitInfos.map(\n (c) => c.authorEmail,\n );\n const uniqueAuthorEmails: Set<string> = new Set(\n allCommitAuthorHashedEmails,\n );\n return uniqueAuthorEmails;\n }\n\n public getRepoContributors(): Contributor[] {\n const uniqueAuthorEmails = this.getUniqueAuthorEmails();\n const contributors: Contributor[] = [];\n for (const nextUniqueAuthorEmail of uniqueAuthorEmails) {\n const latestCommitTimestamp = this.getMostRecentCommitTimestamp(\n nextUniqueAuthorEmail,\n );\n contributors.push({\n email: nextUniqueAuthorEmail,\n lastCommitDate: latestCommitTimestamp,\n });\n }\n return contributors;\n }\n\n public getMostRecentCommitTimestamp(authorHashedEmail: string): string {\n for (const nextGI of this.commitInfos) {\n if (nextGI.authorEmail === authorHashedEmail) {\n return nextGI.commitTimestamp;\n }\n }\n return '';\n }\n}\n\nexport function parseGitLogLine(logLine: string): GitCommitInfo {\n const lineComponents = logLine.split(SERIOUS_DELIMITER);\n const authorEmail = lineComponents[2];\n const commitTimestamp = lineComponents[3];\n const commitInfo = new GitCommitInfo(authorEmail, commitTimestamp);\n return commitInfo;\n}\n\nexport function parseGitLog(gitLog: string): GitRepoCommitStats {\n if (gitLog.trim() === '') {\n return GitRepoCommitStats.empty();\n }\n const logLines = separateLines(gitLog);\n const logLineInfos: GitCommitInfo[] = logLines.map(parseGitLogLine);\n const stats: GitRepoCommitStats = new GitRepoCommitStats(logLineInfos);\n return stats;\n}\n\n/**\n * @returns time stamp in seconds-since-epoch of 90 days ago since 90 days is the \"contributing devs\" timeframe\n */\nexport function getTimestampStartOfContributingDevTimeframe(\n dNow: Date,\n timespanInDays: number = CONTRIBUTING_DEVELOPER_PERIOD_DAYS,\n): number {\n const nowUtcEpocMS = dNow.getTime();\n const nowUtcEpocS = Math.floor(nowUtcEpocMS / 1000);\n const ONE_DAY_IN_SECONDS = 86400;\n const lookbackTimespanSeconds = timespanInDays * ONE_DAY_IN_SECONDS;\n const startOfPeriodEpochSeconds = nowUtcEpocS - lookbackTimespanSeconds;\n return startOfPeriodEpochSeconds;\n}\n\nexport async function runGitLog(\n timestampEpochSecondsStartOfPeriod: number,\n timestampEpochSecondsEndOfPeriod: number,\n repoPath: string,\n fnShellout: (cmd: string, workingDirectory: string) => Promise<string>,\n): Promise<string> {\n try {\n const gitLogCommand = `git --no-pager log --pretty=tformat:\"%H${SERIOUS_DELIMITER}%an${SERIOUS_DELIMITER}%ae${SERIOUS_DELIMITER}%aI\" --after=\"${timestampEpochSecondsStartOfPeriod}\" --until=\"${timestampEpochSecondsEndOfPeriod}\" --max-count=${MAX_COMMITS_IN_GIT_LOG}`;\n const gitLogStdout: string = await fnShellout(gitLogCommand, repoPath);\n return gitLogStdout;\n } catch {\n return '';\n }\n}\n\nexport function separateLines(inputText: string): string[] {\n const linuxStyleNewLine = '\\n';\n const windowsStyleNewLine = '\\r\\n';\n const reg = new RegExp(`${linuxStyleNewLine}|${windowsStyleNewLine}`);\n const lines = inputText.trim().split(reg);\n return lines;\n}\n\nexport function execShell(\n cmd: string,\n workingDirectory: string,\n): Promise<string> {\n const options = {\n cwd: workingDirectory,\n };\n\n return new Promise((resolve, reject) => {\n exec(cmd, options, (error, stdout, stderr) => {\n if (error) {\n const exitCode = error.code;\n\n const e = new ShellOutError(\n error.message,\n exitCode,\n stdout,\n stderr,\n error,\n );\n reject(e);\n } else {\n resolve(stdout ? stdout : stderr);\n }\n });\n });\n}\n\nexport class ShellOutError extends Error {\n public innerError: Error | undefined;\n public exitCode: number | undefined;\n public stdout: string | undefined;\n public stderr: string | undefined;\n\n constructor(\n message: string,\n exitCode: number | undefined,\n stdout: string,\n stderr: string,\n innerError: Error | undefined,\n ) {\n super(message);\n this.exitCode = exitCode;\n this.stdout = stdout;\n this.stderr = stderr;\n this.innerError = innerError;\n }\n}\n","import { DepTree } from '../types';\n\nexport function dropEmptyDeps(depTree: DepTree) {\n if (depTree.dependencies) {\n const keys = Object.keys(depTree.dependencies);\n if (keys.length === 0) {\n delete depTree.dependencies;\n } else {\n for (const k of keys) {\n dropEmptyDeps(depTree.dependencies[k]);\n }\n }\n }\n return depTree;\n}\n","import { DepTree } from '../types';\n\ninterface FilteredDepTree {\n filteredDepTree: DepTree;\n missingDeps: string[];\n}\n\nexport function filterOutMissingDeps(depTree: DepTree): FilteredDepTree {\n const filteredDeps = {};\n const missingDeps: string[] = [];\n\n if (!depTree.dependencies) {\n return {\n filteredDepTree: depTree,\n missingDeps,\n };\n }\n\n for (const depKey of Object.keys(depTree.dependencies)) {\n const dep = depTree.dependencies[depKey];\n if (\n (dep as any).missingLockFileEntry ||\n ((dep as any).labels && (dep as any).labels.missingLockFileEntry)\n ) {\n // TODO(kyegupov): add field to the type\n missingDeps.push(`${dep.name}@${dep.version}`);\n } else {\n filteredDeps[depKey] = dep;\n }\n }\n const filteredDepTree: DepTree = {\n ...depTree,\n dependencies: filteredDeps,\n };\n\n return {\n filteredDepTree,\n missingDeps,\n };\n}\n","import * as Debug from 'debug';\nimport * as path from 'path';\nimport * as depGraphLib from '@snyk/dep-graph';\nimport * as snyk from '..';\nimport { apiOrOAuthTokenExists, getAuthHeader } from '../api-token';\nimport { makeRequest } from '../request';\nimport config from '../config';\nimport * as os from 'os';\nconst get = require('lodash.get');\nimport { isCI } from '../is-ci';\nimport * as analytics from '../analytics';\nimport {\n DepTree,\n MonitorMeta,\n MonitorResult,\n PolicyOptions,\n MonitorOptions,\n Options,\n Contributor,\n ProjectAttributes,\n Tag,\n} from '../types';\nimport * as projectMetadata from '../project-metadata';\nimport {\n MonitorError,\n ConnectionTimeoutError,\n FailedToRunTestError,\n errorMessageWithRetry,\n} from '../errors';\nimport { pruneGraph } from '../prune';\nimport { GRAPH_SUPPORTED_PACKAGE_MANAGERS } from '../package-managers';\nimport { countTotalDependenciesInTree } from './count-total-deps-in-tree';\nimport { filterOutMissingDeps } from './filter-out-missing-deps';\nimport { dropEmptyDeps } from './drop-empty-deps';\nimport { pruneTree } from './prune-dep-tree';\nimport { findAndLoadPolicy } from '../policy';\nimport { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';\nimport {\n CallGraph,\n CallGraphError,\n ScannedProject,\n} from '@snyk/cli-interface/legacy/common';\nimport { isGitTarget } from '../project-metadata/types';\nimport { serializeCallGraphWithMetrics } from '../reachable-vulns';\nimport {\n getNameDepTree,\n getNameDepGraph,\n getProjectName,\n getTargetFile,\n} from './utils';\nimport { countPathsToGraphRoot } from '../utils';\nimport * as alerts from '../alerts';\nimport { abridgeErrorMessage } from '../error-format';\n\nconst debug = Debug('snyk');\n\nconst ANALYTICS_PAYLOAD_MAX_LENGTH = 1024;\n\ninterface MonitorBody {\n meta: Meta;\n policy: string;\n package?: DepTree;\n callGraph?: CallGraph;\n target: {};\n targetFileRelativePath: string;\n targetFile: string;\n contributors?: Contributor[];\n}\n\ninterface Meta {\n method?: string;\n hostname: string;\n id: string;\n ci: boolean;\n pid: number;\n node: string;\n master: boolean;\n name: string;\n version: string;\n org?: string;\n pluginName: string;\n pluginRuntime: string;\n dockerImageId?: string;\n dockerBaseImage?: string;\n projectName: string;\n}\n\nexport async function monitor(\n root: string,\n meta: MonitorMeta,\n scannedProject: ScannedProject,\n options: Options & MonitorOptions & PolicyOptions,\n pluginMeta: PluginMetadata,\n targetFileRelativePath?: string,\n contributors?: Contributor[],\n projectAttributes?: ProjectAttributes,\n tags?: Tag[],\n): Promise<MonitorResult> {\n apiOrOAuthTokenExists();\n\n const packageManager = meta.packageManager;\n analytics.add('packageManager', packageManager);\n analytics.add('isDocker', !!meta.isDocker);\n\n if (scannedProject.depGraph) {\n return await monitorDepGraph(\n root,\n meta,\n scannedProject,\n pluginMeta,\n options,\n targetFileRelativePath,\n contributors,\n projectAttributes,\n tags,\n );\n }\n\n if (GRAPH_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)) {\n return await monitorDepGraphFromDepTree(\n root,\n meta,\n scannedProject,\n pluginMeta,\n options,\n targetFileRelativePath,\n contributors,\n projectAttributes,\n tags,\n );\n }\n\n return await monitorDepTree(\n root,\n meta,\n scannedProject,\n pluginMeta,\n options,\n targetFileRelativePath,\n contributors,\n projectAttributes,\n tags,\n );\n}\n\nasync function monitorDepTree(\n root: string,\n meta: MonitorMeta,\n scannedProject: ScannedProject,\n pluginMeta: PluginMetadata,\n options: MonitorOptions & PolicyOptions,\n targetFileRelativePath?: string,\n contributors?: Contributor[],\n projectAttributes?: ProjectAttributes,\n tags?: Tag[],\n): Promise<MonitorResult> {\n let treeMissingDeps: string[] = [];\n\n const packageManager = meta.packageManager;\n\n let depTree = scannedProject.depTree;\n\n if (!depTree) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your monitor request could not be completed.'),\n );\n }\n\n let prePruneDepCount;\n if (meta.prune) {\n debug('prune used, counting total dependencies');\n prePruneDepCount = countTotalDependenciesInTree(depTree);\n analytics.add('prePruneDepCount', prePruneDepCount);\n debug('total dependencies: %d', prePruneDepCount);\n debug('pruning dep tree');\n depTree = await pruneTree(depTree, meta.packageManager);\n debug('finished pruning dep tree');\n }\n if (['npm', 'yarn'].includes(meta.packageManager)) {\n const { filteredDepTree, missingDeps } = filterOutMissingDeps(depTree);\n depTree = filteredDepTree;\n treeMissingDeps = missingDeps;\n }\n\n let targetFileDir;\n\n if (targetFileRelativePath) {\n const { dir } = path.parse(targetFileRelativePath);\n targetFileDir = dir;\n }\n\n const policy = await findAndLoadPolicy(\n root,\n meta.isDocker ? 'docker' : packageManager!,\n options,\n depTree,\n targetFileDir,\n );\n\n const target = await projectMetadata.getInfo(scannedProject, meta, depTree);\n\n if (isGitTarget(target) && target.branch) {\n analytics.add('targetBranch', target.branch);\n }\n\n depTree = dropEmptyDeps(depTree);\n\n let callGraphPayload;\n if (\n options.reachableVulns &&\n (scannedProject.callGraph as CallGraphError)?.innerError\n ) {\n const err = scannedProject.callGraph as CallGraphError;\n analytics.add(\n 'callGraphError',\n abridgeErrorMessage(\n err.innerError.toString(),\n ANALYTICS_PAYLOAD_MAX_LENGTH,\n ),\n );\n alerts.registerAlerts([\n {\n type: 'error',\n name: 'missing-call-graph',\n msg: err.message,\n },\n ]);\n } else if (scannedProject.callGraph) {\n const { callGraph, nodeCount, edgeCount } = serializeCallGraphWithMetrics(\n scannedProject.callGraph as CallGraph,\n );\n debug(\n `Adding call graph to payload, node count: ${nodeCount}, edge count: ${edgeCount}`,\n );\n\n const callGraphMetrics = get(pluginMeta, 'meta.callGraphMetrics', {});\n analytics.add('callGraphMetrics', {\n callGraphEdgeCount: edgeCount,\n callGraphNodeCount: nodeCount,\n ...callGraphMetrics,\n });\n callGraphPayload = callGraph;\n }\n\n if (!depTree) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your monitor request could not be completed.'),\n );\n }\n\n const { res, body } = await makeRequest({\n body: {\n meta: {\n method: meta.method,\n hostname: os.hostname(),\n id: snyk.id || depTree.name,\n ci: isCI(),\n pid: process.pid,\n node: process.version,\n master: snyk.config.isMaster,\n name: getNameDepTree(scannedProject, depTree, meta),\n version: depTree.version,\n org: config.org ? decodeURIComponent(config.org) : undefined,\n pluginName: pluginMeta.name,\n pluginRuntime: pluginMeta.runtime,\n missingDeps: treeMissingDeps,\n dockerImageId: pluginMeta.dockerImageId,\n dockerBaseImage: depTree.docker ? depTree.docker.baseImage : undefined,\n dockerfileLayers: depTree.docker\n ? depTree.docker.dockerfileLayers\n : undefined,\n projectName: getProjectName(scannedProject, meta),\n prePruneDepCount, // undefined unless 'prune' is used,\n monitorGraph: false,\n versionBuildInfo: JSON.stringify(scannedProject.meta?.versionBuildInfo),\n gradleProjectName: scannedProject.meta?.gradleProjectName,\n platform: scannedProject.meta?.platform,\n },\n policy: policy ? policy.toString() : undefined,\n package: depTree,\n callGraph: callGraphPayload,\n // we take the targetFile from the plugin,\n // because we want to send it only for specific package-managers\n target,\n // WARNING: be careful changing this as it affects project uniqueness\n targetFile: getTargetFile(scannedProject, pluginMeta),\n targetFileRelativePath,\n targetReference: meta.targetReference,\n contributors,\n projectAttributes,\n tags,\n } as MonitorBody,\n gzip: true,\n method: 'PUT',\n headers: {\n authorization: getAuthHeader(),\n 'content-encoding': 'gzip',\n },\n url: config.API + '/monitor/' + packageManager,\n json: true,\n });\n\n if (res.statusCode && res.statusCode >= 200 && res.statusCode <= 299) {\n return body as MonitorResult;\n } else {\n const userMessage = body && body.userMessage;\n if (!userMessage && res.statusCode === 504) {\n throw new ConnectionTimeoutError();\n } else {\n throw new MonitorError(res.statusCode, userMessage);\n }\n }\n}\n\nexport async function monitorDepGraph(\n root: string,\n meta: MonitorMeta,\n scannedProject: ScannedProject,\n pluginMeta: PluginMetadata,\n options: MonitorOptions & PolicyOptions,\n targetFileRelativePath?: string,\n contributors?: Contributor[],\n projectAttributes?: ProjectAttributes,\n tags?: Tag[],\n): Promise<MonitorResult> {\n const packageManager = meta.packageManager;\n analytics.add('monitorDepGraph', true);\n\n let depGraph = scannedProject.depGraph;\n\n if (!depGraph) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n 'Your monitor request could not be completed. ',\n );\n }\n\n let targetFileDir;\n\n if (targetFileRelativePath) {\n const { dir } = path.parse(targetFileRelativePath);\n targetFileDir = dir;\n }\n\n const policy = await findAndLoadPolicy(\n root,\n meta.isDocker ? 'docker' : packageManager!,\n options,\n undefined,\n targetFileDir,\n );\n\n const target = await projectMetadata.getInfo(scannedProject, meta);\n if (isGitTarget(target) && target.branch) {\n analytics.add('targetBranch', target.branch);\n }\n\n const pruneIsRequired = options.pruneRepeatedSubdependencies;\n depGraph = await pruneGraph(depGraph, packageManager, pruneIsRequired);\n\n let callGraphPayload;\n if (\n options.reachableVulns &&\n (scannedProject.callGraph as CallGraphError)?.innerError\n ) {\n const err = scannedProject.callGraph as CallGraphError;\n analytics.add(\n 'callGraphError',\n abridgeErrorMessage(\n err.innerError.toString(),\n ANALYTICS_PAYLOAD_MAX_LENGTH,\n ),\n );\n alerts.registerAlerts([\n {\n type: 'error',\n name: 'missing-call-graph',\n msg: err.message,\n },\n ]);\n } else if (scannedProject.callGraph) {\n const { callGraph, nodeCount, edgeCount } = serializeCallGraphWithMetrics(\n scannedProject.callGraph as CallGraph,\n );\n debug(\n `Adding call graph to payload, node count: ${nodeCount}, edge count: ${edgeCount}`,\n );\n\n const callGraphMetrics = get(pluginMeta, 'meta.callGraphMetrics', {});\n analytics.add('callGraphMetrics', {\n callGraphEdgeCount: edgeCount,\n callGraphNodeCount: nodeCount,\n ...callGraphMetrics,\n });\n callGraphPayload = callGraph;\n }\n\n if (!depGraph) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your monitor request could not be completed.'),\n );\n }\n\n const { res, body } = await makeRequest({\n body: {\n meta: {\n method: meta.method,\n hostname: os.hostname(),\n id: snyk.id || depGraph.rootPkg.name,\n ci: isCI(),\n pid: process.pid,\n node: process.version,\n master: snyk.config.isMaster,\n name: getNameDepGraph(scannedProject, depGraph, meta),\n version: depGraph.rootPkg.version,\n org: config.org ? decodeURIComponent(config.org) : undefined,\n pluginName: pluginMeta.name,\n pluginRuntime: pluginMeta.runtime,\n projectName: getProjectName(scannedProject, meta),\n monitorGraph: true,\n versionBuildInfo: JSON.stringify(scannedProject.meta?.versionBuildInfo),\n gradleProjectName: scannedProject.meta?.gradleProjectName,\n },\n policy: policy ? policy.toString() : undefined,\n depGraphJSON: depGraph, // depGraph will be auto serialized to JSON on send\n // we take the targetFile from the plugin,\n // because we want to send it only for specific package-managers\n target,\n targetFile: getTargetFile(scannedProject, pluginMeta),\n targetFileRelativePath,\n targetReference: meta.targetReference,\n contributors,\n callGraph: callGraphPayload,\n projectAttributes,\n tags,\n } as MonitorBody,\n gzip: true,\n method: 'PUT',\n headers: {\n authorization: getAuthHeader(),\n 'content-encoding': 'gzip',\n },\n url: `${config.API}/monitor/${packageManager}/graph`,\n json: true,\n });\n\n if (res.statusCode && res.statusCode >= 200 && res.statusCode <= 299) {\n return body as MonitorResult;\n } else {\n const userMessage = body && body.userMessage;\n if (!userMessage && res.statusCode === 504) {\n throw new ConnectionTimeoutError();\n } else {\n throw new MonitorError(res.statusCode, userMessage);\n }\n }\n}\n\nasync function monitorDepGraphFromDepTree(\n root: string,\n meta: MonitorMeta,\n scannedProject: ScannedProject,\n pluginMeta: PluginMetadata,\n options: MonitorOptions & PolicyOptions,\n targetFileRelativePath?: string,\n contributors?: Contributor[],\n projectAttributes?: ProjectAttributes,\n tags?: Tag[],\n): Promise<MonitorResult> {\n const packageManager = meta.packageManager;\n\n let treeMissingDeps: string[] | undefined;\n let depTree = scannedProject.depTree;\n\n if (!depTree) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your monitor request could not be completed'),\n );\n }\n\n let targetFileDir;\n\n if (targetFileRelativePath) {\n const { dir } = path.parse(targetFileRelativePath);\n targetFileDir = dir;\n }\n\n const policy = await findAndLoadPolicy(\n root,\n meta.isDocker ? 'docker' : packageManager!,\n options,\n // TODO: fix this and send only send when we used resolve-deps for node\n // it should be a ExpandedPkgTree type instead\n depTree,\n targetFileDir,\n );\n\n if (['npm', 'yarn'].includes(meta.packageManager)) {\n const { filteredDepTree, missingDeps } = filterOutMissingDeps(depTree);\n depTree = filteredDepTree;\n treeMissingDeps = missingDeps;\n }\n\n const depGraph: depGraphLib.DepGraph = await depGraphLib.legacy.depTreeToGraph(\n depTree,\n packageManager,\n );\n const target = await projectMetadata.getInfo(scannedProject, meta, depTree);\n\n if (isGitTarget(target) && target.branch) {\n analytics.add('targetBranch', target.branch);\n }\n\n let prunedGraph = depGraph;\n let prePruneDepCount;\n if (meta.prune) {\n debug('Trying to prune the graph');\n prePruneDepCount = countPathsToGraphRoot(depGraph);\n debug('pre prunedPathsCount: ' + prePruneDepCount);\n prunedGraph = await pruneGraph(depGraph, packageManager, meta.prune);\n }\n\n if (!depTree) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your monitor request could not be completed.'),\n );\n }\n const { res, body } = await makeRequest({\n body: {\n meta: {\n method: meta.method,\n hostname: os.hostname(),\n id: snyk.id || depTree.name,\n ci: isCI(),\n pid: process.pid,\n node: process.version,\n master: snyk.config.isMaster,\n name: getNameDepGraph(scannedProject, depGraph, meta),\n version: depGraph.rootPkg.version,\n org: config.org ? decodeURIComponent(config.org) : undefined,\n pluginName: pluginMeta.name,\n pluginRuntime: pluginMeta.runtime,\n dockerImageId: pluginMeta.dockerImageId,\n dockerBaseImage: depTree.docker ? depTree.docker.baseImage : undefined,\n dockerfileLayers: depTree.docker\n ? depTree.docker.dockerfileLayers\n : undefined,\n projectName: getProjectName(scannedProject, meta),\n prePruneDepCount, // undefined unless 'prune' is used\n missingDeps: treeMissingDeps,\n monitorGraph: true,\n },\n policy: policy ? policy.toString() : undefined,\n depGraphJSON: prunedGraph, // depGraph will be auto serialized to JSON on send\n // we take the targetFile from the plugin,\n // because we want to send it only for specific package-managers\n target,\n targetFile: getTargetFile(scannedProject, pluginMeta),\n targetFileRelativePath,\n targetReference: meta.targetReference,\n contributors,\n projectAttributes,\n tags,\n } as MonitorBody,\n gzip: true,\n method: 'PUT',\n headers: {\n authorization: getAuthHeader(),\n 'content-encoding': 'gzip',\n },\n url: `${config.API}/monitor/${packageManager}/graph`,\n json: true,\n });\n\n if (res.statusCode && res.statusCode >= 200 && res.statusCode <= 299) {\n return body as MonitorResult;\n } else {\n const userMessage = body && body.userMessage;\n if (!userMessage && res.statusCode === 504) {\n throw new ConnectionTimeoutError();\n } else {\n throw new MonitorError(res.statusCode, userMessage);\n }\n }\n}\n","import * as depGraphLib from '@snyk/dep-graph';\nimport { DepTree } from '../types';\n\nexport async function pruneTree(\n tree: DepTree,\n packageManagerName: string,\n): Promise<DepTree> {\n // Pruning requires conversion to the graph first.\n // This is slow.\n const graph = await depGraphLib.legacy.depTreeToGraph(\n tree,\n packageManagerName,\n );\n const prunedTree: DepTree = (await depGraphLib.legacy.graphToDepTree(\n graph,\n packageManagerName,\n { deduplicateWithinTopLevelDeps: true },\n )) as DepTree;\n // Transplant pruned dependencies in the original tree (we want to keep all other fields):\n tree.dependencies = prunedTree.dependencies;\n return tree;\n}\n","import { ScannedProject, DepTree } from '@snyk/cli-interface/legacy/common';\nimport {\n getContainerTargetFile,\n getContainerProjectName,\n getContainerName,\n isContainer,\n} from '../container';\nimport * as depGraphLib from '@snyk/dep-graph';\nimport { MonitorMeta } from '../types';\nimport { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';\n\nexport function getNameDepTree(\n scannedProject: ScannedProject,\n depTree: DepTree,\n meta: MonitorMeta,\n): string | undefined {\n if (isContainer(scannedProject)) {\n return getContainerName(scannedProject, meta);\n }\n return depTree.name;\n}\n\nexport function getNameDepGraph(\n scannedProject: ScannedProject,\n depGraph: depGraphLib.DepGraph,\n meta: MonitorMeta,\n): string | undefined {\n if (isContainer(scannedProject)) {\n return getContainerName(scannedProject, meta);\n }\n return depGraph.rootPkg?.name;\n}\n\nexport function getProjectName(\n scannedProject: ScannedProject,\n meta: MonitorMeta,\n): string | undefined {\n if (isContainer(scannedProject)) {\n return getContainerProjectName(scannedProject, meta);\n }\n\n if (meta['project-name'] && scannedProject.meta?.projectName) {\n return scannedProject.meta.projectName;\n }\n\n return meta['project-name'];\n}\n\nexport function getTargetFile(\n scannedProject: ScannedProject,\n pluginMeta: PluginMetadata,\n): string | undefined {\n if (isContainer(scannedProject)) {\n return getContainerTargetFile(scannedProject);\n }\n return pluginMeta.targetFile;\n}\n","import { MonitorOptions, Options, TestOptions } from './types';\nimport config from './config';\nimport { SupportedPackageManagers } from './package-managers';\nimport * as reachableVulns from './reachable-vulns';\nimport { isMultiProjectScan } from './is-multi-project-scan';\nimport { FeatureNotSupportedByPackageManagerError } from './errors';\nimport * as alerts from './alerts';\n\nexport async function validateOptions(\n options: (Options & TestOptions) | (Options & MonitorOptions),\n packageManager?: SupportedPackageManagers,\n): Promise<void> {\n if (options.reachableVulns) {\n alerts.registerAlerts([\n {\n type: 'warning',\n name: 'reachable deprecation',\n msg: reachableVulns.reachableVulnsRemovalMessage,\n },\n ]);\n }\n\n if (options.reachableVulns) {\n // Throwing error only in case when both packageManager and allProjects not defined\n if (!packageManager && !isMultiProjectScan(options)) {\n throw new Error('Could not determine package manager');\n }\n const org = options.org || config.org;\n\n try {\n await reachableVulns.validatePayload(org, options, packageManager);\n } catch (err) {\n if (\n err instanceof FeatureNotSupportedByPackageManagerError &&\n err.feature === 'Reachable vulns' &&\n err.userMessage\n ) {\n alerts.registerAlerts([\n {\n type: 'error',\n name: 'pkgman-not-supported',\n msg: err.userMessage,\n },\n ]);\n } else {\n throw err;\n }\n }\n }\n}\n","import { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { MultiProjectResultCustom } from './get-multi-plugin-result';\nimport { convertScannedProjectsToCustom } from './convert-scanned-projects-to-custom';\nimport { SupportedPackageManagers } from '../package-managers';\n\nexport function convertMultiResultToMultiCustom(\n inspectRes: pluginApi.MultiProjectResult,\n packageManager?: SupportedPackageManagers,\n targetFile?: string,\n): MultiProjectResultCustom {\n // convert all results from the same plugin to MultiProjectResultCustom\n // and annotate each scannedProject with packageManager\n return {\n plugin: inspectRes.plugin,\n scannedProjects: convertScannedProjectsToCustom(\n inspectRes.scannedProjects,\n inspectRes.plugin,\n (inspectRes.plugin.packageManager as SupportedPackageManagers) ||\n packageManager,\n targetFile,\n ),\n };\n}\n","import * as cliInterface from '@snyk/cli-interface';\nimport { ScannedProjectCustom } from './get-multi-plugin-result';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';\n\nexport function convertScannedProjectsToCustom(\n scannedProjects: cliInterface.legacyCommon.ScannedProject[],\n pluginMeta: PluginMetadata,\n packageManager?: SupportedPackageManagers,\n targetFile?: string,\n): ScannedProjectCustom[] {\n // annotate the package manager & targetFile to be used\n // for test & monitor\n return scannedProjects.map((a) => {\n (a as ScannedProjectCustom).plugin =\n (a as ScannedProjectCustom).plugin || pluginMeta;\n (a as ScannedProjectCustom).targetFile = a.targetFile || targetFile;\n (a as ScannedProjectCustom).packageManager = (a as ScannedProjectCustom)\n .packageManager\n ? (a as ScannedProjectCustom).packageManager\n : (packageManager as SupportedPackageManagers);\n (a as ScannedProjectCustom).meta = a.meta;\n return a as ScannedProjectCustom;\n });\n}\n","import { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { MultiProjectResultCustom } from './get-multi-plugin-result';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { CallGraph } from '@snyk/cli-interface/legacy/common';\n\nexport function convertSingleResultToMultiCustom(\n inspectRes: pluginApi.SinglePackageResult,\n packageManager?: SupportedPackageManagers,\n): MultiProjectResultCustom {\n if (!packageManager) {\n packageManager = inspectRes.plugin\n .packageManager as SupportedPackageManagers;\n }\n if (inspectRes.dependencyGraph) {\n return convertDepGraphResult(inspectRes, packageManager);\n } else {\n return convertDepTreeResult(inspectRes, packageManager);\n }\n}\n\nfunction convertDepGraphResult(\n inspectRes: pluginApi.SinglePackageResult,\n packageManager: SupportedPackageManagers,\n): MultiProjectResultCustom {\n const { plugin, meta, dependencyGraph: depGraph, callGraph } = inspectRes;\n return {\n plugin,\n scannedProjects: [\n {\n plugin: plugin as any,\n depGraph,\n callGraph: callGraph as CallGraph,\n meta,\n targetFile: plugin.targetFile,\n packageManager,\n },\n ],\n };\n}\n\n/**\n * @deprecated @boost: delete me when all languages uses depGraph\n */\nfunction convertDepTreeResult(\n inspectRes: pluginApi.SinglePackageResult,\n packageManager: SupportedPackageManagers,\n): MultiProjectResultCustom {\n if (\n inspectRes.package &&\n !inspectRes.package.targetFile &&\n inspectRes.plugin\n ) {\n inspectRes.package.targetFile = inspectRes.plugin.targetFile;\n }\n const { plugin, meta, package: depTree, callGraph } = inspectRes;\n\n if (depTree && !depTree.targetFile && plugin) {\n depTree.targetFile = plugin.targetFile;\n }\n\n return {\n plugin,\n scannedProjects: [\n {\n plugin: plugin as any,\n depTree,\n callGraph: callGraph as CallGraph,\n meta,\n targetFile: plugin.targetFile,\n packageManager,\n },\n ],\n };\n}\n","import * as cliInterface from '@snyk/cli-interface';\nimport { ScannedProjectCustom } from './get-multi-plugin-result';\nimport { SupportedPackageManagers } from '../package-managers';\n\nexport function extractPackageManager(\n scannedProject: ScannedProjectCustom,\n pluginRes: cliInterface.legacyPlugin.MultiProjectResult,\n options: {\n packageManager?: SupportedPackageManagers;\n },\n): SupportedPackageManagers | undefined {\n // try and use the package Manager from the plugin\n // result if present\n const packageManager =\n scannedProject.packageManager ||\n (pluginRes.plugin && pluginRes.plugin.packageManager);\n\n if (packageManager) {\n return packageManager;\n }\n\n if (!packageManager && options.packageManager) {\n // fallback to Options packageManager\n return options.packageManager;\n }\n\n // for example: docker\n return undefined;\n}\n","import * as debugModule from 'debug';\nimport * as pathLib from 'path';\nimport chalk from 'chalk';\nimport { icon } from '../theme';\nimport { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { find } from '../find-files';\nimport { Options, TestOptions, MonitorOptions } from '../types';\nimport { NoSupportedManifestsFoundError } from '../errors';\nimport {\n getMultiPluginResult,\n MultiProjectResultCustom,\n} from './get-multi-plugin-result';\nimport { getSinglePluginResult } from './get-single-plugin-result';\nimport {\n detectPackageFile,\n AUTO_DETECTABLE_FILES,\n detectPackageManagerFromFile,\n} from '../detect';\nimport analytics = require('../analytics');\nimport { convertSingleResultToMultiCustom } from './convert-single-splugin-res-to-multi-custom';\nimport { convertMultiResultToMultiCustom } from './convert-multi-plugin-res-to-multi-custom';\nimport { processYarnWorkspaces } from './nodejs-plugin/yarn-workspaces-parser';\nimport { ScannedProject } from '@snyk/cli-interface/legacy/common';\n\nconst debug = debugModule('snyk-test');\n\nconst multiProjectProcessors = {\n yarnWorkspaces: {\n handler: processYarnWorkspaces,\n files: ['package.json'],\n },\n allProjects: {\n handler: getMultiPluginResult,\n files: AUTO_DETECTABLE_FILES,\n },\n};\n\n// Force getDepsFromPlugin to return scannedProjects for processing\nexport async function getDepsFromPlugin(\n root: string,\n options: Options & (TestOptions | MonitorOptions),\n): Promise<pluginApi.MultiProjectResult | MultiProjectResultCustom> {\n let inspectRes: pluginApi.InspectResult;\n\n if (Object.keys(multiProjectProcessors).some((key) => options[key])) {\n const scanType = options.yarnWorkspaces ? 'yarnWorkspaces' : 'allProjects';\n const levelsDeep = options.detectionDepth;\n const ignore = options.exclude ? options.exclude.split(',') : [];\n const { files: targetFiles, allFilesFound } = await find(\n root,\n ignore,\n multiProjectProcessors[scanType].files,\n levelsDeep,\n );\n debug(\n `auto detect manifest files, found ${targetFiles.length}`,\n targetFiles,\n );\n if (targetFiles.length === 0) {\n throw NoSupportedManifestsFoundError([root]);\n }\n // enable full sub-project scan for gradle\n options.allSubProjects = true;\n inspectRes = await multiProjectProcessors[scanType].handler(\n root,\n options,\n targetFiles,\n );\n const scannedProjects = inspectRes.scannedProjects;\n const analyticData = {\n scannedProjects: scannedProjects.length,\n targetFiles,\n packageManagers: targetFiles.map((file) =>\n detectPackageManagerFromFile(file),\n ),\n levelsDeep,\n ignore,\n };\n analytics.add(scanType, analyticData);\n debug(\n `Found ${scannedProjects.length} projects from ${allFilesFound.length} detected manifests`,\n );\n const userWarningMessage = warnSomeGradleManifestsNotScanned(\n scannedProjects,\n allFilesFound,\n root,\n );\n\n if (!options.json && !options.quiet && userWarningMessage) {\n console.warn(chalk.bold.red(userWarningMessage));\n }\n return inspectRes;\n }\n\n // TODO: is this needed for the auto detect handling above?\n // don't override options.file if scanning multiple files at once\n if (!options.scanAllUnmanaged) {\n options.file = options.file || detectPackageFile(root);\n }\n if (!options.docker && !(options.file || options.packageManager)) {\n throw NoSupportedManifestsFoundError([...root]);\n }\n inspectRes = await getSinglePluginResult(root, options);\n\n if (!pluginApi.isMultiResult(inspectRes)) {\n if (!inspectRes.package && !inspectRes.dependencyGraph) {\n // something went wrong if both are not present...\n throw Error(\n `error getting dependencies from ${\n options.docker ? 'docker' : options.packageManager\n } ` + \"plugin: neither 'package' nor 'scannedProjects' were found\",\n );\n }\n\n return convertSingleResultToMultiCustom(inspectRes, options.packageManager);\n }\n // We are using \"options\" to store some information returned from plugin that we need to use later,\n // but don't want to send to Registry in the Payload.\n // TODO(kyegupov): decouple inspect and payload so that we don't need this hack\n (options as any).projectNames = inspectRes.scannedProjects.map(\n (scannedProject) => scannedProject?.depTree?.name,\n );\n return convertMultiResultToMultiCustom(inspectRes, options.packageManager);\n}\n\nexport function warnSomeGradleManifestsNotScanned(\n scannedProjects: ScannedProject[],\n allFilesFound: string[],\n root: string,\n): string | null {\n const gradleTargetFilesFilter = (targetFile) =>\n targetFile &&\n (targetFile.endsWith('build.gradle') ||\n targetFile.endsWith('build.gradle.kts'));\n const scannedGradleFiles = scannedProjects\n .map((p) => {\n const targetFile = p.meta?.targetFile || p.targetFile;\n return targetFile ? pathLib.resolve(root, targetFile) : null;\n })\n .filter(gradleTargetFilesFilter);\n const detectedGradleFiles = allFilesFound.filter(gradleTargetFilesFilter);\n const diff = detectedGradleFiles.filter(\n (file) => !scannedGradleFiles.includes(file),\n );\n\n if (diff.length > 0) {\n debug(\n `These Gradle manifests did not return any dependency results:\\n${diff.join(\n ',\\n',\n )}`,\n );\n return `${icon.ISSUE} ${diff.length}/${detectedGradleFiles.length} detected Gradle manifests did not return dependencies. They may have errored or were not included as part of a multi-project build. You may need to scan them individually with --file=path/to/file. Run with \\`-d\\` for more info.`;\n }\n return null;\n}\n","import { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { find } from '../find-files';\nimport { AUTO_DETECTABLE_FILES } from '../detect';\nimport { Options } from '../types';\n\nexport async function getExtraProjectCount(\n root: string,\n options: Options,\n inspectResult: pluginApi.InspectResult,\n): Promise<number | undefined> {\n if (options.docker || options.unmanaged) {\n return undefined;\n }\n if (\n inspectResult.plugin.meta &&\n inspectResult.plugin.meta.allSubProjectNames &&\n inspectResult.plugin.meta.allSubProjectNames.length > 0\n ) {\n return inspectResult.plugin.meta.allSubProjectNames.length;\n }\n try {\n const { files: extraTargetFiles } = await find(\n root,\n [],\n AUTO_DETECTABLE_FILES,\n );\n const foundProjectsCount =\n extraTargetFiles.length > 1 ? extraTargetFiles.length - 1 : undefined;\n return foundProjectsCount;\n } catch (e) {\n return undefined;\n }\n}\n","import * as cloneDeep from 'lodash.clonedeep';\nimport * as pathLib from 'path';\nimport * as cliInterface from '@snyk/cli-interface';\nimport chalk from 'chalk';\nimport { icon } from '../theme';\nimport * as debugModule from 'debug';\n\nimport { TestOptions, Options, MonitorOptions } from '../types';\nimport { detectPackageManagerFromFile } from '../detect';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { getSinglePluginResult } from './get-single-plugin-result';\nimport { convertSingleResultToMultiCustom } from './convert-single-splugin-res-to-multi-custom';\nimport { convertMultiResultToMultiCustom } from './convert-multi-plugin-res-to-multi-custom';\nimport { PluginMetadata } from '@snyk/cli-interface/legacy/plugin';\nimport { CallGraph } from '@snyk/cli-interface/legacy/common';\nimport { errorMessageWithRetry, FailedToRunTestError } from '../errors';\nimport { processYarnWorkspaces } from './nodejs-plugin/yarn-workspaces-parser';\n\nconst debug = debugModule('snyk-test');\nexport interface ScannedProjectCustom\n extends cliInterface.legacyCommon.ScannedProject {\n packageManager: SupportedPackageManagers;\n plugin: PluginMetadata;\n callGraph?: CallGraph;\n}\n\ninterface FailedProjectScanError {\n targetFile?: string;\n error?: Error;\n errMessage: string;\n}\nexport interface MultiProjectResultCustom\n extends cliInterface.legacyPlugin.MultiProjectResult {\n scannedProjects: ScannedProjectCustom[];\n failedResults?: FailedProjectScanError[];\n}\n\nexport async function getMultiPluginResult(\n root: string,\n options: Options & (TestOptions | MonitorOptions),\n targetFiles: string[],\n): Promise<MultiProjectResultCustom> {\n const allResults: ScannedProjectCustom[] = [];\n const failedResults: FailedProjectScanError[] = [];\n\n // process any yarn workspaces first\n // the files need to be proceeded together as they provide context to each other\n const {\n scannedProjects,\n unprocessedFiles,\n } = await processYarnWorkspacesProjects(root, options, targetFiles);\n allResults.push(...scannedProjects);\n debug(`Not part of a workspace: ${unprocessedFiles.join(', ')}}`);\n // process the rest 1 by 1 sent to relevant plugins\n for (const targetFile of unprocessedFiles) {\n const optionsClone = cloneDeep(options);\n optionsClone.file = pathLib.relative(root, targetFile);\n optionsClone.packageManager = detectPackageManagerFromFile(\n pathLib.basename(targetFile),\n );\n try {\n const inspectRes = await getSinglePluginResult(\n root,\n optionsClone,\n optionsClone.file,\n );\n let resultWithScannedProjects: cliInterface.legacyPlugin.MultiProjectResult;\n\n if (!cliInterface.legacyPlugin.isMultiResult(inspectRes)) {\n resultWithScannedProjects = convertSingleResultToMultiCustom(\n inspectRes,\n optionsClone.packageManager,\n );\n } else {\n resultWithScannedProjects = inspectRes;\n }\n\n const pluginResultWithCustomScannedProjects = convertMultiResultToMultiCustom(\n resultWithScannedProjects,\n optionsClone.packageManager,\n optionsClone.file,\n );\n // annotate the package manager, project name & targetFile to be used\n // for test & monitor\n // TODO: refactor how we display meta to not have to do this\n (options as any).projectNames = resultWithScannedProjects.scannedProjects.map(\n (scannedProject) => scannedProject?.depTree?.name,\n );\n\n allResults.push(...pluginResultWithCustomScannedProjects.scannedProjects);\n } catch (error) {\n const errMessage =\n error.message ?? 'Something went wrong getting dependencies';\n // TODO: propagate this all the way back and include in --json output\n failedResults.push({\n targetFile,\n error,\n errMessage: errMessage,\n });\n debug(\n chalk.bold.red(\n `\\n${icon.ISSUE} Failed to get dependencies for ${targetFile}\\nERROR: ${errMessage}\\n`,\n ),\n );\n }\n }\n\n if (!allResults.length) {\n throw new FailedToRunTestError(\n errorMessageWithRetry(\n `Failed to get dependencies for all ${targetFiles.length} potential projects.`,\n ),\n );\n }\n\n return {\n plugin: {\n name: 'custom-auto-detect',\n },\n scannedProjects: allResults,\n failedResults,\n };\n}\n\nasync function processYarnWorkspacesProjects(\n root: string,\n options: Options & (TestOptions | MonitorOptions),\n targetFiles: string[],\n): Promise<{\n scannedProjects: ScannedProjectCustom[];\n unprocessedFiles: string[];\n}> {\n try {\n const { scannedProjects } = await processYarnWorkspaces(\n root,\n {\n strictOutOfSync: options.strictOutOfSync,\n dev: options.dev,\n },\n targetFiles,\n );\n\n const unprocessedFiles = filterOutProcessedWorkspaces(\n root,\n scannedProjects,\n targetFiles,\n );\n return { scannedProjects, unprocessedFiles };\n } catch (e) {\n debug('Error during detecting or processing Yarn Workspaces: ', e);\n return { scannedProjects: [], unprocessedFiles: targetFiles };\n }\n}\n\nexport function filterOutProcessedWorkspaces(\n root: string,\n scannedProjects: ScannedProjectCustom[],\n allTargetFiles: string[],\n): string[] {\n const targetFiles: string[] = [];\n\n const scanned = scannedProjects\n .map((p) => p.targetFile!)\n .map((p) => pathLib.resolve(process.cwd(), root, p));\n const all = allTargetFiles.map((p) => ({\n path: pathLib.resolve(process.cwd(), root, p),\n original: p,\n }));\n\n for (const entry of all) {\n const { path, original } = entry;\n const { base } = pathLib.parse(path);\n\n if (!['package.json', 'yarn.lock'].includes(base)) {\n targetFiles.push(original);\n continue;\n }\n // standardise to package.json\n // we discover the lockfiles but targetFile is package.json\n if (!scanned.includes(path.replace('yarn.lock', 'package.json'))) {\n targetFiles.push(original);\n continue;\n }\n }\n return targetFiles;\n}\n","import plugins = require('.');\nimport { ModuleInfo } from '../module-info';\nimport { legacyPlugin as pluginApi } from '@snyk/cli-interface';\nimport { TestOptions, Options, MonitorOptions } from '../types';\n\nexport async function getSinglePluginResult(\n root: string,\n options: Options & (TestOptions | MonitorOptions),\n targetFile?: string,\n): Promise<pluginApi.InspectResult> {\n const plugin = plugins.loadPlugin(options.packageManager);\n const moduleInfo = ModuleInfo(plugin, options.policy);\n const inspectRes: pluginApi.InspectResult = await moduleInfo.inspect(\n root,\n targetFile || options.file,\n { ...options },\n );\n return inspectRes;\n}\n","import * as rubygemsPlugin from './rubygems';\nimport * as mvnPlugin from 'snyk-mvn-plugin';\nimport * as gradlePlugin from 'snyk-gradle-plugin';\nimport * as sbtPlugin from 'snyk-sbt-plugin';\nimport * as pythonPlugin from 'snyk-python-plugin';\nimport * as goPlugin from 'snyk-go-plugin';\nimport * as nugetPlugin from 'snyk-nuget-plugin';\nimport * as phpPlugin from 'snyk-php-plugin';\nimport * as nodejsPlugin from './nodejs-plugin';\nimport * as cocoapodsPlugin from '@snyk/snyk-cocoapods-plugin';\nimport * as hexPlugin from '@snyk/snyk-hex-plugin';\nimport * as types from './types';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { UnsupportedPackageManagerError } from '../errors';\n\nexport function loadPlugin(\n packageManager: SupportedPackageManagers | undefined,\n): types.Plugin {\n switch (packageManager) {\n case 'npm': {\n return nodejsPlugin;\n }\n case 'rubygems': {\n return rubygemsPlugin;\n }\n case 'maven': {\n return mvnPlugin;\n }\n case 'gradle': {\n return gradlePlugin;\n }\n case 'sbt': {\n return sbtPlugin;\n }\n case 'yarn': {\n return nodejsPlugin;\n }\n case 'pip':\n case 'poetry': {\n return pythonPlugin;\n }\n case 'golangdep':\n case 'gomodules':\n case 'govendor': {\n return goPlugin;\n }\n case 'nuget': {\n return nugetPlugin;\n }\n case 'paket': {\n return nugetPlugin;\n }\n case 'composer': {\n return phpPlugin;\n }\n case 'cocoapods': {\n return cocoapodsPlugin;\n }\n case 'hex': {\n return hexPlugin;\n }\n default: {\n throw new UnsupportedPackageManagerError(packageManager);\n }\n }\n}\n","import * as modulesParser from './npm-modules-parser';\nimport * as lockParser from './npm-lock-parser';\nimport * as types from '../types';\nimport * as analytics from '../../analytics';\nimport { MissingTargetFileError } from '../../errors/missing-targetfile-error';\nimport { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin';\n\nexport async function inspect(\n root: string,\n targetFile: string,\n options: types.Options = {},\n): Promise<MultiProjectResult> {\n if (!targetFile) {\n throw MissingTargetFileError(root);\n }\n const isLockFileBased =\n targetFile.endsWith('package-lock.json') ||\n targetFile.endsWith('yarn.lock');\n\n const getLockFileDeps = isLockFileBased && !options.traverseNodeModules;\n const depTree: any = getLockFileDeps\n ? await lockParser.parse(root, targetFile, options)\n : await modulesParser.parse(root, targetFile, options);\n\n if (depTree?.meta?.lockfileVersion) {\n analytics.add('lockfileVersion', depTree.meta.lockfileVersion);\n }\n\n return {\n plugin: {\n name: 'snyk-nodejs-lockfile-parser',\n runtime: process.version,\n },\n scannedProjects: [{ depTree }],\n };\n}\n","import * as baseDebug from 'debug';\nconst debug = baseDebug('snyk-test');\nimport * as path from 'path';\nimport { spinner } from '../../spinner';\nimport * as analytics from '../../analytics';\nimport * as fs from 'fs';\nimport * as lockFileParser from 'snyk-nodejs-lockfile-parser';\nimport { PkgTree } from 'snyk-nodejs-lockfile-parser';\nimport { Options } from '../types';\n\nexport async function parse(\n root: string,\n targetFile: string,\n options: Options,\n): Promise<PkgTree> {\n const lockFileFullPath = path.resolve(root, targetFile);\n if (!fs.existsSync(lockFileFullPath)) {\n throw new Error(\n 'Lockfile ' + targetFile + ' not found at location: ' + lockFileFullPath,\n );\n }\n\n const fullPath = path.parse(lockFileFullPath);\n const manifestFileFullPath = path.resolve(fullPath.dir, 'package.json');\n const shrinkwrapFullPath = path.resolve(fullPath.dir, 'npm-shrinkwrap.json');\n\n if (!fs.existsSync(manifestFileFullPath)) {\n throw new Error(\n `Could not find package.json at ${manifestFileFullPath} ` +\n `(lockfile found at ${targetFile})`,\n );\n }\n\n if (fs.existsSync(shrinkwrapFullPath)) {\n throw new Error(\n 'Both `npm-shrinkwrap.json` and `package-lock.json` were found in ' +\n fullPath.dir +\n '.\\n' +\n 'Please run your command again specifying `--file=package.json` flag.',\n );\n }\n\n analytics.add('local', true);\n analytics.add('generating-node-dependency-tree', {\n lockFile: true,\n targetFile,\n });\n const resolveModuleSpinnerLabel = `Analyzing npm dependencies for ${lockFileFullPath}`;\n debug(resolveModuleSpinnerLabel);\n try {\n await spinner(resolveModuleSpinnerLabel);\n const strictOutOfSync = options.strictOutOfSync !== false;\n return lockFileParser.buildDepTreeFromFiles(\n root,\n manifestFileFullPath,\n lockFileFullPath,\n options.dev,\n strictOutOfSync,\n );\n } finally {\n await spinner.clear<void>(resolveModuleSpinnerLabel)();\n }\n}\n","import * as path from 'path';\nimport * as fs from 'fs';\nimport * as resolveNodeDeps from 'snyk-resolve-deps';\nimport * as baseDebug from 'debug';\nconst isEmpty = require('lodash.isempty');\nimport { spinner } from '../../spinner';\nimport * as analytics from '../../analytics';\nimport { Options } from '../types';\nimport { getFileContents } from '../../get-file-contents';\n\nconst debug = baseDebug('snyk-nodejs-plugin');\n\nexport async function parse(\n root: string,\n targetFile: string,\n options: Options,\n): Promise<resolveNodeDeps.PackageExpanded> {\n if (targetFile.endsWith('yarn.lock')) {\n options.file =\n options.file && options.file.replace('yarn.lock', 'package.json');\n }\n\n // package-lock.json falls back to package.json (used in wizard code)\n if (targetFile.endsWith('package-lock.json')) {\n options.file =\n options.file && options.file.replace('package-lock.json', 'package.json');\n }\n // check if there any dependencies\n const packageJsonFileName = path.resolve(root, options.file!);\n const packageManager = options.packageManager || 'npm';\n\n try {\n const packageJson = JSON.parse(\n getFileContents(root, packageJsonFileName).content,\n );\n\n let dependencies = packageJson.dependencies;\n if (options.dev) {\n dependencies = { ...dependencies, ...packageJson.devDependencies };\n }\n if (isEmpty(dependencies)) {\n return new Promise((resolve) =>\n resolve({\n name: packageJson.name || 'package.json',\n dependencies: {},\n version: packageJson.version,\n }),\n );\n }\n } catch (e) {\n debug(`Failed to read ${packageJsonFileName}: Error: ${e}`);\n throw new Error(\n `Failed to read ${packageJsonFileName}. Error: ${e.message}`,\n );\n }\n const nodeModulesPath = path.join(\n path.dirname(path.resolve(root, targetFile)),\n 'node_modules',\n );\n\n if (!fs.existsSync(nodeModulesPath)) {\n // throw a custom error\n throw new Error(\n \"Missing node_modules folder: we can't test \" +\n `without dependencies.\\nPlease run '${packageManager} install' first.`,\n );\n }\n analytics.add('local', true);\n analytics.add('generating-node-dependency-tree', {\n lockFile: false,\n targetFile,\n });\n\n const resolveModuleSpinnerLabel =\n 'Analyzing npm dependencies for ' +\n path.dirname(path.resolve(root, targetFile));\n try {\n await spinner.clear<void>(resolveModuleSpinnerLabel)();\n await spinner(resolveModuleSpinnerLabel);\n return resolveNodeDeps(\n root,\n Object.assign({}, options, { noFromArrays: true }),\n );\n } finally {\n await spinner.clear<void>(resolveModuleSpinnerLabel)();\n }\n}\n","import * as baseDebug from 'debug';\nimport * as pathUtil from 'path';\nconst sortBy = require('lodash.sortby');\nconst groupBy = require('lodash.groupby');\nimport * as micromatch from 'micromatch';\n\nconst debug = baseDebug('snyk-yarn-workspaces');\nimport * as lockFileParser from 'snyk-nodejs-lockfile-parser';\nimport {\n MultiProjectResultCustom,\n ScannedProjectCustom,\n} from '../get-multi-plugin-result';\nimport { getFileContents } from '../../get-file-contents';\nimport { NoSupportedManifestsFoundError } from '../../errors';\n\nexport async function processYarnWorkspaces(\n root: string,\n settings: {\n strictOutOfSync?: boolean;\n dev?: boolean;\n yarnWorkspaces?: boolean;\n },\n targetFiles: string[],\n): Promise<MultiProjectResultCustom> {\n // the order of yarnTargetFiles folders is important\n // must have the root level most folders at the top\n const mappedAndFiltered = targetFiles\n .map((p) => ({ path: p, ...pathUtil.parse(p) }))\n .filter((res) => ['package.json', 'yarn.lock'].includes(res.base));\n const sorted = sortBy(mappedAndFiltered, 'dir');\n const grouped = groupBy(sorted, 'dir');\n\n const yarnTargetFiles: {\n [dir: string]: Array<{\n path: string;\n base: string;\n dir: string;\n }>;\n } = grouped;\n\n debug(`Processing potential Yarn workspaces (${targetFiles.length})`);\n if (settings.yarnWorkspaces && Object.keys(yarnTargetFiles).length === 0) {\n throw NoSupportedManifestsFoundError([root]);\n }\n let yarnWorkspacesMap = {};\n const yarnWorkspacesFilesMap = {};\n const result: MultiProjectResultCustom = {\n plugin: {\n name: 'snyk-nodejs-yarn-workspaces',\n runtime: process.version,\n },\n scannedProjects: [],\n };\n let rootWorkspaceManifestContent = {};\n // the folders must be ordered highest first\n for (const directory of Object.keys(yarnTargetFiles)) {\n debug(`Processing ${directory} as a potential Yarn workspace`);\n let isYarnWorkspacePackage = false;\n let isRootPackageJson = false;\n const packageJsonFileName = pathUtil.join(directory, 'package.json');\n const packageJson = getFileContents(root, packageJsonFileName);\n yarnWorkspacesMap = {\n ...yarnWorkspacesMap,\n ...getWorkspacesMap(packageJson),\n };\n for (const workspaceRoot of Object.keys(yarnWorkspacesMap)) {\n const match = packageJsonBelongsToWorkspace(\n packageJsonFileName,\n yarnWorkspacesMap,\n workspaceRoot,\n );\n if (match) {\n debug(`${packageJsonFileName} matches an existing workspace pattern`);\n yarnWorkspacesFilesMap[packageJsonFileName] = {\n root: workspaceRoot,\n };\n isYarnWorkspacePackage = true;\n }\n if (packageJsonFileName === workspaceRoot) {\n isRootPackageJson = true;\n rootWorkspaceManifestContent = JSON.parse(packageJson.content);\n }\n }\n\n if (!(isYarnWorkspacePackage || isRootPackageJson)) {\n debug(\n `${packageJsonFileName} is not part of any detected workspace, skipping`,\n );\n continue;\n }\n try {\n const rootDir = isYarnWorkspacePackage\n ? pathUtil.dirname(yarnWorkspacesFilesMap[packageJsonFileName].root)\n : pathUtil.dirname(packageJsonFileName);\n const rootYarnLockfileName = pathUtil.join(rootDir, 'yarn.lock');\n const yarnLock = await getFileContents(root, rootYarnLockfileName);\n\n if (\n rootWorkspaceManifestContent.hasOwnProperty('resolutions') &&\n lockFileParser.getYarnLockfileType(yarnLock.content) ===\n lockFileParser.LockfileType.yarn2\n ) {\n const parsedManifestContent = JSON.parse(packageJson.content);\n packageJson.content = JSON.stringify({\n ...parsedManifestContent,\n resolutions: rootWorkspaceManifestContent['resolutions'],\n });\n }\n\n const res = await lockFileParser.buildDepTree(\n packageJson.content,\n yarnLock.content,\n settings.dev,\n lockFileParser.LockfileType.yarn,\n settings.strictOutOfSync !== false,\n );\n const project: ScannedProjectCustom = {\n packageManager: 'yarn',\n targetFile: pathUtil.relative(root, packageJson.fileName),\n depTree: res as any,\n plugin: {\n name: 'snyk-nodejs-lockfile-parser',\n runtime: process.version,\n },\n };\n result.scannedProjects.push(project);\n } catch (e) {\n if (settings.yarnWorkspaces) {\n throw e;\n }\n debug(`Error process workspace: ${packageJsonFileName}. ERROR: ${e}`);\n }\n }\n if (!result.scannedProjects.length) {\n debug(\n `No yarn workspaces detected in any of the ${targetFiles.length} target files.`,\n );\n }\n return result;\n}\n\ninterface YarnWorkspacesMap {\n [packageJsonName: string]: {\n workspaces: string[];\n };\n}\n\nexport function getWorkspacesMap(file: {\n content: string;\n fileName: string;\n}): YarnWorkspacesMap {\n const yarnWorkspacesMap = {};\n if (!file) {\n return yarnWorkspacesMap;\n }\n\n try {\n const rootFileWorkspacesDefinitions = lockFileParser.getYarnWorkspaces(\n file.content,\n );\n\n if (rootFileWorkspacesDefinitions && rootFileWorkspacesDefinitions.length) {\n yarnWorkspacesMap[file.fileName] = {\n workspaces: rootFileWorkspacesDefinitions,\n };\n }\n } catch (e) {\n debug('Failed to process a workspace', e.message);\n }\n return yarnWorkspacesMap;\n}\n\nexport function packageJsonBelongsToWorkspace(\n packageJsonFileName: string,\n yarnWorkspacesMap: YarnWorkspacesMap,\n workspaceRoot: string,\n): boolean {\n const workspaceRootFolder = pathUtil.dirname(\n workspaceRoot.replace(/\\\\/g, '/'),\n );\n const workspacesGlobs = (\n yarnWorkspacesMap[workspaceRoot].workspaces || []\n ).map((workspace) => pathUtil.join(workspaceRootFolder, workspace));\n\n const match = micromatch.isMatch(\n packageJsonFileName.replace(/\\\\/g, '/'),\n workspacesGlobs.map((p) =>\n pathUtil.normalize(pathUtil.join(p, '**')).replace(/\\\\/g, '/'),\n ),\n );\n return match;\n}\n","import { inspectors, Spec } from './inspectors';\nimport { MissingTargetFileError } from '../../errors/missing-targetfile-error';\nimport gemfileLockToDependencies = require('./gemfile-lock-to-dependencies');\nimport * as get from 'lodash.get';\nimport { MultiProjectResult } from '@snyk/cli-interface/legacy/plugin';\nimport * as types from '../types';\n\nexport async function inspect(\n root: string,\n targetFile: string,\n options: types.Options = {},\n): Promise<MultiProjectResult> {\n if (!targetFile) {\n throw MissingTargetFileError(root);\n }\n const specs = await gatherSpecs(root, targetFile, options);\n\n return {\n plugin: {\n name: 'bundled:rubygems',\n runtime: 'unknown',\n },\n scannedProjects: [\n {\n depTree: {\n name: specs.packageName,\n targetFile: specs.targetFile,\n dependencies: getDependenciesFromSpecs(specs),\n },\n },\n ],\n };\n}\n\nfunction getDependenciesFromSpecs(specs) {\n const gemfileLockBase64 = get(specs, 'files.gemfileLock.contents');\n const gemspecBase64 = get(specs, 'files.gemspec.contents');\n const contents = Buffer.from(\n gemfileLockBase64 || gemspecBase64,\n 'base64',\n ).toString();\n const dependencies = gemfileLockToDependencies(contents);\n return dependencies;\n}\n\nasync function gatherSpecs(\n root: string,\n targetFile: string,\n options: types.Options,\n): Promise<Spec> {\n for (const inspector of inspectors) {\n if (inspector.canHandle(targetFile)) {\n return await inspector.gatherSpecs(root, targetFile, options);\n }\n }\n\n throw new Error(`Could not handle rubygems file: ${targetFile}`);\n}\n","import * as path from 'path';\nimport { tryGetSpec } from './try-get-spec';\nimport { Spec } from './index';\nimport * as types from '../../types';\n\n/* Supported example patterns:\n * Gemfile\n * Gemfile.lock\n * rails.2.4.5.gemfile\n * rails.2.4.5.gemfile.lock\n * gemfiles/Gemfile.rails-2.4.5.lock\n * gemfiles/Gemfile.lock.rails-2.4.5\n */\n\nconst gemfileOrLockfilePattern = /.*[gG]emfile.*(\\.lock)?.*$/;\nconst gemfileLockPattern = /.*[gG]emfile.*(\\.lock).*$/;\n\nexport function canHandle(file: string): boolean {\n return !!file && gemfileOrLockfilePattern.test(path.basename(file));\n}\n\nexport async function gatherSpecs(\n root: string,\n target: string,\n options: types.Options,\n): Promise<Spec> {\n const { dir, name } = path.parse(target);\n const isGemfileLock = gemfileLockPattern.test(target);\n // if the target is a Gemfile we treat is as the lockfile\n const gemfileLock = await tryGetSpec(\n root,\n isGemfileLock ? target : path.join(target + '.lock'),\n );\n\n if (gemfileLock) {\n const basePackageName = path.basename(root);\n return {\n packageName: options.allSubProjects\n ? path.join(basePackageName, dir)\n : basePackageName,\n targetFile: path.join(dir, name),\n files: { gemfileLock },\n };\n } else {\n throw new Error(\n `Could not read ${target || 'Gemfile.lock'} lockfile: can't test ` +\n 'without dependencies.\\nPlease run `bundle install` first or' +\n ' if this is a custom file name re-run with --file=path/to/custom.gemfile.lock --package-manager=rubygems',\n );\n }\n}\n","import * as path from 'path';\nimport { Files, tryGetSpec } from './try-get-spec';\nimport { Spec } from './index';\n\nconst pattern = /\\.gemspec$/;\n\nexport function canHandle(file: string): boolean {\n return !!file && pattern.test(file);\n}\n\nexport async function gatherSpecs(root: string, target: string): Promise<Spec> {\n const targetName = path.basename(target);\n const targetDir = path.dirname(target);\n const files: Files = {};\n\n const gemspec = await tryGetSpec(root, path.join(targetDir, targetName));\n\n if (gemspec) {\n files.gemspec = gemspec;\n } else {\n throw new Error(`File not found: ${target}`);\n }\n\n const gemfileLock = await tryGetSpec(\n root,\n path.join(targetDir, 'Gemfile.lock'),\n );\n\n if (gemfileLock) {\n files.gemfileLock = gemfileLock;\n }\n\n return {\n packageName: path.basename(root),\n targetFile: path.join(targetDir, targetName),\n files,\n };\n}\n","import * as gemfile from './gemfile';\nimport * as gemspec from './gemspec';\nimport { Files } from './try-get-spec';\n\nexport interface Spec {\n packageName: string;\n targetFile: string;\n files: Files;\n}\n\nexport const inspectors = [gemfile, gemspec];\n","import * as path from 'path';\nimport * as fs from 'fs';\n\ninterface File {\n name: string;\n contents: string;\n}\n\nexport interface Files {\n gemfileLock?: File;\n gemspec?: File;\n}\n\nexport async function tryGetSpec(\n dir: string,\n name: string,\n): Promise<File | null> {\n const filePath = path.resolve(dir, name);\n if (fs.existsSync(filePath)) {\n return {\n name,\n contents: Buffer.from(fs.readFileSync(filePath)).toString('base64'),\n };\n }\n return null;\n}\n","import {\n analyzeFolders,\n AnalysisSeverity,\n MAX_FILE_SIZE,\n} from '@snyk/code-client';\nimport { ReportingDescriptor, Result } from 'sarif';\nimport { SEVERITY } from '../../snyk-test/legacy';\nimport { api } from '../../api-token';\nimport config from '../../config';\nimport { getBase64Encoding } from '../../code-config';\nimport { spinner } from '../../spinner';\nimport { Options } from '../../types';\nimport { SastSettings, Log } from './types';\nimport { analysisProgressUpdate } from './utils';\nimport {\n FeatureNotSupportedBySnykCodeError,\n MissingConfigurationError,\n} from './errors';\nimport { getProxyForUrl } from 'proxy-from-env';\nimport { bootstrap } from 'global-agent';\nimport chalk from 'chalk';\nimport * as debugLib from 'debug';\nimport { getCodeClientProxyUrl } from '../../code-config';\n\nconst debug = debugLib('snyk-code');\n\nexport async function getCodeAnalysisAndParseResults(\n root: string,\n options: Options,\n sastSettings: SastSettings,\n requestId: string,\n): Promise<Log | null> {\n await spinner.clearAll();\n analysisProgressUpdate();\n const codeAnalysis = await getCodeAnalysis(\n root,\n options,\n sastSettings,\n requestId,\n );\n spinner.clearAll();\n return parseSecurityResults(codeAnalysis);\n}\n\nasync function getCodeAnalysis(\n root: string,\n options: Options,\n sastSettings: SastSettings,\n requestId: string,\n): Promise<Log | null> {\n const isLocalCodeEngineEnabled = isLocalCodeEngine(sastSettings);\n if (isLocalCodeEngineEnabled) {\n validateLocalCodeEngineUrl(sastSettings.localCodeEngine.url);\n }\n\n const source = 'snyk-cli';\n const baseURL = isLocalCodeEngineEnabled\n ? sastSettings.localCodeEngine.url\n : getCodeClientProxyUrl();\n\n const base64Encoding = getBase64Encoding();\n debug(`base64 encoding enabled: ${base64Encoding}`);\n\n // TODO(james) This mirrors the implementation in request.ts and we need to use this for deeproxy calls\n // This ensures we support lowercase http(s)_proxy values as well\n // The weird IF around it ensures we don't create an envvar with\n // a value of undefined, which throws error when trying to use it as a proxy\n if (process.env.HTTP_PROXY || process.env.http_proxy) {\n process.env.HTTP_PROXY = process.env.HTTP_PROXY || process.env.http_proxy;\n }\n if (process.env.HTTPS_PROXY || process.env.https_proxy) {\n process.env.HTTPS_PROXY =\n process.env.HTTPS_PROXY || process.env.https_proxy;\n }\n\n const proxyUrl = getProxyForUrl(baseURL);\n if (proxyUrl) {\n bootstrap({\n environmentVariableNamespace: '',\n });\n }\n\n const sessionToken = api() || '';\n\n const severity = options.severityThreshold\n ? severityToAnalysisSeverity(options.severityThreshold)\n : AnalysisSeverity.info;\n const result = await analyzeFolders({\n connection: { baseURL, sessionToken, source, requestId, base64Encoding },\n analysisOptions: { severity },\n fileOptions: { paths: [root] },\n analysisContext: {\n initiator: 'CLI',\n flow: source,\n orgDisplayName: sastSettings.org,\n projectName: config.PROJECT_NAME,\n org: {\n name: sastSettings.org || 'unknown',\n displayName: 'unknown',\n publicId: 'unknown',\n flags: {},\n },\n },\n languages: sastSettings.supportedLanguages,\n });\n\n if (result?.fileBundle.skippedOversizedFiles?.length) {\n debug(\n '\\n',\n chalk.yellow(\n `Warning!\\nFiles were skipped in the analysis due to their size being greater than ${MAX_FILE_SIZE}B. Skipped files: ${[\n ...result.fileBundle.skippedOversizedFiles,\n ].join(', ')}`,\n ),\n );\n }\n\n if (result?.analysisResults.type === 'sarif') {\n return result.analysisResults.sarif;\n }\n return null;\n}\n\nfunction severityToAnalysisSeverity(severity: SEVERITY): AnalysisSeverity {\n if (severity === SEVERITY.CRITICAL) {\n throw new FeatureNotSupportedBySnykCodeError(SEVERITY.CRITICAL);\n }\n const severityLevel = {\n low: 1,\n medium: 2,\n high: 3,\n };\n return severityLevel[severity];\n}\n\nfunction parseSecurityResults(codeAnalysis: Log | null): Log | null {\n let securityRulesMap;\n\n if (!codeAnalysis) {\n return codeAnalysis;\n }\n\n const rules = codeAnalysis.runs[0].tool.driver.rules;\n const results = codeAnalysis.runs[0].results;\n\n if (rules) {\n securityRulesMap = getSecurityRulesMap(rules);\n codeAnalysis.runs[0].tool.driver.rules = Object.values(securityRulesMap);\n }\n if (results && securityRulesMap) {\n codeAnalysis.runs[0].results = getSecurityResultsOnly(\n results,\n Object.keys(securityRulesMap),\n );\n }\n\n return codeAnalysis;\n}\n\nfunction getSecurityRulesMap(\n rules: ReportingDescriptor[],\n): { [ruleId: string]: ReportingDescriptor[] } {\n const securityRulesMap = rules.reduce((acc, rule) => {\n const { id: ruleId, properties } = rule;\n const isSecurityRule = properties?.categories?.some(\n (category) => category.toLowerCase() === 'security',\n );\n if (isSecurityRule) {\n acc[ruleId] = rule;\n }\n return acc;\n }, {});\n\n return securityRulesMap;\n}\n\nfunction getSecurityResultsOnly(\n results: Result[],\n securityRules: string[],\n): Result[] {\n const securityResults = results.reduce((acc: Result[], result: Result) => {\n const securityRule = securityRules.find((sr) => sr === result?.ruleId);\n if (securityRule) {\n result.ruleIndex = securityRules.indexOf(securityRule);\n acc.push(result);\n }\n return acc;\n }, []);\n\n return securityResults;\n}\n\nfunction isLocalCodeEngine(sastSettings: SastSettings): boolean {\n const { sastEnabled, localCodeEngine } = sastSettings;\n\n return sastEnabled && localCodeEngine.enabled;\n}\n\nfunction validateLocalCodeEngineUrl(localCodeEngineUrl: string): void {\n if (localCodeEngineUrl.length === 0) {\n throw new MissingConfigurationError(\n 'Snyk Code Local Engine. Refer to our docs on https://docs.snyk.io/products/snyk-code/deployment-options/snyk-code-local-engine/cli-and-ide to learn more',\n );\n }\n}\n","import { makeRequest } from '../../request';\n\nimport { getAuthHeader } from '../../api-token';\nimport config from '../../config';\nimport { assembleQueryString } from '../../snyk-test/common';\nimport { SastSettings, TrackUsageResponse } from './types';\n\nexport async function getSastSettingsForOrg(org): Promise<SastSettings> {\n const response = await makeRequest({\n method: 'GET',\n headers: {\n Authorization: getAuthHeader(),\n },\n qs: assembleQueryString({ org }),\n url: `${config.API}/cli-config/settings/sast`,\n gzip: true,\n json: true,\n });\n\n return response.body as SastSettings;\n}\n\nexport async function trackUsage(org): Promise<TrackUsageResponse> {\n const response = await makeRequest({\n method: 'POST',\n headers: {\n Authorization: getAuthHeader(),\n },\n qs: assembleQueryString({ org }),\n url: `${config.API}/track-sast-usage/cli`,\n gzip: true,\n json: true,\n });\n\n return response.body as TrackUsageResponse;\n}\n","export { MissingConfigurationError } from './missing-configuration-error';\nexport { FeatureNotSupportedBySnykCodeError } from './unsupported-feature-snyk-code-error';\n","import { CustomError } from '../../../errors/custom-error';\n\nexport class MissingConfigurationError extends CustomError {\n public readonly action: string;\n\n constructor(action: string, additionalUserHelp = '') {\n super(`Missing configuration for ${action}.`);\n this.code = 422;\n this.action = action;\n\n this.userMessage = `'Configuration is missing or wrong for ${action}'. ${additionalUserHelp}`;\n }\n}\n","import { CustomError } from '../../../errors/custom-error';\n\nexport class FeatureNotSupportedBySnykCodeError extends CustomError {\n public readonly feature: string;\n\n constructor(feature: string, additionalUserHelp = '') {\n super(`Unsupported action for ${feature}.`);\n this.code = 422;\n this.feature = feature;\n\n this.userMessage = `'${feature}' is not supported for snyk code. ${additionalUserHelp}`;\n }\n}\n","import * as Sarif from 'sarif';\nimport * as Debug from 'debug';\nimport chalk from 'chalk';\nimport { icon, color } from '../../../theme';\nimport { colorTextBySeverity, SEVERITY } from '../../../snyk-test/common';\nimport { rightPadWithSpaces } from '../../../right-pad';\nimport { Options } from '../../../types';\nimport { Log } from '../types';\n\nconst debug = Debug('code-output');\n\nexport function getCodeDisplayedOutput(\n codeTest: Log,\n meta: string,\n prefix: string,\n): string {\n let issues: { [index: string]: string[] } = {};\n\n if (codeTest.runs[0].results) {\n const results: Sarif.Result[] = codeTest.runs[0].results;\n\n const rulesMap: {\n [ruleId: string]: Sarif.ReportingDescriptor;\n } = getRulesMap(codeTest.runs[0].tool.driver.rules || []);\n\n issues = getIssues(results, rulesMap);\n }\n\n const issuesText =\n issues.low.join('') + issues.medium.join('') + issues.high.join('');\n const summaryOKText = color.status.success(`${icon.VALID} Test completed`);\n const codeIssueSummary = getCodeIssuesSummary(issues);\n\n return (\n prefix +\n issuesText +\n '\\n' +\n summaryOKText +\n '\\n\\n' +\n meta +\n '\\n\\n' +\n chalk.bold('Summary:') +\n '\\n\\n' +\n codeIssueSummary +\n '\\n\\n'\n );\n}\n\nfunction getCodeIssuesSummary(issues: { [index: string]: string[] }): string {\n const lowSeverityText = issues.low.length\n ? colorTextBySeverity(SEVERITY.LOW, ` ${issues.low.length} [Low] `)\n : '';\n const mediumSeverityText = issues.medium.length\n ? colorTextBySeverity(\n SEVERITY.MEDIUM,\n ` ${issues.medium.length} [Medium] `,\n )\n : '';\n const highSeverityText = issues.high.length\n ? colorTextBySeverity(SEVERITY.HIGH, ` ${issues.high.length} [High] `)\n : '';\n\n const codeIssueCount =\n issues.low.length + issues.medium.length + issues.high.length;\n const codeIssueFound = ` ${codeIssueCount} Code issue${\n codeIssueCount > 0 ? 's' : ''\n } found`;\n const issuesBySeverityText =\n highSeverityText + mediumSeverityText + lowSeverityText;\n const vulnPathsText = color.status.success(\n `${icon.VALID} Awesome! No issues were found.`,\n );\n\n return codeIssueCount > 0\n ? codeIssueFound + '\\n' + issuesBySeverityText\n : vulnPathsText;\n}\n\nfunction getIssues(\n results: Sarif.Result[],\n rulesMap: { [ruleId: string]: Sarif.ReportingDescriptor },\n): { [index: string]: string[] } {\n const issuesInit: { [index: string]: string[] } = {\n low: [],\n medium: [],\n high: [],\n };\n\n const issues = results.reduce((acc, res) => {\n if (res.locations?.length) {\n const location = res.locations[0].physicalLocation;\n if (res.level && location?.artifactLocation && location?.region) {\n const severity = sarifToSeverityLevel(res.level);\n const ruleId = res.ruleId!;\n if (!(ruleId in rulesMap)) {\n debug('Rule ID does not exist in the rules list');\n }\n const ruleName =\n rulesMap[ruleId].shortDescription?.text ||\n rulesMap[ruleId].name ||\n '';\n const ruleIdSeverityText = colorTextBySeverity(\n severity,\n ` ${icon.ISSUE} [${severity}] ${chalk.bold(ruleName)}`,\n );\n const artifactLocationUri = location.artifactLocation.uri;\n const startLine = location.region.startLine;\n const text = res.message.text;\n const title = ruleIdSeverityText;\n const path = ` Path: ${artifactLocationUri}, line ${startLine}`;\n const info = ` Info: ${text}`;\n acc[severity.toLowerCase()].push(`${title} \\n ${path} \\n ${info}\\n\\n`);\n }\n }\n return acc;\n }, issuesInit);\n\n return issues;\n}\n\nfunction getRulesMap(\n rules: Sarif.ReportingDescriptor[],\n): { [ruleId: string]: Sarif.ReportingDescriptor } {\n const rulesMapByID = rules.reduce((acc, rule) => {\n acc[rule.id] = rule;\n return acc;\n }, {});\n\n return rulesMapByID;\n}\n\nfunction sarifToSeverityLevel(\n sarifConfigurationLevel: Sarif.ReportingConfiguration.level,\n): string {\n const severityLevel = {\n note: 'Low',\n warning: 'Medium',\n error: 'High',\n };\n\n return severityLevel[sarifConfigurationLevel] as string;\n}\n\nexport function getMeta(options: Options, path: string): string {\n const padToLength = 19; // chars to align\n const orgName = options.org || '';\n const projectPath = options.path || path;\n const meta = [\n rightPadWithSpaces('Organization: ', padToLength) + chalk.bold(orgName),\n ];\n meta.push(\n rightPadWithSpaces('Test type: ', padToLength) +\n chalk.bold('Static code analysis'),\n );\n meta.push(\n rightPadWithSpaces('Project path: ', padToLength) + chalk.bold(projectPath),\n );\n\n return meta.join('\\n');\n}\n\nexport function getPrefix(path: string): string {\n return chalk.bold.white('\\nTesting ' + path + ' ...\\n\\n');\n}\n","import chalk from 'chalk';\nimport * as debugLib from 'debug';\nimport { v4 as uuidv4 } from 'uuid';\nimport { getCodeAnalysisAndParseResults } from './analysis';\nimport { getSastSettings } from './settings';\nimport {\n getCodeDisplayedOutput,\n getPrefix,\n getMeta,\n} from './format/output-format';\nimport { EcosystemPlugin } from '../../ecosystems/types';\nimport { FailedToRunTestError, NoSupportedSastFiles } from '../../errors';\nimport { jsonStringifyLargeObject } from '../../json';\nimport * as analytics from '../../analytics';\n\nconst debug = debugLib('snyk-code');\n\nexport const codePlugin: EcosystemPlugin = {\n // We currently don't use scan/display. we will need to consolidate ecosystem plugins\n // to accept flows that act differently in the `testDependencies` step, as we have here\n async scan() {\n return null as any;\n },\n async display() {\n return '';\n },\n async test(paths, options) {\n const requestId = uuidv4();\n debug(`Request ID: ${requestId}`);\n try {\n analytics.add('sast-scan', true);\n const sastSettings = await getSastSettings(options);\n // Currently code supports only one path\n const path = paths[0];\n\n const sarifTypedResult = await getCodeAnalysisAndParseResults(\n path,\n options,\n sastSettings,\n requestId,\n );\n\n if (!sarifTypedResult) {\n throw new NoSupportedSastFiles();\n }\n const numOfIssues = sarifTypedResult!.runs?.[0].results?.length || 0;\n analytics.add('sast-issues-found', numOfIssues);\n let newOrg = options.org;\n if (!newOrg && sastSettings.org) {\n newOrg = sastSettings.org;\n }\n const meta = getMeta({ ...options, org: newOrg }, path);\n const prefix = getPrefix(path);\n let readableResult = getCodeDisplayedOutput(\n sarifTypedResult!,\n meta,\n prefix,\n );\n if (numOfIssues > 0 && options['no-markdown']) {\n sarifTypedResult.runs?.[0].results?.forEach(({ message }) => {\n delete message.markdown;\n });\n }\n let sarifResult: string | undefined;\n if (options['sarif-file-output']) {\n sarifResult = jsonStringifyLargeObject(sarifTypedResult);\n }\n let jsonResult: string | undefined;\n if (options['json-file-output']) {\n jsonResult = jsonStringifyLargeObject(sarifTypedResult);\n }\n if (options.sarif || options.json) {\n readableResult = jsonStringifyLargeObject(sarifTypedResult);\n }\n if (numOfIssues > 0) {\n throwIssuesError({ readableResult, sarifResult, jsonResult });\n }\n return sarifResult ? { readableResult, sarifResult } : { readableResult };\n } catch (error) {\n let err: Error;\n if (isCodeClientError(error)) {\n const isUnauthorized = isUnauthorizedError(error)\n ? 'Unauthorized: '\n : '';\n err = new FailedToRunTestError(\n `${isUnauthorized}Failed to run 'code test'`,\n error.statusCode,\n );\n } else if (error instanceof Error) {\n err = error;\n } else if (isUnauthorizedError(error)) {\n err = new FailedToRunTestError(error.message, error.code);\n } else {\n err = new Error(error);\n }\n debug(\n chalk.bold.red(\n `requestId: ${requestId} statusCode:${error.code ||\n error.statusCode}, message: ${error.statusText || error.message}`,\n ),\n );\n throw err;\n }\n },\n};\n\nfunction isCodeClientError(error: object): boolean {\n return (\n error.hasOwnProperty('statusCode') &&\n error.hasOwnProperty('statusText') &&\n error.hasOwnProperty('apiName')\n );\n}\n\nfunction isUnauthorizedError(error: any): boolean {\n return (\n error.statusCode === 401 ||\n error.statusCode === 403 ||\n error.code === 403 ||\n error.code === 401\n );\n}\n\nfunction throwIssuesError(args: {\n readableResult: string;\n sarifResult: string | undefined;\n jsonResult: string | undefined;\n}): Error {\n const err = new Error(args.readableResult) as any;\n err.code = 'VULNS';\n if (args.sarifResult !== undefined) {\n err.sarifStringifiedResults = args.sarifResult;\n }\n if (args.jsonResult !== undefined) {\n err.jsonStringifiedResults = args.jsonResult;\n }\n throw err;\n}\n","import { Options } from '../../types';\nimport { SastSettings } from './types';\nimport config from '../../config';\nimport { getSastSettingsForOrg, trackUsage } from './checks';\n\nimport {\n AuthFailedError,\n FailedToRunTestError,\n FeatureNotSupportedForOrgError,\n NotFoundError,\n} from '../../errors';\n\nexport async function getSastSettings(options: Options): Promise<SastSettings> {\n const org = options.org || config.org;\n\n // This is an unexpected path, code plugin executed for non-code command.\n if (!options.code) {\n throw new FeatureNotSupportedForOrgError(org);\n }\n\n const sastSettingsResponse = await getSastSettingsForOrg(org);\n\n if (\n sastSettingsResponse?.code === 401 ||\n sastSettingsResponse?.code === 403\n ) {\n throw AuthFailedError(\n sastSettingsResponse.error,\n sastSettingsResponse.code,\n );\n }\n\n if (sastSettingsResponse?.code === 404) {\n throw new NotFoundError(sastSettingsResponse?.userMessage);\n }\n\n if (!sastSettingsResponse.sastEnabled) {\n throw new FeatureNotSupportedForOrgError(\n org,\n 'Snyk Code',\n 'enable in Settings > Snyk Code',\n );\n }\n\n const trackUsageResponse = await trackUsage(org);\n if (trackUsageResponse.code === 429) {\n throw new FailedToRunTestError(\n trackUsageResponse.userMessage,\n trackUsageResponse.code,\n );\n }\n return sastSettingsResponse;\n}\n","export { analysisProgressUpdate } from './testEmitter';\n","import { emitter as codeEmitter } from '@snyk/code-client';\nimport { spinner } from '../../../spinner';\nimport * as debugLib from 'debug';\n\nexport function analysisProgressUpdate(): void {\n let currentMessage = '';\n const showSpinner = (message: string): Promise<void> | undefined => {\n if (currentMessage === message) return;\n\n spinner.clear<void>(currentMessage)();\n currentMessage = message;\n return spinner(message);\n };\n\n codeEmitter.on('supportedFilesLoaded', () =>\n showSpinner(`Supported extensions loaded`),\n );\n codeEmitter.on('scanFilesProgress', (processed: number) =>\n showSpinner(`Scanning files: ${Math.round(processed / 100)}00`),\n );\n codeEmitter.on('createBundleProgress', (processed: number, total: number) =>\n showSpinner(`Batching file upload: ${processed} / ${total}`),\n );\n codeEmitter.on('uploadBundleProgress', (processed: number, total: number) =>\n showSpinner(`Upload progress: ${processed} / ${total}`),\n );\n codeEmitter.on('analyseProgress', (data: any) =>\n showSpinner(`${data.status}: ${Math.round(data.progress * 100)}%`),\n );\n codeEmitter.on('sendError', (error) => {\n throw error;\n });\n codeEmitter.on('apiRequestLog', (data) => {\n const debug = debugLib('snyk-code');\n debug('---> API request log ', data);\n });\n}\n","import * as snykPolicyLib from 'snyk-policy';\nimport * as debugModule from 'debug';\nimport { PackageExpanded } from 'snyk-resolve-deps';\n\nimport { pluckPolicies } from '.';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { PackageJson, PolicyOptions } from '../types';\nimport * as analytics from '../analytics';\n\nconst debug = debugModule('snyk');\n\nexport async function findAndLoadPolicy(\n root: string,\n scanType: SupportedPackageManagers | 'docker' | 'iac' | 'cpp',\n options: PolicyOptions,\n pkg?: PackageExpanded,\n scannedProjectFolder?: string,\n): Promise<Policy | undefined> {\n const isDocker = scanType === 'docker';\n const isNodeProject = ['npm', 'yarn'].includes(scanType);\n // monitor\n let policyLocations: string[] = [\n options['policy-path'] || scannedProjectFolder || root,\n ];\n if (isDocker) {\n policyLocations = policyLocations.filter((loc) => loc !== root);\n } else if (isNodeProject) {\n // TODO: pluckPolicies expects a package.json object to\n // find and apply policies in node_modules\n policyLocations = policyLocations.concat(pluckPolicies(pkg as PackageJson));\n }\n\n debug('Potential policy locations found:', policyLocations);\n analytics.add('policies', policyLocations.length);\n analytics.add('policyLocations', policyLocations);\n\n if (policyLocations.length === 0) {\n return;\n }\n let policy;\n try {\n policy = await snykPolicyLib.load(policyLocations, options);\n } catch (err) {\n // note: inline catch, to handle error from .load\n // if the .snyk file wasn't found, it is fine\n if (err.code !== 'ENOENT' && err.code !== 'ENOTDIR') {\n throw err;\n }\n }\n return policy;\n}\n\nexport interface Policy {\n filter(vulns: any, root?: string, matchStrategy?: string): any;\n exclude?: { [key: string]: string[] };\n ignore?: any;\n}\n","export { pluckPolicies } from './pluck-policies';\nexport { findAndLoadPolicy } from './find-and-load-policy';\n","const flatten = require('lodash.flatten');\nimport { PackageExpanded } from 'snyk-resolve-deps';\n\nexport function pluckPolicies(pkg: PackageExpanded): string[] | string {\n if (!pkg) {\n return [];\n }\n\n if (pkg.snyk) {\n return pkg.snyk;\n }\n\n if (!pkg.dependencies) {\n return [];\n }\n\n return flatten(\n Object.keys(pkg.dependencies)\n .map((name: string) => pluckPolicies(pkg.dependencies[name]))\n .filter(Boolean),\n );\n}\n","import { sleep } from '../common';\nimport { ScanResult } from '../ecosystems/types';\nimport {\n ResolutionMeta,\n ResolveAndMonitorFactsResponse,\n ResolveAndTestFactsResponse,\n} from './types';\nimport { FailedToRunTestError } from '../errors';\n\nexport async function delayNextStep(\n attemptsCount: number,\n maxAttempts: number,\n pollInterval: number,\n): Promise<void> {\n attemptsCount++;\n checkPollingAttempts(maxAttempts)(attemptsCount);\n await sleep(pollInterval);\n}\n\nfunction checkPollingAttempts(maxAttempts: number) {\n return (attemptsCount: number): void | Error => {\n if (attemptsCount > maxAttempts) {\n throw new Error('Exceeded Polling maxAttempts');\n }\n };\n}\n\nexport function extractResolutionMetaFromScanResult({\n name,\n target,\n identity,\n policy,\n targetReference,\n}: ScanResult): ResolutionMeta {\n return {\n name,\n target,\n identity,\n policy,\n targetReference,\n };\n}\n\nexport function handleProcessingStatus(\n response: ResolveAndMonitorFactsResponse | ResolveAndTestFactsResponse,\n): void {\n if (response?.status === 'CANCELLED' || response?.status === 'ERROR') {\n throw new FailedToRunTestError(\n 'Failed to process the project. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output',\n );\n }\n}\n","import config from '../config';\nimport { isCI } from '../is-ci';\nimport { makeRequest } from '../request/promise';\nimport { Contributor, Options } from '../types';\n\nimport { assembleQueryString } from '../../lib/snyk-test/common';\nimport { getAuthHeader } from '../api-token';\nimport { MonitorDependenciesResponse, ScanResult } from '../ecosystems/types';\nimport {\n ResolutionMeta,\n ResolveAndMonitorFactsResponse,\n ResolveFactsState,\n} from './types';\nimport { delayNextStep, handleProcessingStatus } from './common';\nimport {\n generateProjectAttributes,\n generateTags,\n} from '../../cli/commands/monitor';\n\nexport async function requestMonitorPollingToken(\n options: Options,\n isAsync: boolean,\n scanResult: ScanResult,\n): Promise<ResolveFactsState> {\n if (scanResult?.target && scanResult.target['remoteUrl'] === '') {\n scanResult.target['remoteUrl'] = scanResult.name;\n }\n\n const payload = {\n method: 'PUT',\n url: `${config.API}/monitor-dependencies`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n body: {\n isAsync,\n scanResult,\n method: 'cli',\n },\n qs: { ...assembleQueryString(options) },\n };\n return await makeRequest<ResolveAndMonitorFactsResponse>(payload);\n}\n\nexport async function pollingMonitorWithTokenUntilDone(\n token: string,\n isAsync: boolean,\n options: Options,\n pollInterval: number,\n attemptsCount: number,\n maxAttempts = Infinity,\n resolutionMeta: ResolutionMeta | undefined,\n contributors: Contributor[] = [],\n): Promise<MonitorDependenciesResponse> {\n const payload = {\n method: 'PUT',\n url: `${config.API}/monitor-dependencies/${token}`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n qs: { ...assembleQueryString(options) },\n body: {\n isAsync,\n resolutionMeta,\n contributors,\n method: 'cli',\n tags: generateTags(options),\n attributes: generateProjectAttributes(options),\n projectName:\n resolutionMeta?.name || options['project-name'] || config.PROJECT_NAME,\n },\n };\n\n const response = await makeRequest<ResolveAndMonitorFactsResponse>(payload);\n\n handleProcessingStatus(response);\n\n if (response.ok && response.isMonitored) {\n return response;\n }\n\n await delayNextStep(attemptsCount, maxAttempts, pollInterval);\n return await pollingMonitorWithTokenUntilDone(\n token,\n isAsync,\n options,\n pollInterval,\n attemptsCount,\n maxAttempts,\n resolutionMeta,\n contributors,\n );\n}\n","import config from '../config';\nimport { isCI } from '../is-ci';\nimport { makeRequest } from '../request/promise';\nimport { Options } from '../types';\n\nimport { assembleQueryString } from '../snyk-test/common';\nimport { getAuthHeader } from '../api-token';\nimport { ScanResult } from '../ecosystems/types';\n\nimport { ResolveAndTestFactsResponse } from './types';\nimport { delayNextStep, handleProcessingStatus } from './common';\nimport { TestDependenciesResult } from '../snyk-test/legacy';\n\nexport async function requestTestPollingToken(\n options: Options,\n isAsync: boolean,\n scanResult: ScanResult,\n): Promise<ResolveAndTestFactsResponse> {\n const payload = {\n method: 'POST',\n url: `${config.API}/test-dependencies`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n body: {\n isAsync,\n scanResult,\n },\n qs: assembleQueryString(options),\n };\n return await makeRequest<ResolveAndTestFactsResponse>(payload);\n}\n\nexport async function pollingTestWithTokenUntilDone(\n token: string,\n type: string,\n options: Options,\n pollInterval: number,\n attemptsCount: number,\n maxAttempts = Infinity,\n): Promise<TestDependenciesResult> {\n const payload = {\n method: 'GET',\n url: `${config.API}/test-dependencies/${token}`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n qs: { ...assembleQueryString(options), type },\n };\n\n const response = await makeRequest<ResolveAndTestFactsResponse>(payload);\n\n handleProcessingStatus(response);\n\n if (response.result) {\n const {\n issues,\n issuesData,\n depGraphData,\n depsFilePaths,\n fileSignaturesDetails,\n vulnerabilities,\n path,\n dependencyCount,\n packageManager,\n } = response.result;\n return {\n issues,\n issuesData,\n depGraphData,\n depsFilePaths,\n fileSignaturesDetails,\n vulnerabilities,\n path,\n dependencyCount,\n packageManager,\n };\n }\n\n await delayNextStep(attemptsCount, maxAttempts, pollInterval);\n return await pollingTestWithTokenUntilDone(\n token,\n type,\n options,\n pollInterval,\n attemptsCount,\n maxAttempts,\n );\n}\n","import config from './config';\nimport * as depGraphLib from '@snyk/dep-graph';\nimport { DepDict, Options, MonitorOptions } from './types';\nimport { legacyCommon as legacyApi } from '@snyk/cli-interface';\nimport { countPathsToGraphRoot } from './utils';\nimport { jsonStringifyLargeObject } from './json';\n\nexport async function maybePrintDepGraph(\n options: Options | MonitorOptions,\n depGraph: depGraphLib.DepGraph,\n) {\n // TODO @boost: remove this logic once we get a valid depGraph print format\n const graphPathsCount = countPathsToGraphRoot(depGraph);\n const hasTooManyPaths = graphPathsCount > config.PRUNE_DEPS_THRESHOLD;\n\n if (!hasTooManyPaths) {\n const depTree = (await depGraphLib.legacy.graphToDepTree(\n depGraph,\n depGraph.pkgManager.name,\n )) as legacyApi.DepTree;\n maybePrintDepTree(options, depTree);\n } else {\n if (options['print-deps']) {\n if (options.json) {\n console.warn(\n '--print-deps --json option not yet supported for large projects. Displaying graph json output instead',\n );\n // TODO @boost: add as output graphviz 'dot' file to visualize?\n console.log(jsonStringifyLargeObject(depGraph.toJSON()));\n } else {\n console.warn(\n '--print-deps option not yet supported for large projects. Try with --json.',\n );\n }\n }\n }\n}\n\n// This option is still experimental and might be deprecated.\n// It might be a better idea to convert it to a command (i.e. do not perform test/monitor).\nexport function maybePrintDepTree(\n options: Options | MonitorOptions,\n rootPackage: legacyApi.DepTree,\n) {\n if (options['print-deps']) {\n if (options.json) {\n // Will produce 2 JSON outputs, one for the deps, one for the vuln scan.\n console.log(jsonStringifyLargeObject(rootPackage));\n } else {\n printDepsForTree({ [rootPackage.name!]: rootPackage });\n }\n }\n}\n\nfunction printDepsForTree(depDict: DepDict, prefix = '') {\n let counter = 0;\n const keys = Object.keys(depDict);\n for (const name of keys) {\n const dep = depDict[name];\n let branch = '├─ ';\n const last = counter === keys.length - 1;\n if (last) {\n branch = '└─ ';\n }\n console.log(\n prefix +\n (prefix ? branch : '') +\n dep.name +\n ' @ ' +\n (dep.version ? dep.version : ''),\n );\n if (dep.dependencies) {\n printDepsForTree(dep.dependencies, prefix + (last ? ' ' : '│ '));\n }\n counter++;\n }\n}\n","import * as gitTargetBuilder from './target-builders/git';\nimport * as containerTargetBuilder from './target-builders/container';\nimport { GitTarget, ContainerTarget } from './types';\nimport { DepTree } from '../types';\nimport { InvalidRemoteUrlError } from '../errors/invalid-remote-url-error';\nimport { ScannedProject } from '@snyk/cli-interface/legacy/common';\n\nconst TARGET_BUILDERS = [containerTargetBuilder, gitTargetBuilder];\ninterface Options {\n 'remote-repo-url'?: string;\n docker?: boolean; // docker is coming from Options/TestOptions\n isDocker?: boolean; // isDocker coming from MonitorMeta\n}\nexport async function getInfo(\n scannedProject: ScannedProject,\n options: Options,\n packageInfo?: DepTree,\n): Promise<GitTarget | ContainerTarget | null> {\n const isFromContainer = options.docker || options.isDocker || false;\n for (const builder of TARGET_BUILDERS) {\n const target = await builder.getInfo({\n isFromContainer,\n scannedProject,\n packageInfo,\n });\n\n if (target) {\n const remoteUrl = options['remote-repo-url'];\n\n if (!remoteUrl) {\n return target;\n }\n\n if (typeof remoteUrl !== 'string') {\n throw new InvalidRemoteUrlError();\n }\n return { ...target, remoteUrl };\n }\n }\n\n return null;\n}\n","import { DepTree } from '../../types';\nimport { ContainerTarget } from '../types';\nimport { ScannedProject } from '@snyk/cli-interface/legacy/common';\n\nexport async function getInfo({\n isFromContainer,\n scannedProject,\n packageInfo,\n}: {\n isFromContainer: boolean;\n scannedProject: ScannedProject;\n packageInfo?: DepTree;\n}): Promise<ContainerTarget | null> {\n // safety check\n if (!isFromContainer) {\n return null;\n }\n\n const imageNameOnProjectMeta =\n scannedProject.meta && scannedProject.meta.imageName;\n return {\n image:\n imageNameOnProjectMeta ||\n (packageInfo as any)?.image ||\n packageInfo?.name,\n };\n}\n","import * as url from 'url';\nimport subProcess = require('../../sub-process');\nimport { GitTarget } from '../types';\n\n// for scp-like syntax [user@]server:project.git\nconst originRegex = /(.+@)?(.+):(.+$)/;\n\nexport async function getInfo({\n isFromContainer,\n cwd,\n}: {\n isFromContainer: boolean;\n cwd?: string;\n}): Promise<GitTarget | null> {\n // safety check\n if (isFromContainer) {\n return null;\n }\n\n const target: GitTarget = {};\n\n try {\n const origin: string | null | undefined = (\n await subProcess.execute('git', ['remote', 'get-url', 'origin'], { cwd })\n ).trim();\n\n if (origin) {\n const { protocol, host, pathname = '' } = url.parse(origin);\n\n // Not handling git:// as it has no connection options\n if (host && protocol && ['ssh:', 'http:', 'https:'].includes(protocol)) {\n // same format for parseable URLs\n target.remoteUrl = `http://${host}${pathname}`;\n } else {\n const originRes = originRegex.exec(origin);\n if (originRes && originRes[2] && originRes[3]) {\n target.remoteUrl = `http://${originRes[2]}/${originRes[3]}`;\n } else {\n // else keep the original\n target.remoteUrl = origin;\n }\n }\n }\n } catch (err) {\n // Swallowing exception since we don't want to break the monitor if there is a problem\n // executing git commands.\n }\n\n try {\n target.branch = (\n await subProcess.execute('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {\n cwd,\n })\n ).trim();\n } catch (err) {\n // Swallowing exception since we don't want to break the monitor if there is a problem\n // executing git commands.\n }\n\n return target;\n}\n","export interface GitTarget {\n remoteUrl?: string;\n branch?: string;\n}\n\nexport interface ContainerTarget {\n image?: string;\n}\n\nexport function isGitTarget(target: any): target is GitTarget {\n return target && (target.branch || target.remoteUrl);\n}\n","import * as _debug from 'debug';\nimport { DepGraph, legacy } from '@snyk/dep-graph';\n\nimport { DepTree } from './types';\nimport config from './config';\nimport { TooManyVulnPaths } from './errors';\nimport * as analytics from '../lib/analytics';\nimport { SupportedPackageManagers } from './package-managers';\nimport { countPathsToGraphRoot } from './utils';\n\nconst debug = _debug('snyk:prune');\n\nconst { depTreeToGraph, graphToDepTree } = legacy;\n\nexport async function pruneGraph(\n depGraph: DepGraph,\n packageManager: SupportedPackageManagers,\n pruneIsRequired = false,\n): Promise<DepGraph> {\n const prePrunePathsCount = countPathsToGraphRoot(depGraph);\n const isDenseGraph = prePrunePathsCount > config.PRUNE_DEPS_THRESHOLD;\n\n debug('rootPkg', depGraph.rootPkg);\n debug('prePrunePathsCount: ' + prePrunePathsCount);\n debug('isDenseGraph', isDenseGraph);\n analytics.add('prePrunedPathsCount', prePrunePathsCount);\n if (isDenseGraph || pruneIsRequired) {\n debug('Trying to prune the graph');\n const pruneStartTime = Date.now();\n const prunedTree = (await graphToDepTree(depGraph, packageManager, {\n deduplicateWithinTopLevelDeps: true,\n })) as DepTree;\n const graphToTreeEndTime = Date.now();\n analytics.add(\n 'prune.graphToTreeDuration',\n graphToTreeEndTime - pruneStartTime,\n );\n const prunedGraph = await depTreeToGraph(prunedTree, packageManager);\n analytics.add('prune.treeToGraphDuration', Date.now() - graphToTreeEndTime);\n const postPrunePathsCount = countPathsToGraphRoot(prunedGraph);\n analytics.add('postPrunedPathsCount', postPrunePathsCount);\n debug('postPrunePathsCount' + postPrunePathsCount);\n if (postPrunePathsCount > config.MAX_PATH_COUNT) {\n debug('Too many paths to process the project');\n //TODO replace the throw below with TooManyPaths we do not calculate vuln paths there\n throw new TooManyVulnPaths();\n }\n return prunedGraph;\n }\n return depGraph;\n}\n","import * as graphlib from '@snyk/graphlib';\nimport { CallGraph } from '@snyk/cli-interface/legacy/common';\n\nimport {\n REACHABLE_VULNS_SUPPORTED_PACKAGE_MANAGERS,\n SupportedPackageManagers,\n} from './package-managers';\nimport { isFeatureFlagSupportedForOrg } from './feature-flags';\nimport {\n AuthFailedError,\n FeatureNotSupportedByPackageManagerError,\n UnsupportedFeatureFlagError,\n} from './errors';\nimport { MonitorOptions, Options, TestOptions } from './types';\nimport { isMultiProjectScan } from './is-multi-project-scan';\nimport * as theme from './theme';\n\nconst featureFlag = 'reachableVulns';\n\nexport function serializeCallGraphWithMetrics(\n callGraph: CallGraph,\n): {\n callGraph: any;\n nodeCount: number;\n edgeCount: number;\n} {\n return {\n callGraph: graphlib.json.write(callGraph),\n nodeCount: callGraph.nodeCount(),\n edgeCount: callGraph.edgeCount(),\n };\n}\n\nexport async function validatePayload(\n org: any,\n options: (Options & TestOptions) | (Options & MonitorOptions),\n packageManager?: SupportedPackageManagers,\n): Promise<boolean> {\n if (\n packageManager &&\n !isMultiProjectScan(options) &&\n !REACHABLE_VULNS_SUPPORTED_PACKAGE_MANAGERS.includes(packageManager)\n ) {\n throw new FeatureNotSupportedByPackageManagerError(\n 'Reachable vulns',\n packageManager,\n `For a list of supported package managers go to https://support.snyk.io/hc/en-us/articles/360010554837-Reachable-Vulnerabilities`,\n );\n }\n const reachableVulnsSupportedRes = await isFeatureFlagSupportedForOrg(\n featureFlag,\n org,\n );\n\n if (reachableVulnsSupportedRes.code === 401) {\n throw AuthFailedError(\n reachableVulnsSupportedRes.error,\n reachableVulnsSupportedRes.code,\n );\n }\n if (reachableVulnsSupportedRes.userMessage) {\n throw new UnsupportedFeatureFlagError(\n featureFlag,\n reachableVulnsSupportedRes.userMessage,\n );\n }\n return true;\n}\n\nexport const reachableVulnsRemovalMessage = theme.color.status.warn(\n `${theme.icon.WARNING} Starting on 15 August 2022, the reachable (--reachable) flag will no longer be supported and will have no effect. We are currently developing new and improved capabilities for prioritizing vulnerabilities. Please follow https://updates.snyk.io for news and updates. We are sorry for the temporary inconvenience.\\n`,\n);\n","import { getAuthHeader } from '../api-token';\nimport * as request from './index';\n\nexport async function makeRequest<T>(payload: any): Promise<T> {\n return new Promise((resolve, reject) => {\n request.makeRequest(payload, (error, res, body) => {\n if (error) {\n return reject(error);\n }\n if (res.statusCode !== 200) {\n return reject({\n code: res.statusCode,\n message: body?.message,\n });\n }\n resolve(body);\n });\n });\n}\n\n/**\n * All rest request will essentially be the same and are JSON by default\n * Thus if no headers provided default headers are used\n * @param {any} payload for the request\n * @returns\n */\nexport async function makeRequestRest<T>(payload: any): Promise<T> {\n return new Promise((resolve, reject) => {\n payload.headers = payload.headers ?? {\n 'Content-Type': 'application/vnd.api+json',\n authorization: getAuthHeader(),\n };\n payload.json = true;\n request.makeRequest(payload, (error, res, body) => {\n if (error) {\n return reject(error);\n }\n if (res.statusCode >= 400) {\n return reject({\n code: res.statusCode,\n body: JSON.parse(body as any),\n });\n }\n resolve(JSON.parse(body as any) as T);\n });\n });\n}\n","export function rightPadWithSpaces(s: string, padding: number) {\n const padLength = padding - s.length;\n if (padLength <= 0) {\n return s;\n }\n\n return s + ' '.repeat(padLength);\n}\n","import * as path from 'path';\nimport config from '../config';\nimport { isCI } from '../is-ci';\nimport { getPlugin } from '../ecosystems';\nimport { Ecosystem } from '../ecosystems/types';\nimport { Options, PolicyOptions, TestOptions } from '../types';\nimport { Payload } from './types';\nimport { assembleQueryString } from './common';\nimport { spinner } from '../spinner';\nimport { findAndLoadPolicyForScanResult } from '../ecosystems/policy';\nimport { getAuthHeader } from '../../lib/api-token';\nimport { DockerImageNotFoundError } from '../errors';\n\nexport async function assembleEcosystemPayloads(\n ecosystem: Ecosystem,\n options: Options & TestOptions & PolicyOptions,\n): Promise<Payload[]> {\n // For --all-projects packageManager is yet undefined here. Use 'all'\n let analysisTypeText = 'all dependencies for ';\n if (options.docker) {\n analysisTypeText = 'container dependencies for ';\n } else if (options.packageManager) {\n analysisTypeText = options.packageManager + ' dependencies for ';\n }\n\n const spinnerLbl =\n 'Analyzing ' +\n analysisTypeText +\n (path.relative('.', path.join(options.path, options.file || '')) ||\n path.relative('..', '.') + ' project dir');\n\n spinner.clear<void>(spinnerLbl)();\n if (!options.quiet) {\n await spinner(spinnerLbl);\n }\n\n try {\n const plugin = getPlugin(ecosystem);\n const pluginResponse = await plugin.scan(options);\n\n const payloads: Payload[] = [];\n\n // TODO: This is a temporary workaround until the plugins themselves can read policy files and set names!\n for (const scanResult of pluginResponse.scanResults) {\n // WARNING! This mutates the payload. Policy logic should be in the plugin.\n const policy = await findAndLoadPolicyForScanResult(scanResult, options);\n if (policy !== undefined) {\n scanResult.policy = policy.toString();\n }\n\n // WARNING! This mutates the payload. The project name logic should be handled in the plugin.\n scanResult.name =\n options['project-name'] || config.PROJECT_NAME || scanResult.name;\n\n payloads.push({\n method: 'POST',\n url: `${config.API}${options.testDepGraphDockerEndpoint ||\n '/test-dependencies'}`,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n body: {\n scanResult,\n },\n qs: assembleQueryString(options),\n });\n }\n\n return payloads;\n } catch (error) {\n if (ecosystem === 'docker' && error.message === 'authentication required') {\n throw new DockerImageNotFoundError(options.path);\n }\n if (ecosystem === 'docker' && error.message === 'invalid image format') {\n throw new DockerImageNotFoundError(options.path);\n }\n\n throw error;\n } finally {\n spinner.clear<void>(spinnerLbl)();\n }\n}\n","import * as values from 'lodash.values';\nimport * as depGraphLib from '@snyk/dep-graph';\nimport {\n DepsFilePaths,\n ScanResult,\n FileSignaturesDetails,\n} from '../ecosystems/types';\nimport { SupportedPackageManagers } from '../package-managers';\nimport { Options, SupportedProjectTypes, TestOptions } from '../types';\nimport { SEVERITIES } from './common';\n\ninterface Pkg {\n name: string;\n version?: string;\n}\n\ninterface Patch {\n version: string;\n id: string;\n urls: string[];\n modificationTime: string;\n}\n\nexport enum SEVERITY {\n LOW = 'low',\n MEDIUM = 'medium',\n HIGH = 'high',\n CRITICAL = 'critical',\n}\n\nexport enum REACHABILITY {\n FUNCTION = 'function',\n PACKAGE = 'package',\n NOT_REACHABLE = 'not-reachable',\n NO_INFO = 'no-info',\n}\n\nexport interface VulnMetaData {\n id: string;\n title: string;\n description: string;\n type: 'license' | 'vuln';\n name: string;\n info: string;\n severity: SEVERITY;\n severityValue: number;\n isNew: boolean;\n version: string;\n packageManager: SupportedPackageManagers | 'upstream';\n}\n\nexport interface GroupedVuln {\n list: AnnotatedIssue[];\n metadata: VulnMetaData;\n isIgnored: boolean;\n title: string;\n note: string | false;\n severity: SEVERITY;\n originalSeverity?: SEVERITY;\n isNew: boolean;\n name: string;\n version: string;\n isFixable: boolean;\n fixedIn: string[];\n legalInstructionsArray?: LegalInstruction[];\n reachability?: REACHABILITY;\n}\n\nexport interface LegalInstruction {\n licenseName: string;\n legalContent: string;\n}\nexport interface IssueData {\n id: string;\n packageName: string;\n version: string;\n moduleName?: string;\n below: string; // Vulnerable below version\n semver: {\n vulnerable: string | string[];\n vulnerableHashes?: string[];\n vulnerableByDistro?: {\n [distroNameAndVersion: string]: string[];\n };\n };\n patches: Patch[];\n isNew: boolean;\n description: string;\n title: string;\n severity: SEVERITY;\n fixedIn: string[];\n legalInstructions?: string;\n reachability?: REACHABILITY;\n packageManager?: SupportedProjectTypes;\n from?: string[];\n name?: string;\n}\n\nexport type CallPath = string[];\n\nexport interface ReachableFunctionPaths {\n functionName: string;\n callPaths: CallPath[];\n}\n\nexport interface ReachablePaths {\n pathCount: number;\n paths: ReachableFunctionPaths[];\n}\n\ninterface AnnotatedIssue extends IssueData {\n credit: string[];\n name: string;\n version: string;\n from: string[];\n upgradePath: Array<string | boolean>;\n isUpgradable: boolean;\n isPatchable: boolean;\n severity: SEVERITY;\n originalSeverity?: SEVERITY;\n\n // These fields present for \"node_module\" based scans to allow remediation\n bundled?: any;\n shrinkwrap?: any;\n __filename?: string;\n parentDepType: string;\n\n type?: 'license';\n title: string;\n patch?: any;\n note?: string | false;\n publicationTime?: string;\n\n reachablePaths?: ReachablePaths;\n identifiers?: {\n [name: string]: string[];\n };\n}\n\n// Mixin, to be added to GroupedVuln / AnnotatedIssue\nexport interface DockerIssue {\n nearestFixedInVersion?: string;\n dockerfileInstruction?: any;\n dockerBaseImage?: any;\n}\n\nexport interface IgnoreSettings {\n adminOnly: boolean;\n reasonRequired: boolean;\n disregardFilesystemIgnores: boolean;\n}\n\nexport interface BasicResultData {\n ok: boolean;\n payloadType?: string;\n org: string;\n isPrivate: boolean;\n summary: string;\n packageManager?: SupportedProjectTypes;\n severityThreshold?: string;\n platform?: string;\n}\n\nexport interface LegacyVulnApiResult extends BasicResultData {\n vulnerabilities: AnnotatedIssue[];\n dependencyCount: number;\n policy: string;\n licensesPolicy: object | null;\n ignoreSettings: IgnoreSettings | null;\n docker?: {\n baseImage?: any;\n binariesVulns?: unknown;\n baseImageRemediation?: BaseImageRemediation;\n };\n projectId?: string;\n filesystemPolicy?: boolean;\n uniqueCount?: any;\n remediation?: RemediationChanges;\n}\n\nexport interface BaseImageRemediation {\n code: string;\n advice: BaseImageRemediationAdvice[];\n message?: string; // TODO: check if this is still being sent\n}\n\nexport interface BaseImageRemediationAdvice {\n message: string;\n bold?: boolean;\n color?: string;\n}\n\nexport interface TestResult extends LegacyVulnApiResult {\n targetFile?: string;\n projectName?: string;\n targetFilePath?: string;\n displayTargetFile?: string; // used for display only\n foundProjectCount?: number;\n scanResult?: ScanResult;\n}\n\ninterface UpgradePathItem {\n name: string;\n version: string;\n newVersion?: string;\n isDropped?: boolean;\n}\n\ninterface UpgradePath {\n path: UpgradePathItem[];\n}\n\ninterface FixInfo {\n upgradePaths: UpgradePath[];\n isPatchable: boolean;\n nearestFixedInVersion?: string;\n}\n\nexport interface AffectedPackages {\n [pkgId: string]: {\n pkg: Pkg;\n issues: {\n [issueId: string]: Issue;\n };\n };\n}\n\ninterface TestDepGraphResult {\n issuesData: {\n [issueId: string]: IssueData;\n };\n affectedPkgs: AffectedPackages;\n docker: {\n binariesVulns?: TestDepGraphResult;\n baseImage?: any;\n };\n remediation?: RemediationChanges;\n}\n\nexport interface Issue {\n pkgName: string;\n pkgVersion?: string;\n issueId: string;\n fixInfo: FixInfo;\n}\n\nexport interface TestDependenciesResult {\n issuesData: {\n [issueId: string]: IssueData;\n };\n issues: Issue[];\n docker?: {\n baseImage: string;\n baseImageRemediation: BaseImageRemediation;\n binariesVulns: TestDepGraphResult;\n };\n remediation?: RemediationChanges;\n depsFilePaths?: DepsFilePaths;\n depGraphData: depGraphLib.DepGraphData;\n fileSignaturesDetails: FileSignaturesDetails;\n vulnerabilities: IssueData[];\n path: string;\n dependencyCount: number;\n packageManager: SupportedProjectTypes;\n}\n\nexport interface TestDepGraphMeta {\n isPublic: boolean;\n isLicensesEnabled: boolean;\n licensesPolicy?: {\n severities: {\n [type: string]: string;\n };\n };\n projectId?: string;\n ignoreSettings?: IgnoreSettings;\n policy: string;\n org: string;\n}\n\nexport interface TestDepGraphResponse {\n result: TestDepGraphResult;\n meta: TestDepGraphMeta;\n}\n\nexport interface TestDependenciesResponse {\n result: TestDependenciesResult;\n meta: TestDepGraphMeta;\n}\n\nexport interface Ignores {\n [path: string]: {\n paths: string[][];\n meta: {\n days?: number;\n reason?: string;\n };\n };\n}\n\nexport interface PatchObject {\n [name: string]: {\n patched: string;\n };\n}\n\nexport interface Upgrade {\n upgradeTo: string; // name@version\n}\n\nexport interface UpgradeVulns extends Upgrade {\n vulns: string[];\n}\n\nexport interface UpgradeRemediation extends UpgradeVulns {\n upgrades: string[];\n}\n\nexport interface PatchRemediation {\n paths: PatchObject[];\n}\n\nexport interface DependencyUpdates {\n [from: string]: UpgradeRemediation;\n}\n\nexport interface PinRemediation extends UpgradeVulns {\n isTransitive: boolean;\n}\n\nexport interface DependencyPins {\n [name: string]: PinRemediation;\n}\n\n// Remediation changes to be applied to the project,\n// including information on all and unresolved issues.\nexport interface RemediationChanges {\n unresolved: IssueData[];\n upgrade: DependencyUpdates;\n patch: {\n [name: string]: PatchRemediation;\n };\n ignore: unknown;\n pin: DependencyPins;\n}\n\nfunction convertTestDepGraphResultToLegacy(\n res: TestDepGraphResponse,\n depGraph: depGraphLib.DepGraph,\n packageManager: SupportedProjectTypes | undefined,\n options: Options & TestOptions,\n): LegacyVulnApiResult {\n const result = res.result;\n\n const upgradePathsMap = new Map<string, string[]>();\n\n for (const pkgInfo of values(result.affectedPkgs)) {\n for (const pkgIssue of values(pkgInfo.issues)) {\n if (pkgIssue.fixInfo && pkgIssue.fixInfo.upgradePaths) {\n for (const upgradePath of pkgIssue.fixInfo.upgradePaths) {\n const legacyFromPath = pkgPathToLegacyPath(upgradePath.path);\n const vulnPathString = getVulnPathString(\n pkgIssue.issueId,\n legacyFromPath,\n );\n upgradePathsMap[vulnPathString] = toLegacyUpgradePath(\n upgradePath.path,\n );\n }\n }\n }\n }\n\n // generate the legacy vulns array (vuln-data + metada per vulnerable path).\n // use the upgradePathsMap to find available upgrade-paths\n const vulns: AnnotatedIssue[] = [];\n\n for (const pkgInfo of values(result.affectedPkgs)) {\n for (const vulnPkgPath of depGraph.pkgPathsToRoot(pkgInfo.pkg)) {\n const legacyFromPath = pkgPathToLegacyPath(vulnPkgPath.reverse());\n for (const pkgIssue of values(pkgInfo.issues)) {\n const vulnPathString = getVulnPathString(\n pkgIssue.issueId,\n legacyFromPath,\n );\n const upgradePath = upgradePathsMap[vulnPathString] || [];\n\n // TODO: we need the full issue-data for every path only for the --json output,\n // consider picking only the required fields,\n // and append the full data only for --json, to minimize chance of out-of-memory\n const annotatedIssue = Object.assign(\n {},\n result.issuesData[pkgIssue.issueId],\n {\n from: legacyFromPath,\n upgradePath,\n isUpgradable: !!upgradePath[0] || !!upgradePath[1],\n isPatchable: pkgIssue.fixInfo.isPatchable,\n name: pkgInfo.pkg.name,\n version: pkgInfo.pkg.version as string,\n nearestFixedInVersion: pkgIssue.fixInfo.nearestFixedInVersion,\n },\n ) as AnnotatedIssue & DockerIssue; // TODO(kyegupov): get rid of type assertion\n\n vulns.push(annotatedIssue);\n }\n }\n }\n\n const dockerRes = result.docker;\n\n if (dockerRes && dockerRes.binariesVulns) {\n const binariesVulns = dockerRes.binariesVulns;\n for (const pkgInfo of values(binariesVulns.affectedPkgs)) {\n for (const pkgIssue of values(pkgInfo.issues)) {\n const pkgAndVersion = (pkgInfo.pkg.name +\n '@' +\n pkgInfo.pkg.version) as string;\n const annotatedIssue = (Object.assign(\n {},\n binariesVulns.issuesData[pkgIssue.issueId],\n {\n from: ['Upstream', pkgAndVersion],\n upgradePath: [],\n isUpgradable: false,\n isPatchable: false,\n name: pkgInfo.pkg.name,\n version: pkgInfo.pkg.version as string,\n nearestFixedInVersion: pkgIssue.fixInfo.nearestFixedInVersion,\n },\n ) as any) as AnnotatedIssue; // TODO(kyegupov): get rid of forced type assertion\n vulns.push(annotatedIssue);\n }\n }\n }\n\n const meta = res.meta || {};\n\n const severityThreshold =\n options.severityThreshold === SEVERITY.LOW\n ? undefined\n : options.severityThreshold;\n\n const legacyRes: LegacyVulnApiResult = {\n vulnerabilities: vulns,\n ok: vulns.length === 0,\n dependencyCount: depGraph.getPkgs().length - 1,\n org: meta.org,\n policy: meta.policy,\n isPrivate: !meta.isPublic,\n licensesPolicy: meta.licensesPolicy || null,\n packageManager,\n projectId: meta.projectId,\n ignoreSettings: meta.ignoreSettings || null,\n docker: result.docker,\n summary: getSummary(vulns, severityThreshold),\n severityThreshold,\n remediation: result.remediation,\n };\n\n return legacyRes;\n}\n\nfunction getVulnPathString(issueId: string, vulnPath: string[]) {\n return issueId + '|' + JSON.stringify(vulnPath);\n}\n\nfunction pkgPathToLegacyPath(pkgPath: Pkg[]): string[] {\n return pkgPath.map(toLegacyPkgId);\n}\n\nfunction toLegacyUpgradePath(\n upgradePath: UpgradePathItem[],\n): Array<string | boolean> {\n return upgradePath\n .filter((item) => !item.isDropped)\n .map((item) => {\n if (!item.newVersion) {\n return false;\n }\n\n return `${item.name}@${item.newVersion}`;\n });\n}\n\nfunction toLegacyPkgId(pkg: Pkg) {\n return `${pkg.name}@${pkg.version || '*'}`;\n}\n\nfunction getSummary(vulns: object[], severityThreshold?: SEVERITY): string {\n const count = vulns.length;\n let countText = '' + count;\n const severityFilters: string[] = [];\n const severitiesArray = SEVERITIES.map((s) => s.verboseName);\n if (severityThreshold) {\n severitiesArray\n .slice(severitiesArray.indexOf(severityThreshold))\n .forEach((sev) => {\n severityFilters.push(sev);\n });\n }\n\n if (!count) {\n if (severityFilters.length) {\n return `No ${severityFilters.join(' or ')} severity vulnerabilities`;\n }\n return 'No known vulnerabilities';\n }\n\n if (severityFilters.length) {\n countText += ' ' + severityFilters.join(' or ') + ' severity';\n }\n\n return `${countText} vulnerable dependency ${pl('path', count)}`;\n}\n\nfunction pl(word, count) {\n const ext = {\n y: 'ies',\n default: 's',\n };\n\n const last = word.split('').pop();\n\n if (count > 1) {\n return word.slice(0, -1) + (ext[last] || last + ext.default);\n }\n\n return word;\n}\n\nexport { convertTestDepGraphResultToLegacy, AnnotatedIssue };\n","import * as fs from 'fs';\nimport * as get from 'lodash.get';\nimport * as path from 'path';\nimport * as pathUtil from 'path';\nimport * as debugModule from 'debug';\nimport chalk from 'chalk';\nimport { icon } from '../theme';\nimport { parsePackageString as moduleToObject } from 'snyk-module';\nimport * as depGraphLib from '@snyk/dep-graph';\nimport * as theme from '../../lib/theme';\n\nimport {\n AffectedPackages,\n AnnotatedIssue,\n convertTestDepGraphResultToLegacy,\n DockerIssue,\n LegacyVulnApiResult,\n TestDependenciesResponse,\n TestDepGraphResponse,\n TestResult,\n} from './legacy';\nimport {\n AuthFailedError,\n DockerImageNotFoundError,\n FailedToGetVulnerabilitiesError,\n FailedToGetVulnsFromUnavailableResource,\n FailedToRunTestError,\n InternalServerError,\n NoSupportedManifestsFoundError,\n UnsupportedFeatureFlagError,\n NotFoundError,\n errorMessageWithRetry,\n} from '../errors';\nimport * as snyk from '../';\nimport { isCI } from '../is-ci';\nimport * as common from './common';\nimport config from '../config';\nimport * as analytics from '../analytics';\nimport { maybePrintDepGraph, maybePrintDepTree } from '../print-deps';\nimport { ContainerTarget, GitTarget } from '../project-metadata/types';\nimport * as projectMetadata from '../project-metadata';\nimport {\n DepTree,\n Options,\n PolicyOptions,\n SupportedProjectTypes,\n TestOptions,\n} from '../types';\nimport { pruneGraph } from '../prune';\nimport { getDepsFromPlugin } from '../plugins/get-deps-from-plugin';\nimport {\n MultiProjectResultCustom,\n ScannedProjectCustom,\n} from '../plugins/get-multi-plugin-result';\nimport { extractPackageManager } from '../plugins/extract-package-manager';\nimport { getExtraProjectCount } from '../plugins/get-extra-project-count';\nimport { serializeCallGraphWithMetrics } from '../reachable-vulns';\nimport { validateOptions } from '../options-validator';\nimport { findAndLoadPolicy } from '../policy';\nimport {\n Payload,\n PayloadBody,\n DepTreeFromResolveDeps,\n TestDependenciesRequest,\n} from './types';\nimport { CallGraphError, CallGraph } from '@snyk/cli-interface/legacy/common';\nimport * as alerts from '../alerts';\nimport { abridgeErrorMessage } from '../error-format';\nimport { getAuthHeader } from '../api-token';\nimport { getEcosystem } from '../ecosystems';\nimport { Issue } from '../ecosystems/types';\nimport { assembleEcosystemPayloads } from './assemble-payloads';\nimport { makeRequest } from '../request';\nimport { spinner } from '../spinner';\n\nconst debug = debugModule('snyk:run-test');\n\nconst ANALYTICS_PAYLOAD_MAX_LENGTH = 1024;\n\nfunction prepareResponseForParsing(\n payload: Payload,\n response: TestDependenciesResponse,\n options: Options & TestOptions,\n): any {\n const ecosystem = getEcosystem(options);\n return ecosystem\n ? prepareEcosystemResponseForParsing(payload, response, options)\n : prepareLanguagesResponseForParsing(payload);\n}\n\nfunction prepareEcosystemResponseForParsing(\n payload: Payload,\n response: TestDependenciesResponse,\n options: Options & TestOptions,\n) {\n const testDependenciesRequest = payload.body as\n | TestDependenciesRequest\n | undefined;\n const payloadBody = testDependenciesRequest?.scanResult;\n const depGraphData: depGraphLib.DepGraphData | undefined =\n response?.result?.depGraphData;\n const depGraph =\n depGraphData !== undefined\n ? depGraphLib.createFromJSON(depGraphData)\n : undefined;\n const imageUserInstructions = payloadBody?.facts.find(\n (fact) =>\n fact.type === 'dockerfileAnalysis' ||\n fact.type === 'autoDetectedUserInstructions',\n );\n\n const dockerfilePackages = imageUserInstructions?.data?.dockerfilePackages;\n const projectName = payloadBody?.name || depGraph?.rootPkg.name;\n const packageManager = payloadBody?.identity?.type as SupportedProjectTypes;\n const targetFile = payloadBody?.identity?.targetFile || options.file;\n const platform = payloadBody?.identity?.args?.platform;\n\n analytics.add('depGraph', !!depGraph);\n analytics.add('isDocker', !!options.docker);\n\n return {\n depGraph,\n dockerfilePackages,\n projectName,\n targetFile,\n pkgManager: packageManager,\n displayTargetFile: targetFile,\n foundProjectCount: undefined,\n payloadPolicy: payloadBody?.policy,\n platform,\n scanResult: payloadBody,\n };\n}\n\nfunction prepareLanguagesResponseForParsing(payload: Payload) {\n const payloadBody = payload.body as PayloadBody | undefined;\n const payloadPolicy = payloadBody && payloadBody.policy;\n const depGraph = payloadBody && payloadBody.depGraph;\n const pkgManager =\n depGraph &&\n depGraph.pkgManager &&\n (depGraph.pkgManager.name as SupportedProjectTypes);\n const targetFile = payloadBody && payloadBody.targetFile;\n const projectName =\n payloadBody?.projectNameOverride || payloadBody?.originalProjectName;\n const foundProjectCount = payloadBody?.foundProjectCount;\n const displayTargetFile = payloadBody?.displayTargetFile;\n let dockerfilePackages;\n if (\n payloadBody &&\n payloadBody.docker &&\n payloadBody.docker.dockerfilePackages\n ) {\n dockerfilePackages = payloadBody.docker.dockerfilePackages;\n }\n analytics.add('depGraph', !!depGraph);\n analytics.add('isDocker', !!(payloadBody && payloadBody.docker));\n return {\n depGraph,\n payloadPolicy,\n pkgManager,\n targetFile,\n projectName,\n foundProjectCount,\n displayTargetFile,\n dockerfilePackages,\n };\n}\n\nfunction isTestDependenciesResponse(\n response:\n | TestDepGraphResponse\n | TestDependenciesResponse\n | LegacyVulnApiResult,\n): response is TestDependenciesResponse {\n const assumedTestDependenciesResponse = response as TestDependenciesResponse;\n return assumedTestDependenciesResponse?.result?.issues !== undefined;\n}\n\nfunction convertIssuesToAffectedPkgs(\n response:\n | TestDepGraphResponse\n | TestDependenciesResponse\n | LegacyVulnApiResult,\n): TestDepGraphResponse | TestDependenciesResponse | LegacyVulnApiResult {\n if (!(response as any).result) {\n return response;\n }\n\n if (!isTestDependenciesResponse(response)) {\n return response;\n }\n\n response.result['affectedPkgs'] = getAffectedPkgsFromIssues(\n response.result.issues,\n );\n return response;\n}\n\nfunction getAffectedPkgsFromIssues(issues: Issue[]): AffectedPackages {\n const result: AffectedPackages = {};\n\n for (const issue of issues) {\n const packageId = `${issue.pkgName}@${issue.pkgVersion || ''}`;\n\n if (result[packageId] === undefined) {\n result[packageId] = {\n pkg: { name: issue.pkgName, version: issue.pkgVersion },\n issues: {},\n };\n }\n\n result[packageId].issues[issue.issueId] = issue;\n }\n\n return result;\n}\n\nasync function sendAndParseResults(\n payloads: Payload[],\n spinnerLbl: string,\n root: string,\n options: Options & TestOptions,\n): Promise<TestResult[]> {\n const results: TestResult[] = [];\n for (const payload of payloads) {\n await spinner.clear<void>(spinnerLbl)();\n if (!options.quiet) {\n await spinner(spinnerLbl);\n }\n /** sendTestPayload() deletes the request.body from the payload once completed. */\n const payloadCopy = Object.assign({}, payload);\n const res = await sendTestPayload(payload);\n const {\n depGraph,\n payloadPolicy,\n pkgManager,\n targetFile,\n projectName,\n foundProjectCount,\n displayTargetFile,\n dockerfilePackages,\n platform,\n scanResult,\n } = prepareResponseForParsing(\n payloadCopy,\n res as TestDependenciesResponse,\n options,\n );\n\n const ecosystem = getEcosystem(options);\n if (ecosystem && options['print-deps']) {\n await spinner.clear<void>(spinnerLbl)();\n await maybePrintDepGraph(options, depGraph);\n }\n\n const legacyRes = convertIssuesToAffectedPkgs(res);\n\n const result = await parseRes(\n depGraph,\n pkgManager,\n legacyRes as LegacyVulnApiResult,\n options,\n payload,\n payloadPolicy,\n root,\n dockerfilePackages,\n );\n\n results.push({\n ...result,\n targetFile,\n projectName,\n foundProjectCount,\n displayTargetFile,\n platform,\n scanResult,\n });\n }\n return results;\n}\n\nexport async function runTest(\n projectType: SupportedProjectTypes | undefined,\n root: string,\n options: Options & TestOptions,\n): Promise<TestResult[]> {\n const spinnerLbl = 'Querying vulnerabilities database...';\n try {\n await validateOptions(options, options.packageManager);\n const payloads = await assemblePayloads(root, options);\n return await sendAndParseResults(payloads, spinnerLbl, root, options);\n } catch (error) {\n debug('Error running test', { error });\n // handling denial from registry because of the feature flag\n // currently done for go.mod\n const isFeatureNotAllowed =\n error.code === 403 && error.message.includes('Feature not allowed');\n\n const hasFailedToGetVulnerabilities =\n error.code === 404 &&\n error.name.includes('FailedToGetVulnerabilitiesError') &&\n !error.userMessage;\n\n if (isFeatureNotAllowed) {\n throw NoSupportedManifestsFoundError([root]);\n }\n if (hasFailedToGetVulnerabilities) {\n throw FailedToGetVulnsFromUnavailableResource(root, error.code);\n }\n if (\n getEcosystem(options) === 'docker' &&\n error.statusCode === 401 &&\n [\n 'authentication required',\n '{\"details\":\"incorrect username or password\"}\\n',\n ].includes(error.message)\n ) {\n throw new DockerImageNotFoundError(root);\n }\n\n throw new FailedToRunTestError(\n error.userMessage ||\n error.message ||\n `Failed to test ${projectType} project`,\n error.code,\n );\n } finally {\n spinner.clear<void>(spinnerLbl)();\n }\n}\n\nasync function parseRes(\n depGraph: depGraphLib.DepGraph | undefined,\n pkgManager: SupportedProjectTypes | undefined,\n res: LegacyVulnApiResult,\n options: Options & TestOptions,\n payload: Payload,\n payloadPolicy: string | undefined,\n root: string,\n dockerfilePackages: any,\n): Promise<TestResult> {\n // TODO: docker doesn't have a package manager\n // so this flow will not be applicable\n // refactor to separate\n if (depGraph && pkgManager) {\n res = convertTestDepGraphResultToLegacy(\n (res as any) as TestDepGraphResponse, // Double \"as\" required by Typescript for dodgy assertions\n depGraph,\n pkgManager,\n options,\n );\n // For Node.js: inject additional information (for remediation etc.) into the response.\n if (payload.modules) {\n res.dependencyCount =\n payload.modules.numDependencies || depGraph.getPkgs().length - 1;\n if (res.vulnerabilities) {\n res.vulnerabilities.forEach((vuln) => {\n if (payload.modules && payload.modules.pluck) {\n const plucked = payload.modules.pluck(\n vuln.from,\n vuln.name,\n vuln.version,\n );\n vuln.__filename = plucked.__filename;\n vuln.shrinkwrap = plucked.shrinkwrap;\n vuln.bundled = plucked.bundled;\n\n // this is an edgecase when we're testing the directly vuln pkg\n if (vuln.from.length === 1) {\n return;\n }\n\n const parentPkg = moduleToObject(vuln.from[1]);\n const parent = payload.modules.pluck(\n vuln.from.slice(0, 2),\n parentPkg.name,\n parentPkg.version,\n );\n vuln.parentDepType = parent.depType;\n }\n });\n }\n }\n }\n // TODO: is this needed? we filter on the other side already based on policy\n // this will move to be filtered server side soon & it will support `'ignore-policy'`\n analytics.add('vulns-pre-policy', res.vulnerabilities.length);\n res.filesystemPolicy = !!payloadPolicy;\n if (!options['ignore-policy']) {\n res.policy = res.policy || (payloadPolicy as string);\n const policy = await snyk.policy.loadFromText(res.policy);\n res = policy.filter(res, root);\n }\n analytics.add('vulns', res.vulnerabilities.length);\n\n if (res.docker && dockerfilePackages) {\n res.vulnerabilities = res.vulnerabilities.map((vuln) => {\n const dockerfilePackage = dockerfilePackages[vuln.name.split('/')[0]];\n if (dockerfilePackage) {\n (vuln as DockerIssue).dockerfileInstruction =\n dockerfilePackage.installCommand;\n }\n (vuln as DockerIssue).dockerBaseImage = res.docker!.baseImage;\n return vuln;\n });\n }\n if (\n options.docker &&\n res.docker?.baseImage &&\n options['exclude-base-image-vulns']\n ) {\n const filteredVulns = res.vulnerabilities.filter(\n (vuln) => (vuln as DockerIssue).dockerfileInstruction,\n );\n // `exclude-base-image-vulns` might have left us with no vulns, so `ok` is now `true`\n if (\n res.vulnerabilities.length !== 0 &&\n filteredVulns.length === 0 &&\n !res.ok\n ) {\n res.ok = true;\n }\n res.vulnerabilities = filteredVulns;\n }\n\n res.uniqueCount = countUniqueVulns(res.vulnerabilities);\n\n return res;\n}\n\nfunction sendTestPayload(\n payload: Payload,\n): Promise<\n LegacyVulnApiResult | TestDepGraphResponse | TestDependenciesResponse\n> {\n const payloadBody = payload.body as any;\n const filesystemPolicy =\n payload.body && !!(payloadBody?.policy || payloadBody?.scanResult?.policy);\n return new Promise((resolve, reject) => {\n makeRequest(payload, (error, res, body) => {\n if (error) {\n return reject(error);\n }\n if (res.statusCode !== 200) {\n const err = handleTestHttpErrorResponse(res, body);\n return reject(err);\n }\n\n body.filesystemPolicy = filesystemPolicy;\n resolve(body);\n });\n });\n}\n\nfunction handleTestHttpErrorResponse(res, body) {\n const { statusCode } = res;\n let err;\n const userMessage = body && body.userMessage;\n switch (statusCode) {\n case 401:\n case 403:\n err = AuthFailedError(userMessage, statusCode);\n err.innerError = body.stack;\n break;\n case 404:\n err = new NotFoundError(userMessage);\n err.innerError = body.stack;\n break;\n case 405:\n err = new UnsupportedFeatureFlagError('reachableVulns');\n err.innerError = body.stack;\n break;\n case 500:\n err = new InternalServerError(userMessage);\n err.innerError = body.stack;\n break;\n default:\n err = new FailedToGetVulnerabilitiesError(userMessage, statusCode);\n err.innerError = body.error;\n }\n return err;\n}\n\nfunction assemblePayloads(\n root: string,\n options: Options & TestOptions,\n): Promise<Payload[]> {\n let isLocal;\n if (options.docker) {\n isLocal = true;\n } else {\n // TODO: Refactor this check so we don't require files when tests are using mocks\n isLocal = fs.existsSync(root);\n }\n analytics.add('local', isLocal);\n\n const ecosystem = getEcosystem(options);\n if (ecosystem) {\n return assembleEcosystemPayloads(ecosystem, options);\n }\n if (isLocal) {\n return assembleLocalPayloads(root, options);\n }\n return assembleRemotePayloads(root, options);\n}\n\n// Payload to send to the Registry for scanning a package from the local filesystem.\nasync function assembleLocalPayloads(\n root,\n options: Options & TestOptions & PolicyOptions,\n): Promise<Payload[]> {\n // For --all-projects packageManager is yet undefined here. Use 'all'\n let analysisTypeText = 'all dependencies for ';\n if (options.docker) {\n analysisTypeText = 'docker dependencies for ';\n } else if (options.packageManager) {\n analysisTypeText = options.packageManager + ' dependencies for ';\n }\n\n const spinnerLbl =\n 'Analyzing ' +\n analysisTypeText +\n (path.relative('.', path.join(root, options.file || '')) ||\n path.relative('..', '.') + ' project dir');\n\n try {\n const payloads: Payload[] = [];\n await spinner.clear<void>(spinnerLbl)();\n if (!options.quiet) {\n await spinner(spinnerLbl);\n }\n\n const deps = await getDepsFromPlugin(root, options);\n const failedResults = (deps as MultiProjectResultCustom).failedResults;\n if (failedResults?.length) {\n await spinner.clear<void>(spinnerLbl)();\n if (!options.json && !options.quiet) {\n console.warn(\n chalk.bold.red(\n `${icon.ISSUE} ${failedResults.length}/${failedResults.length +\n deps.scannedProjects\n .length} potential projects failed to get dependencies.`,\n ),\n );\n failedResults.forEach((f) => {\n if (f.targetFile) {\n console.warn(theme.color.status.error(`${f.targetFile}:`));\n }\n console.warn(theme.color.status.error(` ${f.errMessage}`));\n });\n }\n debug(\n 'getDepsFromPlugin returned failed results, cannot run test/monitor',\n failedResults,\n );\n if (options['fail-fast']) {\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your test request could not be completed.'),\n );\n }\n }\n analytics.add('pluginName', deps.plugin.name);\n const javaVersion = get(\n deps.plugin,\n 'meta.versionBuildInfo.metaBuildVersion.javaVersion',\n null,\n );\n const mvnVersion = get(\n deps.plugin,\n 'meta.versionBuildInfo.metaBuildVersion.mvnVersion',\n null,\n );\n const sbtVersion = get(\n deps.plugin,\n 'meta.versionBuildInfo.metaBuildVersion.sbtVersion',\n null,\n );\n if (javaVersion) {\n analytics.add('javaVersion', javaVersion);\n }\n if (mvnVersion) {\n analytics.add('mvnVersion', mvnVersion);\n }\n if (sbtVersion) {\n analytics.add('sbtVersion', sbtVersion);\n }\n\n for (const scannedProject of deps.scannedProjects) {\n if (!scannedProject.depTree && !scannedProject.depGraph) {\n debug(\n 'scannedProject is missing depGraph or depTree, cannot run test/monitor',\n );\n throw new FailedToRunTestError(\n errorMessageWithRetry('Your test request could not be completed.'),\n );\n }\n\n // prefer dep-graph fallback on dep tree\n // TODO: clean up once dep-graphs only\n const pkg:\n | DepTree\n | depGraphLib.DepGraph\n | undefined = scannedProject.depGraph\n ? scannedProject.depGraph\n : scannedProject.depTree;\n\n if (options['print-deps']) {\n if (scannedProject.depGraph) {\n await spinner.clear<void>(spinnerLbl)();\n maybePrintDepGraph(options, pkg as depGraphLib.DepGraph);\n } else {\n await spinner.clear<void>(spinnerLbl)();\n maybePrintDepTree(options, pkg as DepTree);\n }\n }\n const project = scannedProject as ScannedProjectCustom;\n const packageManager = extractPackageManager(project, deps, options);\n\n if ((pkg as DepTree).docker) {\n const baseImageFromDockerfile = (pkg as DepTree).docker.baseImage;\n if (!baseImageFromDockerfile && options['base-image']) {\n (pkg as DepTree).docker.baseImage = options['base-image'];\n }\n\n if (baseImageFromDockerfile && deps.plugin && deps.plugin.imageLayers) {\n analytics.add('BaseImage', baseImageFromDockerfile);\n analytics.add('imageLayers', deps.plugin.imageLayers);\n }\n }\n\n // todo: normalize what target file gets used across plugins and functions\n const targetFile =\n scannedProject.targetFile || deps.plugin.targetFile || options.file;\n\n // Forcing options.path to be a string as pathUtil requires is to be stringified\n const targetFileRelativePath = targetFile\n ? pathUtil.resolve(\n pathUtil.resolve(`${options.path || root}`),\n targetFile,\n )\n : '';\n\n let targetFileDir;\n\n if (targetFileRelativePath) {\n const { dir } = path.parse(targetFileRelativePath);\n targetFileDir = dir;\n }\n\n const policy = await findAndLoadPolicy(\n root,\n options.docker ? 'docker' : packageManager!,\n options,\n // TODO: fix this and send only send when we used resolve-deps for node\n // it should be a ExpandedPkgTree type instead\n pkg,\n targetFileDir,\n );\n\n analytics.add('packageManager', packageManager);\n if (scannedProject.depGraph) {\n const depGraph = pkg as depGraphLib.DepGraph;\n addPackageAnalytics(depGraph.rootPkg.name, depGraph.rootPkg.version!);\n }\n if (scannedProject.depTree) {\n const depTree = pkg as DepTree;\n addPackageAnalytics(depTree.name!, depTree.version!);\n }\n\n let target: GitTarget | ContainerTarget | null;\n if (scannedProject.depGraph) {\n target = await projectMetadata.getInfo(scannedProject, options);\n } else {\n target = await projectMetadata.getInfo(\n scannedProject,\n options,\n pkg as DepTree,\n );\n }\n\n const originalProjectName = scannedProject.depGraph\n ? (pkg as depGraphLib.DepGraph).rootPkg.name\n : (pkg as DepTree).name;\n\n const body: PayloadBody = {\n // WARNING: be careful changing this as it affects project uniqueness\n targetFile: project.plugin.targetFile,\n\n // TODO: Remove relativePath prop once we gather enough ruby related logs\n targetFileRelativePath: `${targetFileRelativePath}`, // Forcing string\n targetReference: options['target-reference'],\n projectNameOverride: options.projectName,\n originalProjectName,\n policy: policy ? policy.toString() : undefined,\n foundProjectCount: await getExtraProjectCount(root, options, deps),\n displayTargetFile: targetFile,\n docker: (pkg as DepTree).docker,\n hasDevDependencies: (pkg as any).hasDevDependencies,\n target,\n };\n\n let depGraph: depGraphLib.DepGraph;\n if (scannedProject.depGraph) {\n depGraph = scannedProject.depGraph;\n } else {\n // Graphs are more compact and robust representations.\n // Legacy parts of the code are still using trees, but will eventually be fully migrated.\n debug('converting dep-tree to dep-graph', {\n name: (pkg as DepTree).name,\n targetFile: scannedProject.targetFile || options.file,\n });\n depGraph = await depGraphLib.legacy.depTreeToGraph(\n pkg as DepTree,\n packageManager!,\n );\n debug('done converting dep-tree to dep-graph', {\n uniquePkgsCount: depGraph.getPkgs().length,\n });\n }\n\n const pruneIsRequired = options.pruneRepeatedSubdependencies;\n\n if (packageManager) {\n depGraph = await pruneGraph(depGraph, packageManager, pruneIsRequired);\n }\n body.depGraph = depGraph;\n\n if (\n options.reachableVulns &&\n (scannedProject.callGraph as CallGraphError)?.message\n ) {\n const err = scannedProject.callGraph as CallGraphError;\n const analyticsError = err.innerError || err;\n analytics.add('callGraphError', {\n errorType: analyticsError.constructor?.name,\n message: abridgeErrorMessage(\n analyticsError.message.toString(),\n ANALYTICS_PAYLOAD_MAX_LENGTH,\n ),\n });\n alerts.registerAlerts([\n {\n type: 'error',\n name: 'missing-call-graph',\n msg: err.message,\n },\n ]);\n } else if (scannedProject.callGraph) {\n const {\n callGraph,\n nodeCount,\n edgeCount,\n } = serializeCallGraphWithMetrics(\n scannedProject.callGraph as CallGraph,\n );\n debug(\n `Adding call graph to payload, node count: ${nodeCount}, edge count: ${edgeCount}`,\n );\n\n const callGraphMetrics = get(deps.plugin, 'meta.callGraphMetrics', {});\n analytics.add('callGraphMetrics', {\n callGraphEdgeCount: edgeCount,\n callGraphNodeCount: nodeCount,\n ...callGraphMetrics,\n });\n body.callGraph = callGraph;\n }\n const reqUrl =\n config.API +\n (options.testDepGraphDockerEndpoint ||\n options.vulnEndpoint ||\n '/test-dep-graph');\n const payload: Payload = {\n method: 'POST',\n url: reqUrl,\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n qs: common.assembleQueryString(options),\n body,\n };\n\n if (packageManager && ['yarn', 'npm'].indexOf(packageManager) !== -1) {\n const isLockFileBased =\n targetFile &&\n (targetFile.endsWith('package-lock.json') ||\n targetFile.endsWith('yarn.lock'));\n if (!isLockFileBased || options.traverseNodeModules) {\n payload.modules = pkg as DepTreeFromResolveDeps; // See the output of resolve-deps\n }\n }\n payloads.push(payload);\n }\n return payloads;\n } finally {\n await spinner.clear<void>(spinnerLbl)();\n }\n}\n\n// Payload to send to the Registry for scanning a remote package.\nasync function assembleRemotePayloads(root, options): Promise<Payload[]> {\n const pkg = moduleToObject(root);\n debug('testing remote: %s', pkg.name + '@' + pkg.version);\n addPackageAnalytics(pkg.name, pkg.version);\n const encodedName = encodeURIComponent(pkg.name + '@' + pkg.version);\n // options.vulnEndpoint is only used by `snyk protect` (i.e. local filesystem tests)\n const url = `${config.API}${options.vulnEndpoint ||\n `/vuln/${options.packageManager}`}/${encodedName}`;\n return [\n {\n method: 'GET',\n url,\n qs: common.assembleQueryString(options),\n json: true,\n headers: {\n 'x-is-ci': isCI(),\n authorization: getAuthHeader(),\n },\n },\n ];\n}\n\nfunction addPackageAnalytics(name: string, version: string): void {\n analytics.add('packageName', name);\n analytics.add('packageVersion', version);\n analytics.add('package', name + '@' + version);\n}\n\nfunction countUniqueVulns(vulns: AnnotatedIssue[]): number {\n const seen = {};\n for (const curr of vulns) {\n seen[curr.id] = true;\n }\n return Object.keys(seen).length;\n}\n","import * as childProcess from 'child_process';\n\nexport function execute(\n command: string,\n args: string[],\n options?: { cwd: string | undefined },\n): Promise<string> {\n const spawnOptions: childProcess.SpawnOptions = { shell: true };\n if (options && options.cwd) {\n spawnOptions.cwd = options.cwd;\n }\n\n return new Promise((resolve, reject) => {\n let stdout = '';\n let stderr = '';\n\n const proc = childProcess.spawn(command, args, spawnOptions);\n if (proc.stdout) {\n proc.stdout.on('data', (data) => {\n stdout += data;\n });\n }\n if (proc.stderr) {\n proc.stderr.on('data', (data) => {\n stderr += data;\n });\n }\n\n proc.on('close', (code) => {\n if (code !== 0) {\n return reject(stdout || stderr);\n }\n resolve(stdout || stderr);\n });\n });\n}\n","const snykConfig = require('./config');\n\n// This module is kind of \"world object\" that is used to indirectly import modules.\n// This also introduces some circular imports.\n\n// TODO(kyegupov): untangle this, resolve circular imports, convert to Typescript\n\nconst snyk = {};\nmodule.exports = snyk;\n\nsnyk.id = snykConfig.id;\n\nconst apiToken = require('./api-token');\n\n// make snyk.api *always* get the latest api token from the config store\nObject.defineProperty(snyk, 'api', {\n enumerable: true,\n configurable: true,\n get: function() {\n return apiToken.api();\n },\n set: function(value) {\n snykConfig.api = value;\n },\n});\n\nsnyk.test = require('./snyk-test');\nsnyk.policy = require('snyk-policy');\n\n// this is the user config, and not the internal config\nsnyk.config = require('./user-config').config;\n","const gemfile = require('@snyk/gemfile');\n\nmodule.exports = gemfileLockToDependencies;\n\nconst detectCycles = (dep, chain) => {\n if (chain.indexOf(dep) >= 0) {\n const error = Error('Cyclic dependency detected in lockfile');\n const UNPROCESSABLE_ENTITY = 422;\n error.code = UNPROCESSABLE_ENTITY;\n error.meta = { dep, chain };\n throw error;\n }\n};\n\nconst gemfileReducer = (lockFile, allDeps, ancestors) => (deps, dep) => {\n const gemspec = lockFile.specs[dep];\n // If for some reason a dependency isn't included in the specs then its\n // better to just ignore it (otherwise all processing fails).\n // This happens for bundler itself, it isn't included in the Gemfile.lock\n // specs, even if its a dependency! (and that isn't documented anywhere)\n if (gemspec) {\n detectCycles(dep, ancestors);\n if (allDeps.has(dep)) {\n deps[dep] = allDeps.get(dep);\n } else {\n deps[dep] = {\n name: dep,\n version: gemspec.version,\n };\n allDeps.set(dep, deps[dep]);\n deps[dep].dependencies = Object.keys(gemspec)\n .filter((k) => k !== 'version')\n .reduce(gemfileReducer(lockFile, allDeps, ancestors.concat([dep])), {});\n }\n }\n return deps;\n};\n\nfunction gemfileLockToDependencies(fileContents) {\n const lockFile = gemfile.interpret(fileContents, true);\n\n return (\n Object.keys(lockFile.dependencies || {})\n // this is required to sanitise git deps with no exact version\n // listed as `rspec!`\n .map((dep) => dep.match(/[^!]+/)[0])\n .reduce(gemfileReducer(lockFile, new Map(), []), {})\n );\n}\n","module.exports = test;\n\nconst detect = require('../detect');\nconst { runTest } = require('./run-test');\nconst chalk = require('chalk');\nconst pm = require('../package-managers');\nconst { UnsupportedPackageManagerError } = require('../errors');\nconst { isMultiProjectScan } = require('../is-multi-project-scan');\n\nasync function test(root, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (!options) {\n options = {};\n }\n const promise = executeTest(root, options);\n if (callback) {\n promise\n .then((res) => {\n callback(null, res);\n })\n .catch(callback);\n }\n return promise;\n}\n\nasync function executeTest(root, options) {\n try {\n if (!options.allProjects) {\n options.packageManager = detect.detectPackageManager(root, options);\n }\n return run(root, options).then((results) => {\n for (const res of results) {\n if (!res.packageManager) {\n res.packageManager = options.packageManager;\n }\n }\n if (results.length === 1) {\n // Return only one result if only one found as this is the default usecase\n return results[0];\n }\n // For gradle, yarnWorkspaces, allProjects we may be returning more than one result\n return results;\n });\n } catch (error) {\n return Promise.reject(\n chalk.red.bold(error.message ? error.message : error),\n );\n }\n}\n\nfunction run(root, options) {\n const projectType = options.packageManager;\n validateProjectType(options, projectType);\n return runTest(projectType, root, options);\n}\n\nfunction validateProjectType(options, projectType) {\n if (\n !(\n options.docker ||\n isMultiProjectScan(options) ||\n pm.SUPPORTED_PACKAGE_MANAGER_NAME[projectType]\n )\n ) {\n throw new UnsupportedPackageManagerError(projectType);\n }\n}\n"],"names":[],"sourceRoot":""}