snyk 1.885.0 → 1.886.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -9
- package/dist/cli/459.index.js +0 -12
- package/dist/cli/459.index.js.map +1 -1
- package/help/cli-commands/README.md +2 -10
- package/help/cli-commands/iac-describe.md +3 -1
- package/help/cli-commands/iac-report.md +7 -0
- package/help/cli-commands/iac-test.md +63 -4
- package/help/cli-commands/iac.md +16 -126
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -266,27 +266,33 @@ snyk code --help
|
|
|
266
266
|
|
|
267
267
|
# Getting support
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
If you need support using Snyk CLI, please [contact support](https://support.snyk.io).
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
We do not actively monitor GitHub Issues so any issues there may go unnoticed.
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
# Contributing
|
|
274
274
|
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
If you are an external contributor, before working on any contributions, please first [contact support](https://support.snyk.io) to discuss the issue or feature request with us.
|
|
276
|
+
|
|
277
|
+
If you are contributing to Snyk CLI, see [our contributing guidelines](CONTRIBUTING.md)
|
|
278
|
+
|
|
279
|
+
For information on how Snyk CLI is implemented, see [our design decisions](help/_about-this-project/README.md).
|
|
277
280
|
|
|
278
281
|
This repository is a monorepo, also covering other projects and tools:
|
|
279
282
|
|
|
280
|
-
- [`@snyk/
|
|
283
|
+
- [`@snyk/fix`](packages/snyk-fix): npm package for `snyk fix` libraries.
|
|
284
|
+
- [`@snyk/protect`](packages/snyk-protect): npm package for [`snyk-protect`](https://www.npmjs.com/package/@snyk/protect) command.
|
|
281
285
|
|
|
282
|
-
|
|
286
|
+
# Security
|
|
283
287
|
|
|
284
288
|
For any security issues or concerns, please see [SECURITY.md](SECURITY.md) file in this repository.
|
|
285
289
|
|
|
286
|
-
|
|
290
|
+
# Notices
|
|
287
291
|
|
|
288
|
-
|
|
292
|
+
## Snyk API usage policy
|
|
289
293
|
|
|
290
294
|
The use of Snyk's API, whether through the use of the 'snyk' npm package or otherwise, is subject to the [Terms & Conditions](https://snyk.co/ucT6N).
|
|
291
295
|
|
|
296
|
+
---
|
|
297
|
+
|
|
292
298
|
Made with 💜 by Snyk
|
package/dist/cli/459.index.js
CHANGED
|
@@ -308,8 +308,6 @@ exports.DescribeRequiredArgs = [
|
|
|
308
308
|
'drift',
|
|
309
309
|
'only-unmanaged',
|
|
310
310
|
];
|
|
311
|
-
// ⚠ Keep in mind to also update driftctl version used to generate docker images
|
|
312
|
-
// You can edit base image used for snyk final image here https://github.com/snyk/snyk-images/blob/master/alpine
|
|
313
311
|
exports.driftctlVersion = 'v0.25.0';
|
|
314
312
|
const driftctlChecksums = {
|
|
315
313
|
'driftctl_windows_386.exe': 'ce0d01910c0522ba8b4e48ef4e13846d278b6af9a3d4119e686a9cb7197bd786',
|
|
@@ -578,16 +576,6 @@ async function findDriftCtl() {
|
|
|
578
576
|
debug('Found driftctl in cache: %s', dctlPath);
|
|
579
577
|
return dctlPath;
|
|
580
578
|
}
|
|
581
|
-
// lookup in /bin
|
|
582
|
-
// when used in a docker context the default binary path should be used
|
|
583
|
-
{
|
|
584
|
-
dctlPath = '/bin/driftctl';
|
|
585
|
-
const exists = await isExe(dctlPath);
|
|
586
|
-
if (exists) {
|
|
587
|
-
debug('Found driftctl in %s', dctlPath);
|
|
588
|
-
return dctlPath;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
579
|
debug('driftctl not found');
|
|
592
580
|
return '';
|
|
593
581
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"459.index.js","mappings":";;;;;;;;;;;AAAA,4CAAqD;AACrD,0CAAqC;AACrC,iDAAmD;AACnD,2CAA6E;AAE7E,MAAM,IAAI,GAA2B;IACnC,KAAK;IACL,OAAO;IACP,UAAU;IACV,gBAAgB;IAChB,mBAAmB;IACnB,OAAO;IACP,MAAM;IACN,O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BAAa,CAAC,mBAAmB,CAAC;QAC9C,IAAI,CAAC,OAAO,GAAG,gCAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IACzB,CAAC;CACF;AAPD,kDAOC","sources":["webpack://snyk/./src/cli/commands/test/iac-local-execution/assert-iac-options-flag.ts","webpack://snyk/./src/cli/commands/test/iac-local-execution/error-utils.ts","webpack://snyk/./src/cli/commands/test/iac-local-execution/org-settings/get-iac-org-settings.ts","webpack://snyk/./src/lib/errors/describe-exclusive-argument-error.ts","webpack://snyk/./src/lib/errors/describe-required-argument-error.ts","webpack://snyk/./src/lib/iac/drift.ts","webpack://snyk/./src/lib/iac/service-mappings.ts"],"sourcesContent":["import { CustomError } from '../../../../lib/errors';\nimport { args } from '../../../args';\nimport { getErrorStringCode } from './error-utils';\nimport { IaCErrorCodes, IaCTestFlags, TerraformPlanScanMode } from './types';\n\nconst keys: (keyof IaCTestFlags)[] = [\n 'org',\n 'debug',\n 'insecure',\n 'detectionDepth',\n 'severityThreshold',\n 'rules',\n 'json',\n 'sarif',\n 'json-file-output',\n 'sarif-file-output',\n 'v',\n 'version',\n 'h',\n 'help',\n 'q',\n 'quiet',\n 'scan',\n 'report',\n // Tags and attributes\n 'tags',\n 'project-tags',\n 'project-environment',\n 'project-lifecycle',\n 'project-business-criticality',\n 'target-reference',\n // PolicyOptions\n 'ignore-policy',\n 'policy-path',\n];\nconst allowed = new Set<string>(keys);\n\nfunction camelcaseToDash(key: string) {\n return key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n}\n\nfunction getFlagName(key: string) {\n const dashes = key.length === 1 ? '-' : '--';\n const flag = camelcaseToDash(key);\n return `${dashes}${flag}`;\n}\n\nexport class FlagError extends CustomError {\n constructor(key: string) {\n const flag = getFlagName(key);\n const msg = `Unsupported flag \"${flag}\" provided. Run snyk iac test --help for supported flags`;\n super(msg);\n this.code = IaCErrorCodes.FlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class FeatureFlagError extends CustomError {\n constructor(key: string, featureFlag: string, hasSnykPreview?: boolean) {\n const flag = getFlagName(key);\n let msg;\n if (hasSnykPreview) {\n msg = `Flag \"${flag}\" is only supported if feature flag '${featureFlag}' is enabled. The feature flag can be enabled via Snyk Preview if you are on the Enterprise Plan`;\n } else {\n msg = `Flag \"${flag}\" is only supported if feature flag \"${featureFlag}\" is enabled. To enable it, please contact Snyk support.`;\n }\n super(msg);\n this.code = IaCErrorCodes.FeatureFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class FlagValueError extends CustomError {\n constructor(key: string, value: string) {\n const flag = getFlagName(key);\n const msg = `Unsupported value \"${value}\" provided to flag \"${flag}\".\\nSupported values are: ${SUPPORTED_TF_PLAN_SCAN_MODES.join(\n ', ',\n )}`;\n super(msg);\n this.code = IaCErrorCodes.FlagValueError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class UnsupportedEntitlementFlagError extends CustomError {\n constructor(key: string, entitlementName: string) {\n const flag = getFlagName(key);\n super(\n `Unsupported flag: ${flag} - Missing the ${entitlementName} entitlement`,\n );\n this.code = IaCErrorCodes.UnsupportedEntitlementFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = `Flag \"${flag}\" is currently not supported for this org. To enable it, please contact snyk support.`;\n }\n}\n\nexport class UnsupportedEntitlementCommandError extends CustomError {\n constructor(key: string, entitlementName: string) {\n super(\n `Unsupported command: ${key} - Missing the ${entitlementName} entitlement`,\n );\n this.code = IaCErrorCodes.UnsupportedEntitlementFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = `Command \"${key}\" is currently not supported for this org. To enable it, please contact snyk support.`;\n }\n}\n\n/**\n * Validates the command line flags passed to the snyk iac test\n * command. The current argument parsing is very permissive and\n * allows unknown flags to be provided without valdiation.\n *\n * For snyk iac we need to explictly validate the flags to avoid\n * misconfigurations and typos. For example, if the --experimental\n * flag were to be mis-spelled we would end up sending the client\n * data to our backend rather than running it locally as intended.\n * @param argv command line args passed to the process\n */\nexport function assertIaCOptionsFlags(argv: string[]) {\n // We process the process.argv so we don't get default values.\n const parsed = args(argv);\n for (const key of Object.keys(parsed.options)) {\n // The _ property is a special case that contains non\n // flag strings passed to the command line (usually files)\n // and `iac` is the command provided.\n if (key !== '_' && key !== 'iac' && !allowed.has(key)) {\n throw new FlagError(key);\n }\n }\n\n if (parsed.options.scan) {\n assertTerraformPlanModes(parsed.options.scan as string);\n }\n}\n\nconst SUPPORTED_TF_PLAN_SCAN_MODES = [\n TerraformPlanScanMode.DeltaScan,\n TerraformPlanScanMode.FullScan,\n];\n\nfunction assertTerraformPlanModes(scanModeArgValue: string) {\n if (\n !SUPPORTED_TF_PLAN_SCAN_MODES.includes(\n scanModeArgValue as TerraformPlanScanMode,\n )\n ) {\n throw new FlagValueError('scan', scanModeArgValue);\n }\n}\n\nexport function isIacShareResultsOptions(options) {\n return options.iac && options.report;\n}\n","import { IaCErrorCodes } from './types';\n\nexport function getErrorStringCode(code: number): string {\n const errorName = IaCErrorCodes[code];\n if (!errorName) {\n return 'INVALID_IAC_ERROR';\n }\n let result = errorName.replace(/([A-Z])/g, '_$1');\n if (result.charAt(0) === '_') {\n result = result.substring(1);\n }\n return result.toUpperCase();\n}\n","import { IaCErrorCodes, IacOrgSettings } from '../types';\nimport { Payload } from '../../../../../lib/snyk-test/types';\nimport config from '../../../../../lib/config';\nimport { isCI } from '../../../../../lib/is-ci';\nimport { api } from '../../../../../lib/api-token';\nimport { makeRequest } from '../../../../../lib/request';\nimport { CustomError } from '../../../../../lib/errors';\nimport { getErrorStringCode } from '../error-utils';\n\nexport function getIacOrgSettings(\n publicOrgId?: string,\n): Promise<IacOrgSettings> {\n const payload: Payload = {\n method: 'get',\n url: config.API + '/iac-org-settings',\n json: true,\n qs: { org: publicOrgId },\n headers: {\n 'x-is-ci': isCI(),\n authorization: `token ${api()}`,\n },\n };\n\n return new Promise((resolve, reject) => {\n makeRequest(payload, (error, res) => {\n if (error) {\n return reject(error);\n }\n if (res.statusCode < 200 || res.statusCode > 299) {\n return reject(new FailedToGetIacOrgSettingsError());\n }\n resolve(res.body);\n });\n });\n}\n\nexport class FailedToGetIacOrgSettingsError extends CustomError {\n constructor(message?: string) {\n super(message || 'Failed to fetch IaC organization settings');\n this.code = IaCErrorCodes.FailedToGetIacOrgSettingsError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage =\n 'We failed to fetch your organization settings, including custom severity overrides for infrastructure-as-code policies. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output.';\n }\n}\n","import { CustomError } from './custom-error';\nimport { DescribeExclusiveArgs } from '../iac/drift';\n\nexport class DescribeExclusiveArgumentError extends CustomError {\n constructor() {\n super(\n 'Please use only one of these arguments: ' +\n DescribeExclusiveArgs.join(', '),\n );\n }\n}\n","import { CustomError } from './custom-error';\nimport { DescribeRequiredArgs } from '../iac/drift';\n\nexport class DescribeRequiredArgumentError extends CustomError {\n constructor() {\n super(\n 'Describe command require one of these arguments: ' +\n DescribeRequiredArgs.join(', '),\n );\n }\n}\n","import * as debugLib from 'debug';\nimport * as child_process from 'child_process';\nimport { StdioOptions } from 'child_process';\nimport * as os from 'os';\nimport envPaths from 'env-paths';\nimport * as fs from 'fs';\nimport { spinner } from '../spinner';\nimport { makeRequest } from '../request';\nimport config from '../../lib/config';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport {\n createIgnorePattern,\n verifyServiceMappingExists,\n} from './service-mappings';\nimport { EXIT_CODES } from '../../cli/exit-codes';\nimport {\n DescribeOptions,\n DriftAnalysis,\n DriftctlExecutionResult,\n DriftCTLOptions,\n FmtOptions,\n GenDriftIgnoreOptions,\n} from './types';\nimport { TimerMetricInstance } from '../metrics';\nimport * as analytics from '../../lib/analytics';\nimport { Policy } from '../policy/find-and-load-policy';\nimport { DescribeExclusiveArgumentError } from '../errors/describe-exclusive-argument-error';\nimport { DescribeRequiredArgumentError } from '../errors/describe-required-argument-error';\n\nconst cachePath = config.CACHE_PATH ?? envPaths('snyk').cache;\nconst debug = debugLib('drift');\n\nexport const DCTL_EXIT_CODES = {\n EXIT_IN_SYNC: 0,\n EXIT_NOT_IN_SYNC: 1,\n EXIT_ERROR: 2,\n};\n\nexport const DescribeExclusiveArgs = [\n 'all',\n 'only-managed',\n 'drift',\n 'only-unmanaged',\n];\n\nexport const DescribeRequiredArgs = [\n 'all',\n 'only-managed',\n 'drift',\n 'only-unmanaged',\n];\n\n// ⚠ Keep in mind to also update driftctl version used to generate docker images\n// You can edit base image used for snyk final image here https://github.com/snyk/snyk-images/blob/master/alpine\nexport const driftctlVersion = 'v0.25.0';\n\nconst driftctlChecksums = {\n 'driftctl_windows_386.exe':\n 'ce0d01910c0522ba8b4e48ef4e13846d278b6af9a3d4119e686a9cb7197bd786',\n driftctl_darwin_amd64:\n '587eb76144a58ffb656740b18c163fdfc30f590744cae3f08d232c841b10f940',\n driftctl_linux_386:\n '73c56cbb8ad86e90bf349f67f5c62307fd0f976b964d8f10da3578124baff2f2',\n driftctl_linux_amd64:\n '6ec764a36571b19408d89b07cc7c601dc30e68712f3a5822fe81ea392230dcfc',\n driftctl_linux_arm64:\n '7168fa70ee5997d46ebf9c0aaaabb063e7d8acb2cb6de841e364281b6762b158',\n 'driftctl_windows_arm64.exe':\n '432ff6d1ad0ad99f47d6482abf097fd999231f3f1df688c8bf6cdaa157c3b81b',\n driftctl_darwin_arm64:\n '16ce674a17fb1b2feab8a8fedcd2f3dca0d28fbce8e97dc351e51825c2a289ac',\n 'driftctl_windows_arm.exe':\n '295b5a979f42aed83b163451950b35627533e63583de641a2bea5e8ada6e8ca7',\n driftctl_linux_arm:\n '634b61400733ea60e45e2ea57b8ede5083711e8615f61695ffe7ee2ec9a627dd',\n 'driftctl_windows_amd64.exe':\n '4ef220ea8aaca51129086f69c0634d39fa99d50d965fe2ad3644d4f7e19e24f6',\n};\n\nconst dctlBaseUrl = 'https://static.snyk.io/cli/driftctl/';\nconst driftctlPath = path.join(cachePath, 'driftctl_' + driftctlVersion);\nconst driftctlDefaultOptions = ['--no-version-check'];\nlet isBinaryDownloaded = false;\n\nexport const validateArgs = (options: DriftCTLOptions): void => {\n if (options.kind === 'describe') {\n return validateDescribeArgs(options as DescribeOptions);\n }\n};\n\nconst validateDescribeArgs = (options: DescribeOptions): void => {\n // Check that there is no more than one of the exclusive arguments\n let count = 0;\n for (const describeExclusiveArg of DescribeExclusiveArgs) {\n if (options[describeExclusiveArg]) {\n count++;\n }\n }\n if (count > 1) {\n throw new DescribeExclusiveArgumentError();\n }\n\n // Check we have one of the required arguments\n count = 0;\n for (const describeRequiredArgs of DescribeRequiredArgs) {\n if (options[describeRequiredArgs]) {\n count++;\n }\n }\n if (count === 0) {\n throw new DescribeRequiredArgumentError();\n }\n};\n\nexport const generateArgs = (\n options: DriftCTLOptions,\n driftIgnore?: string[],\n): string[] => {\n if (options.kind === 'describe') {\n return generateScanFlags(options as DescribeOptions, driftIgnore);\n }\n\n if (options.kind === 'gen-driftignore') {\n return generateGenDriftIgnoreFlags(options as GenDriftIgnoreOptions);\n }\n\n if (options.kind === 'fmt') {\n return generateFmtFlags(options as FmtOptions);\n }\n\n throw 'Unsupported command';\n};\n\nexport const generateGenDriftIgnoreFlags = (\n options: GenDriftIgnoreOptions,\n): string[] => {\n const args: string[] = ['gen-driftignore', ...driftctlDefaultOptions];\n\n if (options.input) {\n args.push('--input');\n args.push(options.input);\n }\n\n if (options.output) {\n args.push('--output');\n args.push(options.output);\n }\n\n if (options['exclude-changed']) {\n args.push('--exclude-changed');\n }\n\n if (options['exclude-missing']) {\n args.push('--exclude-missing');\n }\n\n if (options['exclude-unmanaged']) {\n args.push('--exclude-unmanaged');\n }\n\n return args;\n};\n\nconst generateFmtFlags = (options: FmtOptions): string[] => {\n const args: string[] = ['fmt', ...driftctlDefaultOptions];\n\n if (options.json) {\n args.push('--output');\n args.push('json://stdout');\n }\n\n if (options['json-file-output']) {\n args.push('--output');\n args.push('json://' + options['json-file-output']);\n }\n\n if (options.html) {\n args.push('--output');\n args.push('html://stdout');\n }\n\n if (options['html-file-output']) {\n args.push('--output');\n args.push('html://' + options['html-file-output']);\n }\n\n return args;\n};\n\nconst generateScanFlags = (\n options: DescribeOptions,\n driftIgnore?: string[],\n): string[] => {\n const args: string[] = ['scan', ...driftctlDefaultOptions];\n\n if (options.quiet) {\n args.push('--quiet');\n }\n\n if (options.filter) {\n args.push('--filter');\n args.push(options.filter);\n }\n\n args.push('--output');\n args.push('json://stdout');\n\n if (options['fetch-tfstate-headers']) {\n args.push('--headers');\n args.push(options['fetch-tfstate-headers']);\n }\n\n if (options['tfc-token']) {\n args.push('--tfc-token');\n args.push(options['tfc-token']);\n }\n\n if (options['tfc-endpoint']) {\n args.push('--tfc-endpoint');\n args.push(options['tfc-endpoint']);\n }\n\n if (options['tf-provider-version']) {\n args.push('--tf-provider-version');\n args.push(options['tf-provider-version']);\n }\n\n if (options.strict) {\n args.push('--strict');\n }\n\n if (options.deep) {\n args.push('--deep');\n }\n\n if (options['only-managed'] || options.drift) {\n args.push('--only-managed');\n }\n\n if (options['only-unmanaged']) {\n args.push('--only-unmanaged');\n }\n\n if (options.driftignore) {\n args.push('--driftignore');\n args.push(options.driftignore);\n }\n\n if (options['tf-lockfile']) {\n args.push('--tf-lockfile');\n args.push(options['tf-lockfile']);\n }\n\n if (driftIgnore && driftIgnore.length > 0) {\n args.push('--ignore');\n args.push(driftIgnore.join(','));\n }\n\n let configDir = cachePath;\n createIfNotExists(cachePath);\n if (options['config-dir']) {\n configDir = options['config-dir'];\n }\n args.push('--config-dir');\n args.push(configDir);\n\n if (options.from) {\n const froms = options.from.split(',');\n for (const f of froms) {\n args.push('--from');\n args.push(f);\n }\n }\n\n let to = 'aws+tf';\n if (options.to) {\n to = options.to;\n }\n args.push('--to');\n args.push(to);\n\n if (options.service) {\n const services = options.service.split(',');\n verifyServiceMappingExists(services);\n args.push('--ignore');\n args.push(createIgnorePattern(services));\n }\n\n debug(args);\n\n return args;\n};\n\nexport function translateExitCode(exitCode: number | null): number {\n switch (exitCode) {\n case DCTL_EXIT_CODES.EXIT_IN_SYNC:\n return 0;\n case DCTL_EXIT_CODES.EXIT_NOT_IN_SYNC:\n return EXIT_CODES.VULNS_FOUND;\n case DCTL_EXIT_CODES.EXIT_ERROR:\n return EXIT_CODES.ERROR;\n default:\n debug('driftctl returned %d', exitCode);\n return EXIT_CODES.ERROR;\n }\n}\n\nexport const parseDriftAnalysisResults = (input: string): DriftAnalysis => {\n return JSON.parse(input) as DriftAnalysis;\n};\n\nexport const runDriftCTL = async ({\n options,\n driftIgnore,\n input,\n stdio,\n}: {\n options: DriftCTLOptions;\n driftIgnore?: string[];\n input?: string;\n stdio?: StdioOptions;\n}): Promise<DriftctlExecutionResult> => {\n const path = await findOrDownload();\n await validateArgs(options);\n const args = await generateArgs(options, driftIgnore);\n\n if (!stdio) {\n stdio = ['pipe', 'pipe', 'inherit'];\n }\n\n debug('running driftctl %s ', args.join(' '));\n\n const p = child_process.spawn(path, args, {\n stdio,\n env: { ...process.env, DCTL_IS_SNYK: 'true' },\n });\n\n let stdout = '';\n return new Promise<DriftctlExecutionResult>((resolve, reject) => {\n if (input) {\n p.stdin?.write(input);\n p.stdin?.end();\n }\n p.on('error', (error) => {\n reject(error);\n });\n\n p.stdout?.on('data', (data) => {\n stdout += data;\n });\n\n p.on('exit', (code) => {\n resolve({ code: translateExitCode(code), stdout });\n });\n });\n};\n\nasync function findOrDownload(): Promise<string> {\n let dctl = await findDriftCtl();\n if (isBinaryDownloaded) {\n return dctl;\n }\n let downloadDuration = 0;\n let binaryExist = true;\n if (dctl === '') {\n binaryExist = false;\n try {\n createIfNotExists(cachePath);\n dctl = driftctlPath;\n\n const duration = new TimerMetricInstance('driftctl_download');\n duration.start();\n await download(driftctlUrl(), dctl);\n duration.stop();\n\n downloadDuration = Math.round((duration.getValue() as number) / 1000);\n } catch (err) {\n return Promise.reject(err);\n }\n }\n analytics.add('iac-drift-binary-already-exist', binaryExist);\n analytics.add('iac-drift-binary-download-duration-seconds', downloadDuration);\n isBinaryDownloaded = true;\n return dctl;\n}\n\nasync function findDriftCtl(): Promise<string> {\n // lookup in custom path contained in env var DRIFTCTL_PATH\n let dctlPath = config.DRIFTCTL_PATH;\n if (dctlPath != null) {\n const exists = await isExe(dctlPath);\n if (exists) {\n debug('Found driftctl in $DRIFTCTL_PATH: %s', dctlPath);\n return dctlPath;\n }\n }\n\n // lookup in app cache\n dctlPath = driftctlPath;\n const exists = await isExe(dctlPath);\n if (exists) {\n debug('Found driftctl in cache: %s', dctlPath);\n return dctlPath;\n }\n\n // lookup in /bin\n // when used in a docker context the default binary path should be used\n {\n dctlPath = '/bin/driftctl';\n const exists = await isExe(dctlPath);\n if (exists) {\n debug('Found driftctl in %s', dctlPath);\n return dctlPath;\n }\n }\n\n debug('driftctl not found');\n return '';\n}\n\nasync function download(url, destination: string): Promise<boolean> {\n debug('downloading driftctl into %s', destination);\n\n const payload = {\n method: 'GET',\n url: url,\n output: destination,\n follow: 3,\n };\n\n await spinner('Downloading...');\n return new Promise<boolean>((resolve, reject) => {\n makeRequest(payload, function(err, res, body) {\n try {\n if (err) {\n reject(\n new Error('Could not download driftctl from ' + url + ': ' + err),\n );\n return;\n }\n if (res.statusCode !== 200) {\n reject(\n new Error(\n 'Could not download driftctl from ' + url + ': ' + res.statusCode,\n ),\n );\n return;\n }\n\n validateChecksum(body);\n\n fs.writeFileSync(destination, body);\n debug('File saved: ' + destination);\n\n fs.chmodSync(destination, 0o744);\n resolve(true);\n } finally {\n spinner.clearAll();\n }\n });\n });\n}\n\nfunction validateChecksum(body: string) {\n // only validate if we downloaded the official driftctl binary\n if (config.DRIFTCTL_URL || config.DRIFTCTL_PATH) {\n return;\n }\n\n const computedHash = crypto\n .createHash('sha256')\n .update(body)\n .digest('hex');\n const givenHash = driftctlChecksums[driftctlFileName()];\n\n if (computedHash != givenHash) {\n throw new Error('Downloaded file has inconsistent checksum...');\n }\n}\n\nfunction driftctlFileName(): string {\n let platform = 'linux';\n switch (os.platform()) {\n case 'darwin':\n platform = 'darwin';\n break;\n case 'win32':\n platform = 'windows';\n break;\n }\n\n let arch = 'amd64';\n switch (os.arch()) {\n case 'ia32':\n case 'x32':\n arch = '386';\n break;\n case 'arm':\n arch = 'arm';\n break;\n case 'arm64':\n arch = 'arm64';\n break;\n }\n\n let ext = '';\n switch (os.platform()) {\n case 'win32':\n ext = '.exe';\n break;\n }\n\n return `driftctl_${platform}_${arch}${ext}`;\n}\n\nfunction driftctlUrl(): string {\n if (config.DRIFTCTL_URL) {\n return config.DRIFTCTL_URL;\n }\n\n return `${dctlBaseUrl}/${driftctlVersion}/${driftctlFileName()}`;\n}\n\nfunction isExe(dctlPath: string): Promise<boolean> {\n return new Promise<boolean>((resolve) => {\n fs.access(dctlPath, fs.constants.X_OK, (err) => {\n if (err) {\n resolve(false);\n return;\n }\n resolve(true);\n });\n });\n}\n\nfunction createIfNotExists(path: string) {\n if (!fs.existsSync(path)) {\n fs.mkdirSync(path, { recursive: true });\n }\n}\n\nexport function driftignoreFromPolicy(policy: Policy | undefined): string[] {\n const excludeSection = 'iac-drift';\n if (!policy || !policy.exclude || !(excludeSection in policy.exclude)) {\n return [];\n }\n return policy.exclude[excludeSection];\n}\n","import { CustomError } from '../errors';\nimport { IaCErrorCodes } from '../../cli/commands/test/iac-local-execution/types';\nimport { getErrorStringCode } from '../../cli/commands/test/iac-local-execution/error-utils';\n\nexport const services2resources = new Map<string, Array<string>>([\n // Amazon\n [\n 'aws_s3',\n [\n 'aws_s3_bucket',\n 'aws_s3_bucket_analytics_configuration',\n 'aws_s3_bucket_inventory',\n 'aws_s3_bucket_metric',\n 'aws_s3_bucket_notification',\n 'aws_s3_bucket_policy',\n ],\n ],\n [\n 'aws_ec2',\n [\n 'aws_instance',\n 'aws_key_pair',\n 'aws_ami',\n 'aws_ebs_snapshot',\n 'aws_ebs_volume',\n 'aws_eip',\n 'aws_eip_association',\n 'aws_volume_attachment',\n 'aws_launch_configuration',\n 'aws_launch_template',\n ],\n ],\n ['aws_lambda', ['aws_lambda_function', 'aws_lambda_event_source_mapping']],\n [\n 'aws_rds',\n [\n 'aws_db_instance',\n 'aws_db_subnet_group',\n 'aws_rds_cluster',\n 'aws_rds_cluster_endpoint',\n 'aws_rds_cluster_instance',\n ],\n ],\n ['aws_route53', ['aws_route53_record', 'aws_route53_zone']],\n [\n 'aws_iam',\n [\n 'aws_iam_access_key',\n 'aws_iam_policy',\n 'aws_iam_policy_attachment',\n 'aws_iam_role',\n 'aws_iam_role_policy',\n 'aws_iam_role_policy_attachment',\n 'aws_iam_user',\n 'aws_iam_user_policy',\n 'aws_iam_user_policy_attachment',\n ],\n ],\n [\n 'aws_vpc',\n [\n 'aws_security_group',\n 'aws_security_group_rule',\n 'aws_subnet',\n 'aws_default_vpc',\n 'aws_vpc',\n 'aws_default_security_group',\n 'aws_route_table',\n 'aws_default_route_table',\n 'aws_route',\n 'aws_route_table_association',\n 'aws_nat_gateway',\n 'aws_internet_gateway',\n ],\n ],\n [\n 'aws_api_gateway',\n [\n 'aws_api_gateway_resource',\n 'aws_api_gateway_rest_api',\n 'aws_api_gateway_account',\n 'aws_api_gateway_api_key',\n 'aws_api_gateway_authorizer',\n 'aws_api_gateway_base_path_mapping',\n 'aws_api_gateway_domain_name',\n 'aws_api_gateway_gateway_response',\n 'aws_api_gateway_integration',\n 'aws_api_gateway_integration_response',\n 'aws_api_gateway_method',\n 'aws_api_gateway_method_response',\n 'aws_api_gateway_method_settings',\n 'aws_api_gateway_model',\n 'aws_api_gateway_request_validator',\n 'aws_api_gateway_rest_api_policy',\n 'aws_api_gateway_stage',\n 'aws_api_gateway_vpc_link',\n ],\n ],\n [\n 'aws_apigatewayv2',\n [\n 'aws_apigatewayv2_api',\n 'aws_apigatewayv2_api_mapping',\n 'aws_apigatewayv2_authorizer',\n 'aws_apigatewayv2_deployment',\n 'aws_apigatewayv2_domain_name',\n 'aws_apigatewayv2_integration',\n 'aws_apigatewayv2_integration_response',\n 'aws_apigatewayv2_model',\n 'aws_apigatewayv2_route',\n 'aws_apigatewayv2_route_response',\n 'aws_apigatewayv2_stage',\n 'aws_apigatewayv2_vpc_link',\n ],\n ],\n ['aws_sqs', ['aws_sqs_queue', 'aws_sqs_queue_policy']],\n [\n 'aws_sns',\n ['aws_sns_topic', 'aws_sns_topic_policy', 'aws_sns_topic_subscription'],\n ],\n ['aws_ecr', ['aws_ecr_repository']],\n ['aws_cloudfront', ['aws_cloudfront_distribution']],\n ['aws_kms', ['aws_kms_key', 'aws_kms_alias']],\n ['aws_dynamodb', ['aws_dynamodb_table']],\n // Azure\n ['azure_base', ['azurerm_resource_group']],\n ['azure_compute', ['azurerm_image', 'azurerm_ssh_public_key']],\n ['azure_storage', ['azurerm_storage_account', 'azurerm_storage_container']],\n [\n 'azure_network',\n [\n 'azurerm_resource_group',\n 'azurerm_subnet',\n 'azurerm_public_ip',\n 'azurerm_firewall',\n 'azurerm_route',\n 'azurerm_route_table',\n 'azurerm_network_security_group',\n ],\n ],\n ['azure_container', ['azurerm_container_registry']],\n [\n 'azure_database',\n ['azurerm_postgresql_server', 'azurerm_postgresql_database'],\n ],\n ['azure_loadbalancer', ['azurerm_lb', 'azurerm_lb_rule']],\n [\n 'azure_private_dns',\n [\n 'azurerm_private_dns_a_record',\n 'azurerm_private_dns_aaaa_record',\n 'azurerm_private_dns_cname_record',\n 'azurerm_private_dns_mx_record',\n 'azurerm_private_dns_ptr_record',\n 'azurerm_private_dns_srv_record',\n 'azurerm_private_dns_txt_record',\n 'azurerm_private_dns_zone',\n ],\n ],\n\n // Google\n [\n 'google_cloud_platform',\n [\n 'google_project_iam_binding',\n 'google_project_iam_member',\n 'google_project_iam_policy',\n ],\n ],\n [\n 'google_cloud_storage',\n [\n 'google_storage_bucket',\n 'google_storage_bucket_iam_binding',\n 'google_storage_bucket_iam_member',\n 'google_storage_bucket_iam_policy',\n ],\n ],\n [\n 'google_compute_engine',\n [\n 'google_compute_address',\n 'google_compute_disk',\n 'google_compute_global_address',\n 'google_compute_firewall',\n 'google_compute_health_check',\n 'google_compute_image',\n 'google_compute_instance',\n 'google_compute_instance_group',\n 'google_compute_network',\n 'google_compute_node_group',\n 'google_compute_router',\n 'google_compute_subnetwork',\n ],\n ],\n ['google_cloud_dns', ['google_dns_managed_zone']],\n [\n 'google_cloud_bigtable',\n ['google_bigtable_instance', 'google_bigtable_table'],\n ],\n [\n 'google_cloud_bigquery',\n ['google_bigquery_table', 'google_bigquery_dataset'],\n ],\n ['google_cloud_functions', ['google_cloudfunctions_function']],\n ['google_cloud_sql', ['google_sql_database_instance']],\n ['google_cloud_run', ['google_cloud_run_service']],\n]);\n\nexport function verifyServiceMappingExists(services: string[]): void {\n if (services.length == 0) {\n throw new InvalidServiceError('');\n }\n for (const s of services) {\n if (!services2resources.has(s)) {\n throw new InvalidServiceError(\n `We were unable to match service \"${s}\". Please provide a valid service name: ${existingServiceNames()}`,\n );\n }\n }\n}\n\nfunction existingServiceNames(): string {\n let res = '';\n for (const s of services2resources.keys()) {\n res += `${s},`;\n }\n return res.substring(0, res.length - 1);\n}\n\nexport function createIgnorePattern(services: string[]): string {\n return createIgnorePatternWithMap(services, services2resources);\n}\n\nexport function createIgnorePatternWithMap(\n services: string[],\n serviceMap: Map<string, Array<string>>,\n): string {\n let res = '*';\n const seenResources = new Set<string>();\n for (const s of services) {\n const resourcePatterns = serviceMap.get(s);\n for (const rp of resourcePatterns || []) {\n // A resource might belong to multiple services, skip it if already processed\n if (seenResources.has(rp)) {\n continue;\n }\n res += `,!${rp}`;\n seenResources.add(rp);\n }\n }\n return res;\n}\n\nexport class InvalidServiceError extends CustomError {\n constructor(msg: string) {\n super(msg);\n this.code = IaCErrorCodes.InvalidServiceError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"459.index.js","mappings":";;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C,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;IACzB,CAAC;CACF;AAPD,kDAOC","sources":["webpack://snyk/./src/cli/commands/test/iac-local-execution/assert-iac-options-flag.ts","webpack://snyk/./src/cli/commands/test/iac-local-execution/error-utils.ts","webpack://snyk/./src/cli/commands/test/iac-local-execution/org-settings/get-iac-org-settings.ts","webpack://snyk/./src/lib/errors/describe-exclusive-argument-error.ts","webpack://snyk/./src/lib/errors/describe-required-argument-error.ts","webpack://snyk/./src/lib/iac/drift.ts","webpack://snyk/./src/lib/iac/service-mappings.ts"],"sourcesContent":["import { CustomError } from '../../../../lib/errors';\nimport { args } from '../../../args';\nimport { getErrorStringCode } from './error-utils';\nimport { IaCErrorCodes, IaCTestFlags, TerraformPlanScanMode } from './types';\n\nconst keys: (keyof IaCTestFlags)[] = [\n 'org',\n 'debug',\n 'insecure',\n 'detectionDepth',\n 'severityThreshold',\n 'rules',\n 'json',\n 'sarif',\n 'json-file-output',\n 'sarif-file-output',\n 'v',\n 'version',\n 'h',\n 'help',\n 'q',\n 'quiet',\n 'scan',\n 'report',\n // Tags and attributes\n 'tags',\n 'project-tags',\n 'project-environment',\n 'project-lifecycle',\n 'project-business-criticality',\n 'target-reference',\n // PolicyOptions\n 'ignore-policy',\n 'policy-path',\n];\nconst allowed = new Set<string>(keys);\n\nfunction camelcaseToDash(key: string) {\n return key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n}\n\nfunction getFlagName(key: string) {\n const dashes = key.length === 1 ? '-' : '--';\n const flag = camelcaseToDash(key);\n return `${dashes}${flag}`;\n}\n\nexport class FlagError extends CustomError {\n constructor(key: string) {\n const flag = getFlagName(key);\n const msg = `Unsupported flag \"${flag}\" provided. Run snyk iac test --help for supported flags`;\n super(msg);\n this.code = IaCErrorCodes.FlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class FeatureFlagError extends CustomError {\n constructor(key: string, featureFlag: string, hasSnykPreview?: boolean) {\n const flag = getFlagName(key);\n let msg;\n if (hasSnykPreview) {\n msg = `Flag \"${flag}\" is only supported if feature flag '${featureFlag}' is enabled. The feature flag can be enabled via Snyk Preview if you are on the Enterprise Plan`;\n } else {\n msg = `Flag \"${flag}\" is only supported if feature flag \"${featureFlag}\" is enabled. To enable it, please contact Snyk support.`;\n }\n super(msg);\n this.code = IaCErrorCodes.FeatureFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class FlagValueError extends CustomError {\n constructor(key: string, value: string) {\n const flag = getFlagName(key);\n const msg = `Unsupported value \"${value}\" provided to flag \"${flag}\".\\nSupported values are: ${SUPPORTED_TF_PLAN_SCAN_MODES.join(\n ', ',\n )}`;\n super(msg);\n this.code = IaCErrorCodes.FlagValueError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n\nexport class UnsupportedEntitlementFlagError extends CustomError {\n constructor(key: string, entitlementName: string) {\n const flag = getFlagName(key);\n super(\n `Unsupported flag: ${flag} - Missing the ${entitlementName} entitlement`,\n );\n this.code = IaCErrorCodes.UnsupportedEntitlementFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = `Flag \"${flag}\" is currently not supported for this org. To enable it, please contact snyk support.`;\n }\n}\n\nexport class UnsupportedEntitlementCommandError extends CustomError {\n constructor(key: string, entitlementName: string) {\n super(\n `Unsupported command: ${key} - Missing the ${entitlementName} entitlement`,\n );\n this.code = IaCErrorCodes.UnsupportedEntitlementFlagError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = `Command \"${key}\" is currently not supported for this org. To enable it, please contact snyk support.`;\n }\n}\n\n/**\n * Validates the command line flags passed to the snyk iac test\n * command. The current argument parsing is very permissive and\n * allows unknown flags to be provided without valdiation.\n *\n * For snyk iac we need to explictly validate the flags to avoid\n * misconfigurations and typos. For example, if the --experimental\n * flag were to be mis-spelled we would end up sending the client\n * data to our backend rather than running it locally as intended.\n * @param argv command line args passed to the process\n */\nexport function assertIaCOptionsFlags(argv: string[]) {\n // We process the process.argv so we don't get default values.\n const parsed = args(argv);\n for (const key of Object.keys(parsed.options)) {\n // The _ property is a special case that contains non\n // flag strings passed to the command line (usually files)\n // and `iac` is the command provided.\n if (key !== '_' && key !== 'iac' && !allowed.has(key)) {\n throw new FlagError(key);\n }\n }\n\n if (parsed.options.scan) {\n assertTerraformPlanModes(parsed.options.scan as string);\n }\n}\n\nconst SUPPORTED_TF_PLAN_SCAN_MODES = [\n TerraformPlanScanMode.DeltaScan,\n TerraformPlanScanMode.FullScan,\n];\n\nfunction assertTerraformPlanModes(scanModeArgValue: string) {\n if (\n !SUPPORTED_TF_PLAN_SCAN_MODES.includes(\n scanModeArgValue as TerraformPlanScanMode,\n )\n ) {\n throw new FlagValueError('scan', scanModeArgValue);\n }\n}\n\nexport function isIacShareResultsOptions(options) {\n return options.iac && options.report;\n}\n","import { IaCErrorCodes } from './types';\n\nexport function getErrorStringCode(code: number): string {\n const errorName = IaCErrorCodes[code];\n if (!errorName) {\n return 'INVALID_IAC_ERROR';\n }\n let result = errorName.replace(/([A-Z])/g, '_$1');\n if (result.charAt(0) === '_') {\n result = result.substring(1);\n }\n return result.toUpperCase();\n}\n","import { IaCErrorCodes, IacOrgSettings } from '../types';\nimport { Payload } from '../../../../../lib/snyk-test/types';\nimport config from '../../../../../lib/config';\nimport { isCI } from '../../../../../lib/is-ci';\nimport { api } from '../../../../../lib/api-token';\nimport { makeRequest } from '../../../../../lib/request';\nimport { CustomError } from '../../../../../lib/errors';\nimport { getErrorStringCode } from '../error-utils';\n\nexport function getIacOrgSettings(\n publicOrgId?: string,\n): Promise<IacOrgSettings> {\n const payload: Payload = {\n method: 'get',\n url: config.API + '/iac-org-settings',\n json: true,\n qs: { org: publicOrgId },\n headers: {\n 'x-is-ci': isCI(),\n authorization: `token ${api()}`,\n },\n };\n\n return new Promise((resolve, reject) => {\n makeRequest(payload, (error, res) => {\n if (error) {\n return reject(error);\n }\n if (res.statusCode < 200 || res.statusCode > 299) {\n return reject(new FailedToGetIacOrgSettingsError());\n }\n resolve(res.body);\n });\n });\n}\n\nexport class FailedToGetIacOrgSettingsError extends CustomError {\n constructor(message?: string) {\n super(message || 'Failed to fetch IaC organization settings');\n this.code = IaCErrorCodes.FailedToGetIacOrgSettingsError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage =\n 'We failed to fetch your organization settings, including custom severity overrides for infrastructure-as-code policies. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output.';\n }\n}\n","import { CustomError } from './custom-error';\nimport { DescribeExclusiveArgs } from '../iac/drift';\n\nexport class DescribeExclusiveArgumentError extends CustomError {\n constructor() {\n super(\n 'Please use only one of these arguments: ' +\n DescribeExclusiveArgs.join(', '),\n );\n }\n}\n","import { CustomError } from './custom-error';\nimport { DescribeRequiredArgs } from '../iac/drift';\n\nexport class DescribeRequiredArgumentError extends CustomError {\n constructor() {\n super(\n 'Describe command require one of these arguments: ' +\n DescribeRequiredArgs.join(', '),\n );\n }\n}\n","import * as debugLib from 'debug';\nimport * as child_process from 'child_process';\nimport { StdioOptions } from 'child_process';\nimport * as os from 'os';\nimport envPaths from 'env-paths';\nimport * as fs from 'fs';\nimport { spinner } from '../spinner';\nimport { makeRequest } from '../request';\nimport config from '../../lib/config';\nimport * as path from 'path';\nimport * as crypto from 'crypto';\nimport {\n createIgnorePattern,\n verifyServiceMappingExists,\n} from './service-mappings';\nimport { EXIT_CODES } from '../../cli/exit-codes';\nimport {\n DescribeOptions,\n DriftAnalysis,\n DriftctlExecutionResult,\n DriftCTLOptions,\n FmtOptions,\n GenDriftIgnoreOptions,\n} from './types';\nimport { TimerMetricInstance } from '../metrics';\nimport * as analytics from '../../lib/analytics';\nimport { Policy } from '../policy/find-and-load-policy';\nimport { DescribeExclusiveArgumentError } from '../errors/describe-exclusive-argument-error';\nimport { DescribeRequiredArgumentError } from '../errors/describe-required-argument-error';\n\nconst cachePath = config.CACHE_PATH ?? envPaths('snyk').cache;\nconst debug = debugLib('drift');\n\nexport const DCTL_EXIT_CODES = {\n EXIT_IN_SYNC: 0,\n EXIT_NOT_IN_SYNC: 1,\n EXIT_ERROR: 2,\n};\n\nexport const DescribeExclusiveArgs = [\n 'all',\n 'only-managed',\n 'drift',\n 'only-unmanaged',\n];\n\nexport const DescribeRequiredArgs = [\n 'all',\n 'only-managed',\n 'drift',\n 'only-unmanaged',\n];\n\nexport const driftctlVersion = 'v0.25.0';\n\nconst driftctlChecksums = {\n 'driftctl_windows_386.exe':\n 'ce0d01910c0522ba8b4e48ef4e13846d278b6af9a3d4119e686a9cb7197bd786',\n driftctl_darwin_amd64:\n '587eb76144a58ffb656740b18c163fdfc30f590744cae3f08d232c841b10f940',\n driftctl_linux_386:\n '73c56cbb8ad86e90bf349f67f5c62307fd0f976b964d8f10da3578124baff2f2',\n driftctl_linux_amd64:\n '6ec764a36571b19408d89b07cc7c601dc30e68712f3a5822fe81ea392230dcfc',\n driftctl_linux_arm64:\n '7168fa70ee5997d46ebf9c0aaaabb063e7d8acb2cb6de841e364281b6762b158',\n 'driftctl_windows_arm64.exe':\n '432ff6d1ad0ad99f47d6482abf097fd999231f3f1df688c8bf6cdaa157c3b81b',\n driftctl_darwin_arm64:\n '16ce674a17fb1b2feab8a8fedcd2f3dca0d28fbce8e97dc351e51825c2a289ac',\n 'driftctl_windows_arm.exe':\n '295b5a979f42aed83b163451950b35627533e63583de641a2bea5e8ada6e8ca7',\n driftctl_linux_arm:\n '634b61400733ea60e45e2ea57b8ede5083711e8615f61695ffe7ee2ec9a627dd',\n 'driftctl_windows_amd64.exe':\n '4ef220ea8aaca51129086f69c0634d39fa99d50d965fe2ad3644d4f7e19e24f6',\n};\n\nconst dctlBaseUrl = 'https://static.snyk.io/cli/driftctl/';\nconst driftctlPath = path.join(cachePath, 'driftctl_' + driftctlVersion);\nconst driftctlDefaultOptions = ['--no-version-check'];\nlet isBinaryDownloaded = false;\n\nexport const validateArgs = (options: DriftCTLOptions): void => {\n if (options.kind === 'describe') {\n return validateDescribeArgs(options as DescribeOptions);\n }\n};\n\nconst validateDescribeArgs = (options: DescribeOptions): void => {\n // Check that there is no more than one of the exclusive arguments\n let count = 0;\n for (const describeExclusiveArg of DescribeExclusiveArgs) {\n if (options[describeExclusiveArg]) {\n count++;\n }\n }\n if (count > 1) {\n throw new DescribeExclusiveArgumentError();\n }\n\n // Check we have one of the required arguments\n count = 0;\n for (const describeRequiredArgs of DescribeRequiredArgs) {\n if (options[describeRequiredArgs]) {\n count++;\n }\n }\n if (count === 0) {\n throw new DescribeRequiredArgumentError();\n }\n};\n\nexport const generateArgs = (\n options: DriftCTLOptions,\n driftIgnore?: string[],\n): string[] => {\n if (options.kind === 'describe') {\n return generateScanFlags(options as DescribeOptions, driftIgnore);\n }\n\n if (options.kind === 'gen-driftignore') {\n return generateGenDriftIgnoreFlags(options as GenDriftIgnoreOptions);\n }\n\n if (options.kind === 'fmt') {\n return generateFmtFlags(options as FmtOptions);\n }\n\n throw 'Unsupported command';\n};\n\nexport const generateGenDriftIgnoreFlags = (\n options: GenDriftIgnoreOptions,\n): string[] => {\n const args: string[] = ['gen-driftignore', ...driftctlDefaultOptions];\n\n if (options.input) {\n args.push('--input');\n args.push(options.input);\n }\n\n if (options.output) {\n args.push('--output');\n args.push(options.output);\n }\n\n if (options['exclude-changed']) {\n args.push('--exclude-changed');\n }\n\n if (options['exclude-missing']) {\n args.push('--exclude-missing');\n }\n\n if (options['exclude-unmanaged']) {\n args.push('--exclude-unmanaged');\n }\n\n return args;\n};\n\nconst generateFmtFlags = (options: FmtOptions): string[] => {\n const args: string[] = ['fmt', ...driftctlDefaultOptions];\n\n if (options.json) {\n args.push('--output');\n args.push('json://stdout');\n }\n\n if (options['json-file-output']) {\n args.push('--output');\n args.push('json://' + options['json-file-output']);\n }\n\n if (options.html) {\n args.push('--output');\n args.push('html://stdout');\n }\n\n if (options['html-file-output']) {\n args.push('--output');\n args.push('html://' + options['html-file-output']);\n }\n\n return args;\n};\n\nconst generateScanFlags = (\n options: DescribeOptions,\n driftIgnore?: string[],\n): string[] => {\n const args: string[] = ['scan', ...driftctlDefaultOptions];\n\n if (options.quiet) {\n args.push('--quiet');\n }\n\n if (options.filter) {\n args.push('--filter');\n args.push(options.filter);\n }\n\n args.push('--output');\n args.push('json://stdout');\n\n if (options['fetch-tfstate-headers']) {\n args.push('--headers');\n args.push(options['fetch-tfstate-headers']);\n }\n\n if (options['tfc-token']) {\n args.push('--tfc-token');\n args.push(options['tfc-token']);\n }\n\n if (options['tfc-endpoint']) {\n args.push('--tfc-endpoint');\n args.push(options['tfc-endpoint']);\n }\n\n if (options['tf-provider-version']) {\n args.push('--tf-provider-version');\n args.push(options['tf-provider-version']);\n }\n\n if (options.strict) {\n args.push('--strict');\n }\n\n if (options.deep) {\n args.push('--deep');\n }\n\n if (options['only-managed'] || options.drift) {\n args.push('--only-managed');\n }\n\n if (options['only-unmanaged']) {\n args.push('--only-unmanaged');\n }\n\n if (options.driftignore) {\n args.push('--driftignore');\n args.push(options.driftignore);\n }\n\n if (options['tf-lockfile']) {\n args.push('--tf-lockfile');\n args.push(options['tf-lockfile']);\n }\n\n if (driftIgnore && driftIgnore.length > 0) {\n args.push('--ignore');\n args.push(driftIgnore.join(','));\n }\n\n let configDir = cachePath;\n createIfNotExists(cachePath);\n if (options['config-dir']) {\n configDir = options['config-dir'];\n }\n args.push('--config-dir');\n args.push(configDir);\n\n if (options.from) {\n const froms = options.from.split(',');\n for (const f of froms) {\n args.push('--from');\n args.push(f);\n }\n }\n\n let to = 'aws+tf';\n if (options.to) {\n to = options.to;\n }\n args.push('--to');\n args.push(to);\n\n if (options.service) {\n const services = options.service.split(',');\n verifyServiceMappingExists(services);\n args.push('--ignore');\n args.push(createIgnorePattern(services));\n }\n\n debug(args);\n\n return args;\n};\n\nexport function translateExitCode(exitCode: number | null): number {\n switch (exitCode) {\n case DCTL_EXIT_CODES.EXIT_IN_SYNC:\n return 0;\n case DCTL_EXIT_CODES.EXIT_NOT_IN_SYNC:\n return EXIT_CODES.VULNS_FOUND;\n case DCTL_EXIT_CODES.EXIT_ERROR:\n return EXIT_CODES.ERROR;\n default:\n debug('driftctl returned %d', exitCode);\n return EXIT_CODES.ERROR;\n }\n}\n\nexport const parseDriftAnalysisResults = (input: string): DriftAnalysis => {\n return JSON.parse(input) as DriftAnalysis;\n};\n\nexport const runDriftCTL = async ({\n options,\n driftIgnore,\n input,\n stdio,\n}: {\n options: DriftCTLOptions;\n driftIgnore?: string[];\n input?: string;\n stdio?: StdioOptions;\n}): Promise<DriftctlExecutionResult> => {\n const path = await findOrDownload();\n await validateArgs(options);\n const args = await generateArgs(options, driftIgnore);\n\n if (!stdio) {\n stdio = ['pipe', 'pipe', 'inherit'];\n }\n\n debug('running driftctl %s ', args.join(' '));\n\n const p = child_process.spawn(path, args, {\n stdio,\n env: { ...process.env, DCTL_IS_SNYK: 'true' },\n });\n\n let stdout = '';\n return new Promise<DriftctlExecutionResult>((resolve, reject) => {\n if (input) {\n p.stdin?.write(input);\n p.stdin?.end();\n }\n p.on('error', (error) => {\n reject(error);\n });\n\n p.stdout?.on('data', (data) => {\n stdout += data;\n });\n\n p.on('exit', (code) => {\n resolve({ code: translateExitCode(code), stdout });\n });\n });\n};\n\nasync function findOrDownload(): Promise<string> {\n let dctl = await findDriftCtl();\n if (isBinaryDownloaded) {\n return dctl;\n }\n let downloadDuration = 0;\n let binaryExist = true;\n if (dctl === '') {\n binaryExist = false;\n try {\n createIfNotExists(cachePath);\n dctl = driftctlPath;\n\n const duration = new TimerMetricInstance('driftctl_download');\n duration.start();\n await download(driftctlUrl(), dctl);\n duration.stop();\n\n downloadDuration = Math.round((duration.getValue() as number) / 1000);\n } catch (err) {\n return Promise.reject(err);\n }\n }\n analytics.add('iac-drift-binary-already-exist', binaryExist);\n analytics.add('iac-drift-binary-download-duration-seconds', downloadDuration);\n isBinaryDownloaded = true;\n return dctl;\n}\n\nasync function findDriftCtl(): Promise<string> {\n // lookup in custom path contained in env var DRIFTCTL_PATH\n let dctlPath = config.DRIFTCTL_PATH;\n if (dctlPath != null) {\n const exists = await isExe(dctlPath);\n if (exists) {\n debug('Found driftctl in $DRIFTCTL_PATH: %s', dctlPath);\n return dctlPath;\n }\n }\n\n // lookup in app cache\n dctlPath = driftctlPath;\n const exists = await isExe(dctlPath);\n if (exists) {\n debug('Found driftctl in cache: %s', dctlPath);\n return dctlPath;\n }\n debug('driftctl not found');\n return '';\n}\n\nasync function download(url, destination: string): Promise<boolean> {\n debug('downloading driftctl into %s', destination);\n\n const payload = {\n method: 'GET',\n url: url,\n output: destination,\n follow: 3,\n };\n\n await spinner('Downloading...');\n return new Promise<boolean>((resolve, reject) => {\n makeRequest(payload, function(err, res, body) {\n try {\n if (err) {\n reject(\n new Error('Could not download driftctl from ' + url + ': ' + err),\n );\n return;\n }\n if (res.statusCode !== 200) {\n reject(\n new Error(\n 'Could not download driftctl from ' + url + ': ' + res.statusCode,\n ),\n );\n return;\n }\n\n validateChecksum(body);\n\n fs.writeFileSync(destination, body);\n debug('File saved: ' + destination);\n\n fs.chmodSync(destination, 0o744);\n resolve(true);\n } finally {\n spinner.clearAll();\n }\n });\n });\n}\n\nfunction validateChecksum(body: string) {\n // only validate if we downloaded the official driftctl binary\n if (config.DRIFTCTL_URL || config.DRIFTCTL_PATH) {\n return;\n }\n\n const computedHash = crypto\n .createHash('sha256')\n .update(body)\n .digest('hex');\n const givenHash = driftctlChecksums[driftctlFileName()];\n\n if (computedHash != givenHash) {\n throw new Error('Downloaded file has inconsistent checksum...');\n }\n}\n\nfunction driftctlFileName(): string {\n let platform = 'linux';\n switch (os.platform()) {\n case 'darwin':\n platform = 'darwin';\n break;\n case 'win32':\n platform = 'windows';\n break;\n }\n\n let arch = 'amd64';\n switch (os.arch()) {\n case 'ia32':\n case 'x32':\n arch = '386';\n break;\n case 'arm':\n arch = 'arm';\n break;\n case 'arm64':\n arch = 'arm64';\n break;\n }\n\n let ext = '';\n switch (os.platform()) {\n case 'win32':\n ext = '.exe';\n break;\n }\n\n return `driftctl_${platform}_${arch}${ext}`;\n}\n\nfunction driftctlUrl(): string {\n if (config.DRIFTCTL_URL) {\n return config.DRIFTCTL_URL;\n }\n\n return `${dctlBaseUrl}/${driftctlVersion}/${driftctlFileName()}`;\n}\n\nfunction isExe(dctlPath: string): Promise<boolean> {\n return new Promise<boolean>((resolve) => {\n fs.access(dctlPath, fs.constants.X_OK, (err) => {\n if (err) {\n resolve(false);\n return;\n }\n resolve(true);\n });\n });\n}\n\nfunction createIfNotExists(path: string) {\n if (!fs.existsSync(path)) {\n fs.mkdirSync(path, { recursive: true });\n }\n}\n\nexport function driftignoreFromPolicy(policy: Policy | undefined): string[] {\n const excludeSection = 'iac-drift';\n if (!policy || !policy.exclude || !(excludeSection in policy.exclude)) {\n return [];\n }\n return policy.exclude[excludeSection];\n}\n","import { CustomError } from '../errors';\nimport { IaCErrorCodes } from '../../cli/commands/test/iac-local-execution/types';\nimport { getErrorStringCode } from '../../cli/commands/test/iac-local-execution/error-utils';\n\nexport const services2resources = new Map<string, Array<string>>([\n // Amazon\n [\n 'aws_s3',\n [\n 'aws_s3_bucket',\n 'aws_s3_bucket_analytics_configuration',\n 'aws_s3_bucket_inventory',\n 'aws_s3_bucket_metric',\n 'aws_s3_bucket_notification',\n 'aws_s3_bucket_policy',\n ],\n ],\n [\n 'aws_ec2',\n [\n 'aws_instance',\n 'aws_key_pair',\n 'aws_ami',\n 'aws_ebs_snapshot',\n 'aws_ebs_volume',\n 'aws_eip',\n 'aws_eip_association',\n 'aws_volume_attachment',\n 'aws_launch_configuration',\n 'aws_launch_template',\n ],\n ],\n ['aws_lambda', ['aws_lambda_function', 'aws_lambda_event_source_mapping']],\n [\n 'aws_rds',\n [\n 'aws_db_instance',\n 'aws_db_subnet_group',\n 'aws_rds_cluster',\n 'aws_rds_cluster_endpoint',\n 'aws_rds_cluster_instance',\n ],\n ],\n ['aws_route53', ['aws_route53_record', 'aws_route53_zone']],\n [\n 'aws_iam',\n [\n 'aws_iam_access_key',\n 'aws_iam_policy',\n 'aws_iam_policy_attachment',\n 'aws_iam_role',\n 'aws_iam_role_policy',\n 'aws_iam_role_policy_attachment',\n 'aws_iam_user',\n 'aws_iam_user_policy',\n 'aws_iam_user_policy_attachment',\n ],\n ],\n [\n 'aws_vpc',\n [\n 'aws_security_group',\n 'aws_security_group_rule',\n 'aws_subnet',\n 'aws_default_vpc',\n 'aws_vpc',\n 'aws_default_security_group',\n 'aws_route_table',\n 'aws_default_route_table',\n 'aws_route',\n 'aws_route_table_association',\n 'aws_nat_gateway',\n 'aws_internet_gateway',\n ],\n ],\n [\n 'aws_api_gateway',\n [\n 'aws_api_gateway_resource',\n 'aws_api_gateway_rest_api',\n 'aws_api_gateway_account',\n 'aws_api_gateway_api_key',\n 'aws_api_gateway_authorizer',\n 'aws_api_gateway_base_path_mapping',\n 'aws_api_gateway_domain_name',\n 'aws_api_gateway_gateway_response',\n 'aws_api_gateway_integration',\n 'aws_api_gateway_integration_response',\n 'aws_api_gateway_method',\n 'aws_api_gateway_method_response',\n 'aws_api_gateway_method_settings',\n 'aws_api_gateway_model',\n 'aws_api_gateway_request_validator',\n 'aws_api_gateway_rest_api_policy',\n 'aws_api_gateway_stage',\n 'aws_api_gateway_vpc_link',\n ],\n ],\n [\n 'aws_apigatewayv2',\n [\n 'aws_apigatewayv2_api',\n 'aws_apigatewayv2_api_mapping',\n 'aws_apigatewayv2_authorizer',\n 'aws_apigatewayv2_deployment',\n 'aws_apigatewayv2_domain_name',\n 'aws_apigatewayv2_integration',\n 'aws_apigatewayv2_integration_response',\n 'aws_apigatewayv2_model',\n 'aws_apigatewayv2_route',\n 'aws_apigatewayv2_route_response',\n 'aws_apigatewayv2_stage',\n 'aws_apigatewayv2_vpc_link',\n ],\n ],\n ['aws_sqs', ['aws_sqs_queue', 'aws_sqs_queue_policy']],\n [\n 'aws_sns',\n ['aws_sns_topic', 'aws_sns_topic_policy', 'aws_sns_topic_subscription'],\n ],\n ['aws_ecr', ['aws_ecr_repository']],\n ['aws_cloudfront', ['aws_cloudfront_distribution']],\n ['aws_kms', ['aws_kms_key', 'aws_kms_alias']],\n ['aws_dynamodb', ['aws_dynamodb_table']],\n // Azure\n ['azure_base', ['azurerm_resource_group']],\n ['azure_compute', ['azurerm_image', 'azurerm_ssh_public_key']],\n ['azure_storage', ['azurerm_storage_account', 'azurerm_storage_container']],\n [\n 'azure_network',\n [\n 'azurerm_resource_group',\n 'azurerm_subnet',\n 'azurerm_public_ip',\n 'azurerm_firewall',\n 'azurerm_route',\n 'azurerm_route_table',\n 'azurerm_network_security_group',\n ],\n ],\n ['azure_container', ['azurerm_container_registry']],\n [\n 'azure_database',\n ['azurerm_postgresql_server', 'azurerm_postgresql_database'],\n ],\n ['azure_loadbalancer', ['azurerm_lb', 'azurerm_lb_rule']],\n [\n 'azure_private_dns',\n [\n 'azurerm_private_dns_a_record',\n 'azurerm_private_dns_aaaa_record',\n 'azurerm_private_dns_cname_record',\n 'azurerm_private_dns_mx_record',\n 'azurerm_private_dns_ptr_record',\n 'azurerm_private_dns_srv_record',\n 'azurerm_private_dns_txt_record',\n 'azurerm_private_dns_zone',\n ],\n ],\n\n // Google\n [\n 'google_cloud_platform',\n [\n 'google_project_iam_binding',\n 'google_project_iam_member',\n 'google_project_iam_policy',\n ],\n ],\n [\n 'google_cloud_storage',\n [\n 'google_storage_bucket',\n 'google_storage_bucket_iam_binding',\n 'google_storage_bucket_iam_member',\n 'google_storage_bucket_iam_policy',\n ],\n ],\n [\n 'google_compute_engine',\n [\n 'google_compute_address',\n 'google_compute_disk',\n 'google_compute_global_address',\n 'google_compute_firewall',\n 'google_compute_health_check',\n 'google_compute_image',\n 'google_compute_instance',\n 'google_compute_instance_group',\n 'google_compute_network',\n 'google_compute_node_group',\n 'google_compute_router',\n 'google_compute_subnetwork',\n ],\n ],\n ['google_cloud_dns', ['google_dns_managed_zone']],\n [\n 'google_cloud_bigtable',\n ['google_bigtable_instance', 'google_bigtable_table'],\n ],\n [\n 'google_cloud_bigquery',\n ['google_bigquery_table', 'google_bigquery_dataset'],\n ],\n ['google_cloud_functions', ['google_cloudfunctions_function']],\n ['google_cloud_sql', ['google_sql_database_instance']],\n ['google_cloud_run', ['google_cloud_run_service']],\n]);\n\nexport function verifyServiceMappingExists(services: string[]): void {\n if (services.length == 0) {\n throw new InvalidServiceError('');\n }\n for (const s of services) {\n if (!services2resources.has(s)) {\n throw new InvalidServiceError(\n `We were unable to match service \"${s}\". Please provide a valid service name: ${existingServiceNames()}`,\n );\n }\n }\n}\n\nfunction existingServiceNames(): string {\n let res = '';\n for (const s of services2resources.keys()) {\n res += `${s},`;\n }\n return res.substring(0, res.length - 1);\n}\n\nexport function createIgnorePattern(services: string[]): string {\n return createIgnorePatternWithMap(services, services2resources);\n}\n\nexport function createIgnorePatternWithMap(\n services: string[],\n serviceMap: Map<string, Array<string>>,\n): string {\n let res = '*';\n const seenResources = new Set<string>();\n for (const s of services) {\n const resourcePatterns = serviceMap.get(s);\n for (const rp of resourcePatterns || []) {\n // A resource might belong to multiple services, skip it if already processed\n if (seenResources.has(rp)) {\n continue;\n }\n res += `,!${rp}`;\n seenResources.add(rp);\n }\n }\n return res;\n}\n\nexport class InvalidServiceError extends CustomError {\n constructor(msg: string) {\n super(msg);\n this.code = IaCErrorCodes.InvalidServiceError;\n this.strCode = getErrorStringCode(this.code);\n this.userMessage = msg;\n }\n}\n"],"names":[],"sourceRoot":""}
|
|
@@ -30,17 +30,9 @@ Snapshot and continuously monitor a project for open source vulnerabilities and
|
|
|
30
30
|
|
|
31
31
|
Test container images for vulnerabilities.
|
|
32
32
|
|
|
33
|
-
### [`iac
|
|
33
|
+
### [`snyk iac`](iac.md)
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### [`iac gen-driftignore`](iac-gen-driftignore.md)
|
|
38
|
-
|
|
39
|
-
Generate driftignore rules to be used by `snyk iac test`.
|
|
40
|
-
|
|
41
|
-
### [`iac test`](iac-test.md)
|
|
42
|
-
|
|
43
|
-
Test for any known security issue.
|
|
35
|
+
Find security issues in Infrastructure as Code files, and detect drift.
|
|
44
36
|
|
|
45
37
|
### [`snyk code`](code.md)
|
|
46
38
|
|
|
@@ -36,7 +36,7 @@ Use the `-d` option to output the debug logs.
|
|
|
36
36
|
|
|
37
37
|
**Note:** To use the `describe` command, you **must use at least one of these options**:
|
|
38
38
|
|
|
39
|
-
- `--only-managed`
|
|
39
|
+
- `--only-managed` or `--drift` Scan only managed resources from the Terraform states.
|
|
40
40
|
- `--only-unmanaged` Scan only unmanaged resources.
|
|
41
41
|
- `--all` Scan both managed and unmanaged resources.
|
|
42
42
|
|
|
@@ -119,6 +119,8 @@ Display a report that shows changes only for resources found in aggregated Terra
|
|
|
119
119
|
|
|
120
120
|
Display a report that shows resources not found in any Terraform state; filter out drift for managed resources.
|
|
121
121
|
|
|
122
|
+
Alternative: `--drift`
|
|
123
|
+
|
|
122
124
|
### `--quiet`
|
|
123
125
|
|
|
124
126
|
Prevent stdout from being used for anything but the scan result. This can be useful to pipe the output into some other command.
|
|
@@ -83,6 +83,62 @@ Save test output in SARIF format directly to the \<OUTPUT_FILE_PATH> file, regar
|
|
|
83
83
|
|
|
84
84
|
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the SARIF format output to a file.
|
|
85
85
|
|
|
86
|
+
### `--project-business-criticality=<BUSINESS_CRITICALITY>[,<BUSINESS_CRITICALITY>]...>`
|
|
87
|
+
|
|
88
|
+
This can be used in combination with the `--report` option.
|
|
89
|
+
|
|
90
|
+
Set the project business criticality project attribute to one or more values (comma-separated). To clear the project business criticality set `--project-business-criticality=`.
|
|
91
|
+
|
|
92
|
+
Allowed values: `critical, high, medium, low`
|
|
93
|
+
|
|
94
|
+
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes).
|
|
95
|
+
|
|
96
|
+
### `--project-environment=<ENVIRONMENT>[,<ENVIRONMENT>]...>`
|
|
97
|
+
|
|
98
|
+
This can be used in combination with the `--report` command.
|
|
99
|
+
|
|
100
|
+
Set the project environment project attribute to one or more values (comma-separated). To clear the project environment set `--project-environment=`.
|
|
101
|
+
|
|
102
|
+
Allowed values: `frontend, backend, internal, external, mobile, saas, onprem, hosted, distributed`
|
|
103
|
+
|
|
104
|
+
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes).
|
|
105
|
+
|
|
106
|
+
### `--project-lifecycle=<LIFECYCLE>[,<LIFECYCLE>]...>`
|
|
107
|
+
|
|
108
|
+
This can be used in combination with the `--report` command.
|
|
109
|
+
|
|
110
|
+
Set the project lifecycle project attribute to one or more values (comma-separated). To clear the project lifecycle set `--project-lifecycle=`.
|
|
111
|
+
|
|
112
|
+
Allowed values: `production, development, sandbox`
|
|
113
|
+
|
|
114
|
+
For more information see [Project attributes](https://docs.snyk.io/getting-started/introduction-to-snyk-projects/view-project-information/project-attributes).
|
|
115
|
+
|
|
116
|
+
### `--project-tags=<TAG>[,<TAG>]...>`
|
|
117
|
+
|
|
118
|
+
This can be used in combination with the `--report` command.
|
|
119
|
+
|
|
120
|
+
Set the project tags to one or more values (comma-separated key value pairs with an "=" separator), for example, `--project-tags=department=finance,team=alpha`. To clear the project tags set `--project-tags=`
|
|
121
|
+
|
|
122
|
+
### `--report`
|
|
123
|
+
|
|
124
|
+
Share results with the Snyk App.
|
|
125
|
+
|
|
126
|
+
This creates a project in your Synk account with a snapshot of the current configuration issues. After running this command, log in to the Snyk website and view your projects to see the monitor.
|
|
127
|
+
|
|
128
|
+
Example: `$ snyk iac test --report`
|
|
129
|
+
|
|
130
|
+
Note: This option cannot be used in combination with the `--rules` option.
|
|
131
|
+
|
|
132
|
+
### `--rules=<PATH_TO_CUSTOM_RULES_BUNDLE>`
|
|
133
|
+
|
|
134
|
+
Use this dedicated option for Custom Rules scanning to enable the IaC scans to use a custom rules bundle generated with the `snyk-iac-rules` SDK. See [`snyk-iac-rules` SDK](https://github.com/snyk/snyk-iac-rules#readme).
|
|
135
|
+
|
|
136
|
+
This option cannot be used if the custom rules settings were configured with the Snyk UI. Default: If the `--rules` flag is not specified, scan the configuration files using the internal Snyk rules only.
|
|
137
|
+
|
|
138
|
+
Example: `--rules=bundle.tar.gz` (Scan the configuration files using custom rules and internal Snyk rules.)
|
|
139
|
+
|
|
140
|
+
Note: This option can not be used in combination with the `--report` option.
|
|
141
|
+
|
|
86
142
|
### `--severity-threshold=<low|medium|high|critical>`
|
|
87
143
|
|
|
88
144
|
Report only vulnerabilities at the specified level or higher.
|
|
@@ -94,13 +150,16 @@ Use this dedicated option for Terraform plan scanning modes to control whether t
|
|
|
94
150
|
Default: If the `--scan` option is not specified, scan the proposed changes only by default. Example 1: `--scan=planned-values` (full state scan)\
|
|
95
151
|
Example 2: `--scan=resource-changes` (proposed changes scan)
|
|
96
152
|
|
|
97
|
-
### `--
|
|
153
|
+
### `--target-reference=<TARGET_REFERENCE>`
|
|
98
154
|
|
|
99
|
-
|
|
155
|
+
This can be used in combination with the `--report` command.
|
|
100
156
|
|
|
101
|
-
|
|
157
|
+
Specify a reference which differentiates this project, for example, a branch name or version. Projects having the same reference can be grouped based on that reference.
|
|
102
158
|
|
|
103
|
-
Example
|
|
159
|
+
Example setting to the current Git branch: `snyk iac test myproject/ --report --target-reference="$(git branch --show-current)"`
|
|
160
|
+
|
|
161
|
+
\
|
|
162
|
+
Example setting to the latest Git tag : `snyk iac test myproject/ --report --target-reference="$(git describe --tags --abbrev=0)"`
|
|
104
163
|
|
|
105
164
|
## Examples for snyk iac test command
|
|
106
165
|
|
package/help/cli-commands/iac.md
CHANGED
|
@@ -6,13 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
## Description
|
|
8
8
|
|
|
9
|
-
The `snyk iac` command finds security issues in Infrastructure as Code files.
|
|
9
|
+
The `snyk iac` command finds security issues in Infrastructure as Code files, and detects drift.
|
|
10
10
|
|
|
11
11
|
For more information see [Synk CLI for Infrastructure as Code](https://docs.snyk.io/products/snyk-infrastructure-as-code/snyk-cli-for-infrastructure-as-code).
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Subcommands
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### [`test`](iac-test.md)
|
|
16
|
+
|
|
17
|
+
Test for any known vulnerabilities.
|
|
18
|
+
|
|
19
|
+
### [`describe`](iac-describe.md)
|
|
20
|
+
|
|
21
|
+
Detect, track, and, alert on infrastructure drift and unmanaged resources.
|
|
22
|
+
|
|
23
|
+
### [`gen-driftignore`](iac-gen-driftignore.md)
|
|
24
|
+
|
|
25
|
+
Generate driftignore rules to be used by `snyk iac describe`.
|
|
16
26
|
|
|
17
27
|
## Exit codes
|
|
18
28
|
|
|
@@ -25,130 +35,10 @@ Possible exit codes and their meaning:
|
|
|
25
35
|
|
|
26
36
|
## Configure the Snyk CLI
|
|
27
37
|
|
|
28
|
-
You can use environment variables to configure the Snyk CLI and also set variables to configure the Snyk CLI to connect with the Snyk API.
|
|
38
|
+
You can use environment variables to configure the Snyk CLI and also set variables to configure the Snyk CLI to connect with the Snyk API. There are environment variables that apply to the container command.
|
|
39
|
+
|
|
40
|
+
See [Configure the Snyk CLI](https://docs.snyk.io/features/snyk-cli/configure-the-snyk-cli).
|
|
29
41
|
|
|
30
42
|
## Debug
|
|
31
43
|
|
|
32
44
|
Use the `-d` option to output the debug logs.
|
|
33
|
-
|
|
34
|
-
## Options
|
|
35
|
-
|
|
36
|
-
### `--detection-depth=<DEPTH>`
|
|
37
|
-
|
|
38
|
-
Use to indicate how many sub-directories to search. `DEPTH` must be a number.
|
|
39
|
-
|
|
40
|
-
Default: no limit.
|
|
41
|
-
|
|
42
|
-
Example: `--detection-depth=3` limits search to the specified directory (or the current directory if no `<PATH>` is specified) plus three levels of subdirectories.
|
|
43
|
-
|
|
44
|
-
### `--org=<ORG_ID>`
|
|
45
|
-
|
|
46
|
-
Specify the `<ORG_ID>` to run Snyk commands tied to a specific organization. The `<ORG_ID>` influences private test limits.
|
|
47
|
-
|
|
48
|
-
If you have multiple organizations, you can set a default from the CLI using:
|
|
49
|
-
|
|
50
|
-
`$ snyk config set org=<ORG_ID>`
|
|
51
|
-
|
|
52
|
-
Set a default to ensure all newly tested projects are tested under your default organization. If you need to override the default, use the `--org=<ORG_ID>` option.
|
|
53
|
-
|
|
54
|
-
Default: `<ORG_ID>` that is the current preferred organization in your [Account settings](https://app.snyk.io/account).
|
|
55
|
-
|
|
56
|
-
Example: `$ snyk iac test --org=my-team`
|
|
57
|
-
|
|
58
|
-
For more information see the article [How to select the organization to use in the CLI](https://support.snyk.io/hc/en-us/articles/360000920738-How-to-select-the-organization-to-use-in-the-CLI).
|
|
59
|
-
|
|
60
|
-
### `--ignore-policy`
|
|
61
|
-
|
|
62
|
-
Ignore all set policies, the current policy in the `.snyk` file, Org level ignores, and the project policy on snyk.io.
|
|
63
|
-
|
|
64
|
-
### `--policy-path=<PATH_TO_POLICY_FILE>`
|
|
65
|
-
|
|
66
|
-
Manually pass a path to a `.snyk` policy file.
|
|
67
|
-
|
|
68
|
-
### `--json`
|
|
69
|
-
|
|
70
|
-
Print results in JSON format.
|
|
71
|
-
|
|
72
|
-
Example: `$ snyk iac test --json-file-output=vuln.json`
|
|
73
|
-
|
|
74
|
-
### `--json-file-output=<OUTPUT_FILE_PATH>`
|
|
75
|
-
|
|
76
|
-
Save test output in JSON format directly to the specified file, regardless of whether or not you use the `--json` option.
|
|
77
|
-
|
|
78
|
-
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the JSON format output to a file.
|
|
79
|
-
|
|
80
|
-
### `--sarif`
|
|
81
|
-
|
|
82
|
-
Return results in SARIF format.
|
|
83
|
-
|
|
84
|
-
### `--sarif-file-output=<OUTPUT_FILE_PATH>`
|
|
85
|
-
|
|
86
|
-
Save test output in SARIF format directly to the \<OUTPUT_FILE_PATH> file, regardless of whether or not you use the `--sarif` option.
|
|
87
|
-
|
|
88
|
-
This is especially useful if you want to display the human-readable test output using stdout and at the same time save the SARIF format output to a file.
|
|
89
|
-
|
|
90
|
-
### `--severity-threshold=<low|medium|high|critical>`
|
|
91
|
-
|
|
92
|
-
Report only vulnerabilities at the specified level or higher.
|
|
93
|
-
|
|
94
|
-
### `--scan=<TERRAFORM_PLAN_SCAN_MODE>`
|
|
95
|
-
|
|
96
|
-
Use this dedicated option for Terraform plan scanning modes to control whether the scan analyzes the full final state (for example, `planned-values`), or the proposed changes only (for example, `resource-changes`).
|
|
97
|
-
|
|
98
|
-
Default: If the `--scan` option is not specified, scan the proposed changes only by default. Example 1: `--scan=planned-values` (full state scan) Example 2: `--scan=resource-changes` (proposed changes scan)
|
|
99
|
-
|
|
100
|
-
### `--rules=<PATH_TO_CUSTOM_RULES_BUNDLE>`
|
|
101
|
-
|
|
102
|
-
Use this dedicated option for Custom Rules scanning to enable the IaC scans to use a custom rules bundle generated with the `snyk-iac-rules` SDK. See [Download learn how to use the SDK](https://github.com/snyk/snyk-iac-rules).
|
|
103
|
-
|
|
104
|
-
This option cannot be used if the custom rules settings were configured with the Snyk UI. Default: If the `--rules` flag is not specified, scan the configuration files using the internal Snyk rules only.
|
|
105
|
-
|
|
106
|
-
Example: `--rules=bundle.tar.gz` (Scan the configuration files using custom rules and internal Snyk rules.)
|
|
107
|
-
|
|
108
|
-
## Examples for the iac test command
|
|
109
|
-
|
|
110
|
-
For more information see [Snyk CLI for Infrastructure as Code](https://docs.snyk.io/products/snyk-infrastructure-as-code/snyk-cli-for-infrastructure-as-code).
|
|
111
|
-
|
|
112
|
-
### Test a CloudFormation file
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
$ snyk iac test /path/to/cloudformation_file.yaml
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Test a Kubernetes file
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
$ snyk iac test /path/to/kubernetes_file.yaml
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Test a Terraform file
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
$ snyk iac test /path/to/terraform_file.tf
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Test a Terraform plan file
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
$ terraform plan -out=tfplan.binary
|
|
134
|
-
$ terraform show -json tfplan.binary > tf-plan.json
|
|
135
|
-
$ snyk iac test tf-plan.json
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Test an ARM file
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
$ snyk iac test /path/to/arm_file.json
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Test matching files in a directory
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
$ snyk iac test /path/to/directory
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Test matching files in a directory using a local custom rules bundle
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
$ snyk iac test /path/to/directory --rules=bundle.tar.gz
|
|
154
|
-
```
|