snyk 1.833.0 → 1.834.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.
@@ -684,6 +684,7 @@ const analytics_1 = __webpack_require__(22716);
684
684
  const usage_tracking_1 = __webpack_require__(43156);
685
685
  const policy_1 = __webpack_require__(25476);
686
686
  const measurable_methods_1 = __webpack_require__(78272);
687
+ const unsupported_entitlement_error_1 = __webpack_require__(78673);
687
688
  const assert_iac_options_flag_1 = __webpack_require__(68590);
688
689
  const user_config_1 = __webpack_require__(28137);
689
690
  const config_1 = __webpack_require__(22541);
@@ -696,13 +697,16 @@ const chalk_1 = __webpack_require__(32589);
696
697
  // this method executes the local processing engine and then formats the results to adapt with the CLI output.
697
698
  // this flow is the default GA flow for IAC scanning.
698
699
  async function test(pathToScan, options) {
699
- var _a, _b, _c;
700
+ var _a, _b, _c, _d;
700
701
  try {
701
702
  let customRulesPath;
702
703
  const orgPublicId = (_a = options.org) !== null && _a !== void 0 ? _a : config_1.default.org;
703
704
  const iacOrgSettings = await measurable_methods_1.getIacOrgSettings(orgPublicId);
705
+ if (!((_b = iacOrgSettings.entitlements) === null || _b === void 0 ? void 0 : _b.infrastructureAsCode)) {
706
+ throw new unsupported_entitlement_error_1.UnsupportedEntitlementError('infrastructureAsCode');
707
+ }
704
708
  if (options.rules) {
705
- if (!((_b = iacOrgSettings.entitlements) === null || _b === void 0 ? void 0 : _b.iacCustomRulesEntitlement)) {
709
+ if (!((_c = iacOrgSettings.entitlements) === null || _c === void 0 ? void 0 : _c.iacCustomRulesEntitlement)) {
706
710
  throw new assert_iac_options_flag_1.UnsupportedEntitlementFlagError('rules', 'iacCustomRulesEntitlement');
707
711
  }
708
712
  customRulesPath = options.rules;
@@ -716,7 +720,7 @@ async function test(pathToScan, options) {
716
720
  throw new FailedToExecuteCustomRulesError();
717
721
  }
718
722
  if (isOCIRegistryURLProvided) {
719
- if (!((_c = iacOrgSettings.entitlements) === null || _c === void 0 ? void 0 : _c.iacCustomRulesEntitlement)) {
723
+ if (!((_d = iacOrgSettings.entitlements) === null || _d === void 0 ? void 0 : _d.iacCustomRulesEntitlement)) {
720
724
  throw new oci_pull_1.UnsupportedEntitlementPullError('iacCustomRulesEntitlement');
721
725
  }
722
726
  await pullIaCCustomRules(iacOrgSettings);
@@ -2327,6 +2331,28 @@ FailOnError.ERROR_MESSAGE = 'Invalid fail on argument, please use one of: ' +
2327
2331
  Object.keys(common_1.FAIL_ON).join(' | ');
2328
2332
 
2329
2333
 
2334
+ /***/ }),
2335
+
2336
+ /***/ 78673:
2337
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2338
+
2339
+ "use strict";
2340
+
2341
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2342
+ exports.UnsupportedEntitlementError = void 0;
2343
+ const custom_error_1 = __webpack_require__(17188);
2344
+ class UnsupportedEntitlementError extends custom_error_1.CustomError {
2345
+ constructor(entitlement, userMessage = `This feature is currently not enabled for your org. To enable it, please contact snyk support.`) {
2346
+ super('Unsupported feature - Missing the ${entitlementName} entitlement');
2347
+ this.entitlement = entitlement;
2348
+ this.code = UnsupportedEntitlementError.ERROR_CODE;
2349
+ this.userMessage = userMessage;
2350
+ }
2351
+ }
2352
+ exports.UnsupportedEntitlementError = UnsupportedEntitlementError;
2353
+ UnsupportedEntitlementError.ERROR_CODE = 403;
2354
+
2355
+
2330
2356
  /***/ }),
2331
2357
 
2332
2358
  /***/ 9401: