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5D,IAAI,QAAC,cAAc,CAAC,YAAY,0CAAE,QAAQ,GAAE;QAC1C,MAAM,IAAI,4DAAkC,CAC1C,uBAAuB,EACvB,UAAU,CACX,CAAC;KACH;IAED,IAAI;QACF,uGAAuG;QACvG,kDAAkD;QAClD,qFAAqF;QACrF,MAAM,QAAQ,GAAG,iCAAyB,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE1E,gBAAgB;QAChB,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAEpC,IAAI,MAAc,CAAC;QACnB,IAAI;YACF,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC3B,yCAAyC;gBACzC,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,CAAC;aACvC;iBAAM;gBACL,MAAM,KAAK,CAAC;aACb;SACF;QACD,MAAM,6BAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAClC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,4CAA4C,GAAG,CAAC,CAAC,CAAC;QACxE,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC5B;AACH,CAAC,CAAC","sources":["webpack://snyk/./src/cli/commands/process-command-args.ts","webpack://snyk/./src/cli/commands/update-exclude-policy.ts"],"sourcesContent":["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","import { MethodArgs } from '../args';\nimport { processCommandArgs } from './process-command-args';\nimport * as legacyError from '../../lib/errors/legacy-errors';\nimport * as fs from 'fs';\nimport * as snykPolicyLib from 'snyk-policy';\nimport { getIacOrgSettings } from './test/iac/local-execution/org-settings/get-iac-org-settings';\nimport { UnsupportedEntitlementCommandError } from './test/iac/local-execution/assert-iac-options-flag';\nimport config from '../../lib/config';\nimport {\n parseDriftAnalysisResults,\n updateExcludeInPolicy,\n} from '../../lib/iac/drift';\nimport { Policy } from '../../lib/policy/find-and-load-policy';\nimport * as analytics from '../../lib/analytics';\n\nexport default async (...args: MethodArgs): Promise<any> => {\n const { options } = processCommandArgs(...args);\n\n // Ensure that this update-exclude-policy command can only be runned when using `snyk iac update-exclude-policy`\n // Avoid `snyk update-exclude-policy` direct usage\n if (options.iac != true) {\n return legacyError('update-exclude-policy');\n }\n\n // Ensure that we are allowed to run that command\n // by checking the entitlement\n const orgPublicId = options.org ?? config.org;\n const iacOrgSettings = await getIacOrgSettings(orgPublicId);\n if (!iacOrgSettings.entitlements?.iacDrift) {\n throw new UnsupportedEntitlementCommandError(\n 'update-exclude-policy',\n 'iacDrift',\n );\n }\n\n try {\n // There's an open bug for this in Windows in the current version of node when called with no stdinput.\n // See https://github.com/nodejs/node/issues/19831\n // The actual error handling behavior is enough for now but may be improved if needed\n const analysis = parseDriftAnalysisResults(fs.readFileSync(0).toString());\n\n // Add analytics\n analytics.add('is-iac-drift', true);\n\n let policy: Policy;\n try {\n policy = await snykPolicyLib.load();\n } catch (error) {\n if (error.code === 'ENOENT') {\n // policy file does not exist - create it\n policy = await snykPolicyLib.create();\n } else {\n throw error;\n }\n }\n await updateExcludeInPolicy(policy, analysis, options);\n await snykPolicyLib.save(policy);\n } catch (e) {\n const err = new Error('Error running `iac update-exclude-policy` ' + e);\n return Promise.reject(err);\n }\n};\n"],"names":[],"sourceRoot":""}