snyk 1.1051.0 → 1.1052.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/895.index.js +36 -1
- package/dist/cli/895.index.js.map +1 -1
- package/dist/cli/917.index.js +7 -4
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac/local-execution/assert-iac-options-flag.d.ts +11 -0
- package/dist/lib/iac/test/v2/errors.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli/895.index.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.modules = {
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11
|
-
exports.InvalidArgumentError = exports.isIacShareResultsOptions = exports.assertTerraformPlanModes = exports.assertIaCOptionsFlags = exports.UnsupportedEntitlementCommandError = exports.UnsupportedEntitlementFlagError = exports.FlagValueError = exports.FeatureFlagError = exports.FlagError = void 0;
|
|
11
|
+
exports.InvalidArgumentError = exports.isIacShareResultsOptions = exports.assertTerraformPlanModes = exports.assertIntegratedIaCOnlyOptions = exports.assertIaCOptionsFlags = exports.UnsupportedEntitlementCommandError = exports.UnsupportedEntitlementFlagError = exports.FlagValueError = exports.FeatureFlagError = exports.IntegratedFlagError = exports.FlagError = void 0;
|
|
12
12
|
const errors_1 = __webpack_require__(55191);
|
|
13
13
|
const args_1 = __webpack_require__(94765);
|
|
14
14
|
const error_utils_1 = __webpack_require__(36401);
|
|
@@ -47,7 +47,12 @@ const keys = [
|
|
|
47
47
|
'remote-repo-url',
|
|
48
48
|
'target-name',
|
|
49
49
|
];
|
|
50
|
+
const integratedKeys = [
|
|
51
|
+
'snyk-cloud-environment',
|
|
52
|
+
'cloud-context',
|
|
53
|
+
];
|
|
50
54
|
const allowed = new Set(keys);
|
|
55
|
+
const integratedOnlyFlags = new Set(integratedKeys);
|
|
51
56
|
function camelcaseToDash(key) {
|
|
52
57
|
return key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
|
|
53
58
|
}
|
|
@@ -67,6 +72,17 @@ class FlagError extends errors_1.CustomError {
|
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
exports.FlagError = FlagError;
|
|
75
|
+
class IntegratedFlagError extends errors_1.CustomError {
|
|
76
|
+
constructor(key, org) {
|
|
77
|
+
const flag = getFlagName(key);
|
|
78
|
+
const msg = `Flag "${flag}" is only supported when using Integrated IaC. To enable it for your organisation "${org}", please contact Snyk support.`;
|
|
79
|
+
super(msg);
|
|
80
|
+
this.code = types_1.IaCErrorCodes.FlagError;
|
|
81
|
+
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|
82
|
+
this.userMessage = msg;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.IntegratedFlagError = IntegratedFlagError;
|
|
70
86
|
class FeatureFlagError extends errors_1.CustomError {
|
|
71
87
|
constructor(key, featureFlag, hasSnykPreview) {
|
|
72
88
|
const flag = getFlagName(key);
|
|
@@ -141,6 +157,25 @@ function assertIaCOptionsFlags(argv) {
|
|
|
141
157
|
}
|
|
142
158
|
}
|
|
143
159
|
exports.assertIaCOptionsFlags = assertIaCOptionsFlags;
|
|
160
|
+
/**
|
|
161
|
+
* Check that the flags used for the v1 flow do not contain any flag that are
|
|
162
|
+
* only usable with the new integrated iac (v2) flow
|
|
163
|
+
* @param settings organisation settings, used to get the org name
|
|
164
|
+
* @param argv command line args
|
|
165
|
+
*/
|
|
166
|
+
function assertIntegratedIaCOnlyOptions(settings, argv) {
|
|
167
|
+
// We process the process.argv so we don't get default values.
|
|
168
|
+
const parsed = args_1.args(argv);
|
|
169
|
+
for (const key of Object.keys(parsed.options)) {
|
|
170
|
+
// The _ property is a special case that contains non
|
|
171
|
+
// flag strings passed to the command line (usually files)
|
|
172
|
+
// and `iac` is the command provided.
|
|
173
|
+
if (key !== '_' && key !== 'iac' && integratedOnlyFlags.has(key)) {
|
|
174
|
+
throw new IntegratedFlagError(key, settings.meta.org);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.assertIntegratedIaCOnlyOptions = assertIntegratedIaCOnlyOptions;
|
|
144
179
|
const SUPPORTED_TF_PLAN_SCAN_MODES = [
|
|
145
180
|
types_1.TerraformPlanScanMode.DeltaScan,
|
|
146
181
|
types_1.TerraformPlanScanMode.FullScan,
|