snyk 1.757.0 → 1.758.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/917.index.js +210 -63
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac-local-execution/assert-iac-options-flag.d.ts +4 -1
- package/dist/cli/commands/test/iac-local-execution/index.d.ts +6 -2
- package/dist/cli/commands/test/iac-local-execution/measurable-methods.d.ts +1 -1
- package/dist/cli/commands/test/iac-local-execution/oci-pull.d.ts +9 -3
- package/dist/cli/commands/test/iac-local-execution/types.d.ts +11 -4
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/errors/unsupported-entitlement-error.d.ts +6 -0
- package/dist/lib/errors/unsupported-feature-flag-error.d.ts +1 -0
- package/package.json +2 -2
package/dist/cli/917.index.js
CHANGED
|
@@ -112,7 +112,7 @@ exports.performanceAnalyticsObject = {
|
|
|
112
112
|
"use strict";
|
|
113
113
|
|
|
114
114
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
115
|
-
exports.assertIaCOptionsFlags = exports.FlagValueError = exports.FlagError = void 0;
|
|
115
|
+
exports.assertIaCOptionsFlags = exports.UnsupportedEntitlementFlagError = exports.FlagValueError = exports.FlagError = void 0;
|
|
116
116
|
const errors_1 = __webpack_require__(55191);
|
|
117
117
|
const args_1 = __webpack_require__(94765);
|
|
118
118
|
const error_utils_1 = __webpack_require__(23872);
|
|
@@ -177,6 +177,16 @@ class FlagValueError extends errors_1.CustomError {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
exports.FlagValueError = FlagValueError;
|
|
180
|
+
class UnsupportedEntitlementFlagError extends errors_1.CustomError {
|
|
181
|
+
constructor(key, entitlementName) {
|
|
182
|
+
const flag = getFlagName(key);
|
|
183
|
+
super(`Unsupported flag: ${flag} - Missing the ${entitlementName} entitlement`);
|
|
184
|
+
this.code = types_1.IaCErrorCodes.UnsupportedEntitlementFlagError;
|
|
185
|
+
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|
186
|
+
this.userMessage = `Flag "${flag}" is currently not supported for this org. To enable it, please contact snyk support.`;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.UnsupportedEntitlementFlagError = UnsupportedEntitlementFlagError;
|
|
180
190
|
/**
|
|
181
191
|
* Validates the command line flags passed to the snyk iac test
|
|
182
192
|
* command. The current argument parsing is very permissive and
|
|
@@ -655,7 +665,7 @@ exports.computeCustomRulesBundleChecksum = computeCustomRulesBundleChecksum;
|
|
|
655
665
|
"use strict";
|
|
656
666
|
|
|
657
667
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
658
|
-
exports.FailedToExecuteCustomRulesError = exports.FailedToPullCustomBundleError = exports.isValidURL = exports.removeFileContent = exports.test = void 0;
|
|
668
|
+
exports.FailedToExecuteCustomRulesError = exports.FailedToPullCustomBundleError = exports.pullIaCCustomRules = exports.isValidURL = exports.removeFileContent = exports.test = void 0;
|
|
659
669
|
const detect_1 = __webpack_require__(45318);
|
|
660
670
|
const types_1 = __webpack_require__(42258);
|
|
661
671
|
const analytics_1 = __webpack_require__(22716);
|
|
@@ -670,58 +680,26 @@ const policy_2 = __webpack_require__(32615);
|
|
|
670
680
|
const errors_1 = __webpack_require__(55191);
|
|
671
681
|
const error_utils_1 = __webpack_require__(23872);
|
|
672
682
|
const oci_pull_1 = __webpack_require__(5029);
|
|
683
|
+
const unsupported_entitlement_error_1 = __webpack_require__(78673);
|
|
673
684
|
// this method executes the local processing engine and then formats the results to adapt with the CLI output.
|
|
674
685
|
// this flow is the default GA flow for IAC scanning.
|
|
675
686
|
async function test(pathToScan, options) {
|
|
676
|
-
var _a
|
|
687
|
+
var _a;
|
|
677
688
|
try {
|
|
678
|
-
|
|
679
|
-
const
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
689
|
+
let customRulesPath;
|
|
690
|
+
const orgPublicId = (_a = options.org) !== null && _a !== void 0 ? _a : config_1.default.org;
|
|
691
|
+
const iacOrgSettings = await measurable_methods_1.getIacOrgSettings(orgPublicId);
|
|
692
|
+
if (options.rules) {
|
|
693
|
+
await assertRulesFlagAvailable(orgPublicId, iacOrgSettings);
|
|
694
|
+
customRulesPath = options.rules;
|
|
695
|
+
}
|
|
696
|
+
const isOCIRegistryURLProvided = checkOCIRegistryURLProvided(iacOrgSettings);
|
|
697
|
+
if (isOCIRegistryURLProvided && customRulesPath) {
|
|
684
698
|
throw new FailedToExecuteCustomRulesError();
|
|
685
699
|
}
|
|
686
|
-
if (
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
const URLComponents = oci_pull_1.extractURLComponents(OCIRegistryURL);
|
|
691
|
-
const username = user_config_1.config.get('oci-registry-username');
|
|
692
|
-
const password = user_config_1.config.get('oci-registry-password');
|
|
693
|
-
const opt = {
|
|
694
|
-
username,
|
|
695
|
-
password,
|
|
696
|
-
reqOptions: {
|
|
697
|
-
acceptManifest: types_1.manifestContentType,
|
|
698
|
-
acceptLayer: types_1.layerContentType,
|
|
699
|
-
indexContentType: '',
|
|
700
|
-
},
|
|
701
|
-
};
|
|
702
|
-
try {
|
|
703
|
-
await measurable_methods_1.pull(URLComponents, opt);
|
|
704
|
-
}
|
|
705
|
-
catch (err) {
|
|
706
|
-
if (err.statusCode === 401) {
|
|
707
|
-
throw new FailedToPullCustomBundleError('There was an authentication error. Incorrect credentials provided.');
|
|
708
|
-
}
|
|
709
|
-
else if (err.statusCode === 404) {
|
|
710
|
-
throw new FailedToPullCustomBundleError('The remote repository could not be found. Please check the provided URL.');
|
|
711
|
-
}
|
|
712
|
-
else if (err instanceof oci_pull_1.InvalidManifestSchemaVersionError) {
|
|
713
|
-
throw new FailedToPullCustomBundleError(err.message);
|
|
714
|
-
}
|
|
715
|
-
else if (err instanceof oci_pull_1.FailedToBuildOCIArtifactError) {
|
|
716
|
-
throw new oci_pull_1.FailedToBuildOCIArtifactError();
|
|
717
|
-
}
|
|
718
|
-
else if (err instanceof oci_pull_1.InvalidRemoteRegistryURLError) {
|
|
719
|
-
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
throw new FailedToPullCustomBundleError();
|
|
723
|
-
}
|
|
724
|
-
}
|
|
700
|
+
if (isOCIRegistryURLProvided) {
|
|
701
|
+
await assertPullAvailable(orgPublicId, iacOrgSettings);
|
|
702
|
+
await pullIaCCustomRules(iacOrgSettings);
|
|
725
703
|
}
|
|
726
704
|
else {
|
|
727
705
|
await measurable_methods_1.initLocalCache({ customRulesPath });
|
|
@@ -730,7 +708,7 @@ async function test(pathToScan, options) {
|
|
|
730
708
|
const filesToParse = await measurable_methods_1.loadFiles(pathToScan, options);
|
|
731
709
|
const { parsedFiles, failedFiles } = await measurable_methods_1.parseFiles(filesToParse, options);
|
|
732
710
|
// Duplicate all the files and run them through the custom engine.
|
|
733
|
-
if (customRulesPath ||
|
|
711
|
+
if (customRulesPath || isOCIRegistryURLProvided) {
|
|
734
712
|
parsedFiles.push(...parsedFiles.map((file) => ({
|
|
735
713
|
...file,
|
|
736
714
|
engineType: types_1.EngineType.Custom,
|
|
@@ -765,15 +743,6 @@ async function test(pathToScan, options) {
|
|
|
765
743
|
}
|
|
766
744
|
}
|
|
767
745
|
exports.test = test;
|
|
768
|
-
async function customRulesPathForOrg(customRulesPath, publicOrgId) {
|
|
769
|
-
if (!customRulesPath)
|
|
770
|
-
return;
|
|
771
|
-
const isCustomRulesSupported = (await feature_flags_1.isFeatureFlagSupportedForOrg('iacCustomRules', publicOrgId)).ok;
|
|
772
|
-
if (isCustomRulesSupported) {
|
|
773
|
-
return customRulesPath;
|
|
774
|
-
}
|
|
775
|
-
throw new assert_iac_options_flag_1.FlagError('rules', 'iacCustomRules');
|
|
776
|
-
}
|
|
777
746
|
function removeFileContent({ filePath, fileType, failureReason, projectType, }) {
|
|
778
747
|
return {
|
|
779
748
|
filePath,
|
|
@@ -783,10 +752,10 @@ function removeFileContent({ filePath, fileType, failureReason, projectType, })
|
|
|
783
752
|
};
|
|
784
753
|
}
|
|
785
754
|
exports.removeFileContent = removeFileContent;
|
|
786
|
-
function isValidURL(
|
|
755
|
+
function isValidURL(str) {
|
|
787
756
|
let url;
|
|
788
757
|
try {
|
|
789
|
-
url = new URL(
|
|
758
|
+
url = new URL(str);
|
|
790
759
|
}
|
|
791
760
|
catch (e) {
|
|
792
761
|
return false;
|
|
@@ -794,6 +763,144 @@ function isValidURL(string) {
|
|
|
794
763
|
return url.protocol === 'http:' || url.protocol === 'https:';
|
|
795
764
|
}
|
|
796
765
|
exports.isValidURL = isValidURL;
|
|
766
|
+
/**
|
|
767
|
+
* Checks if the OCI registry URL has been provided.
|
|
768
|
+
*/
|
|
769
|
+
function checkOCIRegistryURLProvided(iacOrgSettings) {
|
|
770
|
+
return (checkOCIRegistryURLExistsInSettings(iacOrgSettings) ||
|
|
771
|
+
!!user_config_1.config.get('oci-registry-url'));
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Checks if the OCI registry URL was provided in the org's IaC settings.
|
|
775
|
+
*/
|
|
776
|
+
function checkOCIRegistryURLExistsInSettings(iacOrgSettings) {
|
|
777
|
+
var _a, _b;
|
|
778
|
+
return (!!((_a = iacOrgSettings.customRules) === null || _a === void 0 ? void 0 : _a.isEnabled) &&
|
|
779
|
+
!!((_b = iacOrgSettings.customRules) === null || _b === void 0 ? void 0 : _b.ociRegistryURL));
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Extracts the OCI registry URL components from the org's IaC settings.
|
|
783
|
+
*/
|
|
784
|
+
function getOCIRegistryURLComponentsFromSettings(iacOrgSettings) {
|
|
785
|
+
const settingsOCIRegistryURL = iacOrgSettings.customRules.ociRegistryURL;
|
|
786
|
+
if (!isValidURL(settingsOCIRegistryURL)) {
|
|
787
|
+
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|
788
|
+
}
|
|
789
|
+
return {
|
|
790
|
+
...oci_pull_1.extractOCIRegistryURLComponents(settingsOCIRegistryURL),
|
|
791
|
+
tag: iacOrgSettings.customRules.ociRegistryTag || 'latest',
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Extracts the OCI registry URL components from the environment variables.
|
|
796
|
+
*/
|
|
797
|
+
function getOCIRegistryURLComponentsFromEnv() {
|
|
798
|
+
const envOCIRegistryURL = user_config_1.config.get('oci-registry-url');
|
|
799
|
+
if (!isValidURL(envOCIRegistryURL)) {
|
|
800
|
+
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|
801
|
+
}
|
|
802
|
+
return oci_pull_1.extractOCIRegistryURLComponents(envOCIRegistryURL);
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Gets the OCI registry URL components from either the env variables or the IaC org settings.
|
|
806
|
+
*/
|
|
807
|
+
function getOCIRegistryURLComponents(iacOrgSettings) {
|
|
808
|
+
if (checkOCIRegistryURLExistsInSettings(iacOrgSettings)) {
|
|
809
|
+
return getOCIRegistryURLComponentsFromSettings(iacOrgSettings);
|
|
810
|
+
}
|
|
811
|
+
// Default is to get the URL from env variables.
|
|
812
|
+
return getOCIRegistryURLComponentsFromEnv();
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Pull and store the IaC custom-rules bundle from the remote OCI Registry.
|
|
816
|
+
*/
|
|
817
|
+
async function pullIaCCustomRules(iacOrgSettings) {
|
|
818
|
+
const ociRegistryURLComponents = getOCIRegistryURLComponents(iacOrgSettings);
|
|
819
|
+
const username = user_config_1.config.get('oci-registry-username');
|
|
820
|
+
const password = user_config_1.config.get('oci-registry-password');
|
|
821
|
+
const opt = {
|
|
822
|
+
username,
|
|
823
|
+
password,
|
|
824
|
+
reqOptions: {
|
|
825
|
+
acceptManifest: types_1.manifestContentType,
|
|
826
|
+
acceptLayer: types_1.layerContentType,
|
|
827
|
+
indexContentType: '',
|
|
828
|
+
},
|
|
829
|
+
};
|
|
830
|
+
try {
|
|
831
|
+
await measurable_methods_1.pull(ociRegistryURLComponents, opt);
|
|
832
|
+
}
|
|
833
|
+
catch (err) {
|
|
834
|
+
if (err.statusCode === 401) {
|
|
835
|
+
throw new FailedToPullCustomBundleError('There was an authentication error. Incorrect credentials provided.');
|
|
836
|
+
}
|
|
837
|
+
else if (err.statusCode === 404) {
|
|
838
|
+
throw new FailedToPullCustomBundleError('The remote repository could not be found. Please check the provided URL.');
|
|
839
|
+
}
|
|
840
|
+
else if (err instanceof oci_pull_1.InvalidManifestSchemaVersionError) {
|
|
841
|
+
throw new FailedToPullCustomBundleError(err.message);
|
|
842
|
+
}
|
|
843
|
+
else if (err instanceof oci_pull_1.FailedToBuildOCIArtifactError) {
|
|
844
|
+
throw new oci_pull_1.FailedToBuildOCIArtifactError();
|
|
845
|
+
}
|
|
846
|
+
else if (err instanceof oci_pull_1.InvalidRemoteRegistryURLError) {
|
|
847
|
+
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
throw new FailedToPullCustomBundleError();
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
exports.pullIaCCustomRules = pullIaCCustomRules;
|
|
855
|
+
/**
|
|
856
|
+
* Asserts the custom-rules feature is available for the provided org.
|
|
857
|
+
*/
|
|
858
|
+
async function assertCustomRulesAvailable(orgPublicId, iacOrgSettings) {
|
|
859
|
+
var _a;
|
|
860
|
+
const isCustomRulesEnabled = !!(await feature_flags_1.isFeatureFlagSupportedForOrg('iacCustomRules', orgPublicId)).ok;
|
|
861
|
+
if (!isCustomRulesEnabled) {
|
|
862
|
+
throw new errors_1.UnsupportedFeatureFlagError('iacCustomRules');
|
|
863
|
+
}
|
|
864
|
+
const isEntitledToCustomRules = !!((_a = iacOrgSettings.entitlements) === null || _a === void 0 ? void 0 : _a.iacCustomRulesEntitlement);
|
|
865
|
+
if (!isEntitledToCustomRules) {
|
|
866
|
+
throw new unsupported_entitlement_error_1.UnsupportedEntitlementError('iacCustomRulesEntitlement');
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Asserts the --rules flag is available for the provided org.
|
|
871
|
+
*/
|
|
872
|
+
async function assertRulesFlagAvailable(orgPublicId, iacOrgSettings) {
|
|
873
|
+
try {
|
|
874
|
+
await assertCustomRulesAvailable(orgPublicId, iacOrgSettings);
|
|
875
|
+
}
|
|
876
|
+
catch (err) {
|
|
877
|
+
if (err instanceof unsupported_entitlement_error_1.UnsupportedEntitlementError) {
|
|
878
|
+
throw new assert_iac_options_flag_1.UnsupportedEntitlementFlagError('rules', err.entitlement);
|
|
879
|
+
}
|
|
880
|
+
else if (err instanceof errors_1.UnsupportedFeatureFlagError) {
|
|
881
|
+
throw new assert_iac_options_flag_1.FlagError('rules', err.featureFlag);
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
throw err;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Asserts the feature custom-rules bundles pulling feature is available for the provided org.
|
|
890
|
+
*/
|
|
891
|
+
async function assertPullAvailable(orgPublicId, iacOrgSettings) {
|
|
892
|
+
try {
|
|
893
|
+
await assertCustomRulesAvailable(orgPublicId, iacOrgSettings);
|
|
894
|
+
}
|
|
895
|
+
catch (err) {
|
|
896
|
+
if (err instanceof unsupported_entitlement_error_1.UnsupportedEntitlementError) {
|
|
897
|
+
throw new oci_pull_1.UnsupportedEntitlementPullError(err.entitlement);
|
|
898
|
+
}
|
|
899
|
+
else if (err instanceof errors_1.UnsupportedFeatureFlagError) {
|
|
900
|
+
throw new oci_pull_1.UnsupportedFeatureFlagPullError(err.featureFlag);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
797
904
|
class FailedToPullCustomBundleError extends errors_1.CustomError {
|
|
798
905
|
constructor(message) {
|
|
799
906
|
super(message || 'Could not pull custom bundle');
|
|
@@ -1087,7 +1194,7 @@ exports.pull = measurableOciPull;
|
|
|
1087
1194
|
"use strict";
|
|
1088
1195
|
|
|
1089
1196
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1090
|
-
exports.InvalidRemoteRegistryURLError = exports.InvalidManifestSchemaVersionError = exports.FailedToBuildOCIArtifactError = exports.pull = exports.
|
|
1197
|
+
exports.UnsupportedEntitlementPullError = exports.UnsupportedFeatureFlagPullError = exports.InvalidRemoteRegistryURLError = exports.InvalidManifestSchemaVersionError = exports.FailedToBuildOCIArtifactError = exports.pull = exports.extractOCIRegistryURLComponents = exports.CUSTOM_RULES_TARBALL = void 0;
|
|
1091
1198
|
const registryClient = __webpack_require__(28310);
|
|
1092
1199
|
const fs_1 = __webpack_require__(35747);
|
|
1093
1200
|
const path = __webpack_require__(85622);
|
|
@@ -1100,7 +1207,7 @@ const measurable_methods_1 = __webpack_require__(78272);
|
|
|
1100
1207
|
const file_utils_1 = __webpack_require__(58486);
|
|
1101
1208
|
const debug = Debug('iac-oci-pull');
|
|
1102
1209
|
exports.CUSTOM_RULES_TARBALL = 'custom-bundle.tar.gz';
|
|
1103
|
-
function
|
|
1210
|
+
function extractOCIRegistryURLComponents(OCIRegistryURL) {
|
|
1104
1211
|
try {
|
|
1105
1212
|
const url = OCIRegistryURL.split('://')[1];
|
|
1106
1213
|
const [registryBase, accountName, repoWithTag] = url.split('/');
|
|
@@ -1112,7 +1219,7 @@ function extractURLComponents(OCIRegistryURL) {
|
|
|
1112
1219
|
throw new InvalidRemoteRegistryURLError();
|
|
1113
1220
|
}
|
|
1114
1221
|
}
|
|
1115
|
-
exports.
|
|
1222
|
+
exports.extractOCIRegistryURLComponents = extractOCIRegistryURLComponents;
|
|
1116
1223
|
/**
|
|
1117
1224
|
* Downloads an OCI Artifact from a remote OCI Registry and writes it to the disk.
|
|
1118
1225
|
* The artifact here is a custom rules bundle stored in a remote registry.
|
|
@@ -1172,6 +1279,24 @@ class InvalidRemoteRegistryURLError extends errors_1.CustomError {
|
|
|
1172
1279
|
}
|
|
1173
1280
|
}
|
|
1174
1281
|
exports.InvalidRemoteRegistryURLError = InvalidRemoteRegistryURLError;
|
|
1282
|
+
class UnsupportedFeatureFlagPullError extends errors_1.CustomError {
|
|
1283
|
+
constructor(featureFlag) {
|
|
1284
|
+
super('OCI Pull not supported - Missing the ${featureFlag} feature flag');
|
|
1285
|
+
this.code = types_1.IaCErrorCodes.UnsupportedFeatureFlagPullError;
|
|
1286
|
+
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|
1287
|
+
this.userMessage = `The custom rules feature is not supported for this org - The feature flag '${featureFlag}' is not currently enabled. It can be enabled via Snyk Preview, if you are on the Enterprise Plan.`;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
exports.UnsupportedFeatureFlagPullError = UnsupportedFeatureFlagPullError;
|
|
1291
|
+
class UnsupportedEntitlementPullError extends errors_1.CustomError {
|
|
1292
|
+
constructor(entitlement) {
|
|
1293
|
+
super(`OCI Pull not supported - Missing the ${entitlement} entitlement`);
|
|
1294
|
+
this.code = types_1.IaCErrorCodes.UnsupportedEntitlementPullError;
|
|
1295
|
+
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|
1296
|
+
this.userMessage = `The custom rules feature is currently not supported for this org. To enable it, please contact snyk support.`;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
exports.UnsupportedEntitlementPullError = UnsupportedEntitlementPullError;
|
|
1175
1300
|
|
|
1176
1301
|
|
|
1177
1302
|
/***/ }),
|
|
@@ -2207,6 +2332,28 @@ FailOnError.ERROR_MESSAGE = 'Invalid fail on argument, please use one of: ' +
|
|
|
2207
2332
|
Object.keys(common_1.FAIL_ON).join(' | ');
|
|
2208
2333
|
|
|
2209
2334
|
|
|
2335
|
+
/***/ }),
|
|
2336
|
+
|
|
2337
|
+
/***/ 78673:
|
|
2338
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2339
|
+
|
|
2340
|
+
"use strict";
|
|
2341
|
+
|
|
2342
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2343
|
+
exports.UnsupportedEntitlementError = void 0;
|
|
2344
|
+
const custom_error_1 = __webpack_require__(17188);
|
|
2345
|
+
class UnsupportedEntitlementError extends custom_error_1.CustomError {
|
|
2346
|
+
constructor(entitlement, userMessage = `This feature is currently not enabled for your org. To enable it, please contact snyk support.`) {
|
|
2347
|
+
super('Unsupported feature - Missing the ${entitlementName} entitlement');
|
|
2348
|
+
this.entitlement = entitlement;
|
|
2349
|
+
this.code = UnsupportedEntitlementError.ERROR_CODE;
|
|
2350
|
+
this.userMessage = userMessage;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
exports.UnsupportedEntitlementError = UnsupportedEntitlementError;
|
|
2354
|
+
UnsupportedEntitlementError.ERROR_CODE = 403;
|
|
2355
|
+
|
|
2356
|
+
|
|
2210
2357
|
/***/ }),
|
|
2211
2358
|
|
|
2212
2359
|
/***/ 9401:
|