@auth0/auth0-checkmate 1.4.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.
Files changed (114) hide show
  1. package/.github/CODEOWNERS +1 -0
  2. package/.github/workflows/npm-release.yml +77 -0
  3. package/.github/workflows/sca_scan.yml +10 -0
  4. package/.github/workflows/test.yml +48 -0
  5. package/AUTHORS +5 -0
  6. package/LICENSE +203 -0
  7. package/README.md +166 -0
  8. package/THIRD-PARTY-NOTICES +226 -0
  9. package/analyzer/lib/actions/checkActionsHardCodedValues.js +151 -0
  10. package/analyzer/lib/actions/checkActionsRuntime.js +105 -0
  11. package/analyzer/lib/actions/checkDependencies.js +111 -0
  12. package/analyzer/lib/attack_protection/checkBotDetectionSetting.js +76 -0
  13. package/analyzer/lib/attack_protection/checkBreachedPassword.js +140 -0
  14. package/analyzer/lib/attack_protection/checkBruteForce.js +89 -0
  15. package/analyzer/lib/attack_protection/checkSuspiciousIPThrottling.js +89 -0
  16. package/analyzer/lib/canonical_domain/checkCanonicalDomain.js +63 -0
  17. package/analyzer/lib/clients/checkAllowedCallbacks.js +122 -0
  18. package/analyzer/lib/clients/checkAllowedLogoutUrl.js +124 -0
  19. package/analyzer/lib/clients/checkApplicationLoginUri.js +125 -0
  20. package/analyzer/lib/clients/checkCrossOriginAuthentication.js +91 -0
  21. package/analyzer/lib/clients/checkGrantTypes.js +138 -0
  22. package/analyzer/lib/clients/checkJWTSignAlg.js +118 -0
  23. package/analyzer/lib/clients/checkRefreshToken.js +108 -0
  24. package/analyzer/lib/clients/checkWebOrigins.js +55 -0
  25. package/analyzer/lib/constants.js +63 -0
  26. package/analyzer/lib/custom_domain/checkCustomDomain.js +53 -0
  27. package/analyzer/lib/databases/checkAuthenticationMethods.js +98 -0
  28. package/analyzer/lib/databases/checkDASHardCodedValues.js +163 -0
  29. package/analyzer/lib/databases/checkEmailAttributeVerification.js +114 -0
  30. package/analyzer/lib/databases/checkEnabledDatabaseCustomization.js +83 -0
  31. package/analyzer/lib/databases/checkPasswordComplexity.js +100 -0
  32. package/analyzer/lib/databases/checkPasswordHistory.js +92 -0
  33. package/analyzer/lib/databases/checkPasswordNoPersonalInfo.js +91 -0
  34. package/analyzer/lib/databases/checkPasswordPolicy.js +95 -0
  35. package/analyzer/lib/databases/checkPromotedDBConnection.js +96 -0
  36. package/analyzer/lib/email_provider/checkEmailProvider.js +37 -0
  37. package/analyzer/lib/email_templates/checkEmailTemplates.js +71 -0
  38. package/analyzer/lib/error_page_template/checkErrorPageTemplate.js +153 -0
  39. package/analyzer/lib/event_streams/checkEventStreams.js +71 -0
  40. package/analyzer/lib/executeCheck.js +12 -0
  41. package/analyzer/lib/hooks/checkHooks.js +43 -0
  42. package/analyzer/lib/listOfAnalyser.js +24 -0
  43. package/analyzer/lib/log_streams/checkLogStream.js +60 -0
  44. package/analyzer/lib/logger.js +16 -0
  45. package/analyzer/lib/multifactor/checkGuardianFactors.js +72 -0
  46. package/analyzer/lib/multifactor/checkGuardianPolicy.js +40 -0
  47. package/analyzer/lib/network_acl/checkNetworkACL.js +35 -0
  48. package/analyzer/lib/rules/checkRules.js +102 -0
  49. package/analyzer/lib/tenant_settings/checkDefaultAudience.js +53 -0
  50. package/analyzer/lib/tenant_settings/checkDefaultDirectory.js +48 -0
  51. package/analyzer/lib/tenant_settings/checkEnabledDynamicClientRegistration.js +60 -0
  52. package/analyzer/lib/tenant_settings/checkSandboxVersion.js +37 -0
  53. package/analyzer/lib/tenant_settings/checkSessionLifetime.js +95 -0
  54. package/analyzer/lib/tenant_settings/checkSupportEmail.js +61 -0
  55. package/analyzer/lib/tenant_settings/checkSupportUrl.js +61 -0
  56. package/analyzer/lib/tenant_settings/checkTenantLoginUrl.js +71 -0
  57. package/analyzer/lib/tenant_settings/checkTenantLogoutUrl.js +60 -0
  58. package/analyzer/report.js +404 -0
  59. package/analyzer/tools/auth0.js +443 -0
  60. package/analyzer/tools/helpers.js +71 -0
  61. package/analyzer/tools/summary.js +84 -0
  62. package/analyzer/tools/utils.js +72 -0
  63. package/bin/index.js +393 -0
  64. package/eslint.config.mjs +16 -0
  65. package/images/auth0.png +0 -0
  66. package/images/okta.png +0 -0
  67. package/locales/en.json +1417 -0
  68. package/package.json +66 -0
  69. package/tests/actions/checkActionsHardCodedValues.test.js +106 -0
  70. package/tests/actions/checkActionsRuntime.test.js +102 -0
  71. package/tests/actions/checkDependencies.test.js +131 -0
  72. package/tests/attack_protection/checkBreachedPassword.test.js +253 -0
  73. package/tests/attack_protection/checkBruteForce.test.js +181 -0
  74. package/tests/attack_protection/checkSuspiciousIPThrottling.test.js +222 -0
  75. package/tests/canonical_domain/checkCanonicalDomain.test.js +94 -0
  76. package/tests/clients/checkAllowedCallbacks.test.js +149 -0
  77. package/tests/clients/checkAllowedLogoutUrl.test.js +149 -0
  78. package/tests/clients/checkApplicationLoginUri.test.js +180 -0
  79. package/tests/clients/checkCrossOriginAuthentication.test.js +99 -0
  80. package/tests/clients/checkGrantTypes.test.js +154 -0
  81. package/tests/clients/checkJWTSignAlg.test.js +121 -0
  82. package/tests/clients/checkRefreshToken.test.js +63 -0
  83. package/tests/clients/checkWebOrigins.test.js +140 -0
  84. package/tests/custom_domain/checkCustomDomain.test.js +73 -0
  85. package/tests/databases/checkAuthenticationMethods.test.js +124 -0
  86. package/tests/databases/checkDASHardCodedValues.test.js +77 -0
  87. package/tests/databases/checkEmailAttributeVerification.test.js +79 -0
  88. package/tests/databases/checkEnabledDatabaseCustomization.test.js +68 -0
  89. package/tests/databases/checkPasswordComplexity.test.js +127 -0
  90. package/tests/databases/checkPasswordHistory.test.js +100 -0
  91. package/tests/databases/checkPasswordNoPersonalInfo.test.js +94 -0
  92. package/tests/databases/checkPasswordPolicy.test.js +161 -0
  93. package/tests/databases/checkPromotedDBConnection.test.js +62 -0
  94. package/tests/email_provider/checkEmailProvider.test.js +58 -0
  95. package/tests/email_templates/checkEmailTemplates.test.js +120 -0
  96. package/tests/error_page_template/checkErrorPageTemplate.test.js +315 -0
  97. package/tests/event_streams/checkEventStreams.test.js +118 -0
  98. package/tests/hooks/checkHooks.test.js +112 -0
  99. package/tests/log_streams/checkLogStream.test.js +140 -0
  100. package/tests/multifactor/checkGuardianFactors.test.js +94 -0
  101. package/tests/multifactor/checkGuardianPolicy.test.js +49 -0
  102. package/tests/rules/checkRules.test.js +102 -0
  103. package/tests/tenant_settings/checkDefaultAudience.test.js +62 -0
  104. package/tests/tenant_settings/checkDefaultDirectory.test.js +62 -0
  105. package/tests/tenant_settings/checkEnabledDynamicClientRegistration.test.js +97 -0
  106. package/tests/tenant_settings/checkSandboxVersion.test.js +50 -0
  107. package/tests/tenant_settings/checkSessionLifetime.test.js +108 -0
  108. package/tests/tenant_settings/checkSupportEmail.test.js +77 -0
  109. package/tests/tenant_settings/checkSupportUrl.test.js +77 -0
  110. package/tests/tenant_settings/checkTenantLoginUri.test.js +82 -0
  111. package/tests/tenant_settings/checkTenantLogoutUrl.test.js +108 -0
  112. package/tests/tools/auth0.test.js +833 -0
  113. package/tests/tools/helpers.test.js +692 -0
  114. package/views/pdf_cli_report.handlebars +571 -0
@@ -0,0 +1,12 @@
1
+ module.exports = function (name, checkFx) {
2
+ const result = {
3
+ checkName: name,
4
+ result: null,
5
+ details: [],
6
+ timestamp: Date.now(),
7
+ };
8
+ return checkFx(function callback(details) {
9
+ result.details = details;
10
+ return Promise.resolve(result);
11
+ });
12
+ };
@@ -0,0 +1,43 @@
1
+ /*
2
+ [
3
+ {
4
+ "id": "test",
5
+ "name": "test",
6
+ "script": "",
7
+ "dependencies": {},
8
+ "enabled": true,
9
+ "triggerId": "post-user-registration"
10
+ }
11
+ ]
12
+ */
13
+ const _ = require("lodash");
14
+ const executeCheck = require("../executeCheck");
15
+ const CONSTANTS = require("../constants");
16
+
17
+ function validateHooks(config) {
18
+ const report = [];
19
+ if (_.isEmpty(config)) {
20
+ report.push({
21
+ field: "no_enabled_hooks",
22
+ status: CONSTANTS.SUCCESS,
23
+ });
24
+ return report;
25
+ }
26
+ config.forEach((hook) => {
27
+ report.push({
28
+ name: hook.name,
29
+ value: hook.triggerId,
30
+ field: "enabled_hooks",
31
+ status: hook.enabled ? CONSTANTS.FAIL : CONSTANTS.SUCCESS,
32
+ });
33
+ });
34
+ // Return the validation report
35
+ return report;
36
+ }
37
+ function checkHooks(options) {
38
+ const { hooks } = options || [];
39
+ return executeCheck("checkHooks", (callback) => {
40
+ return callback(validateHooks(hooks));
41
+ });
42
+ }
43
+ module.exports = checkHooks;
@@ -0,0 +1,24 @@
1
+ const glob = require("glob");
2
+ const path = require("path");
3
+ // Array to hold the required modules
4
+ let requiredModules = [];
5
+
6
+ // Match only directories in the current directory
7
+ const directories = glob.sync(path.join(__dirname, "/*/")); // Synchronously match directories in the current directory
8
+ directories.forEach((directory) => {
9
+ // Match all files in each directory
10
+ const pathName = path.join(directory, "*.*");
11
+ const files = glob.sync(pathName); // Synchronously match files in the directory
12
+ files.forEach((file) => {
13
+ const filePath = path.resolve(file);
14
+ try {
15
+ const module = require(filePath); // Dynamically require the file
16
+ requiredModules.push(module); // Add the required module to the array
17
+ } catch (error) {
18
+ console.error(`Error requiring file: ${filePath}`, error);
19
+ }
20
+ });
21
+ });
22
+
23
+ // Export the required modules
24
+ module.exports.checks = requiredModules;
@@ -0,0 +1,60 @@
1
+ /*
2
+ [
3
+ {
4
+ "id": "lst_0000000000014671",
5
+ "name": "Okta Logstream",
6
+ "type": "http",
7
+ "status": "active",
8
+ "filters": [
9
+
10
+ ],
11
+ "isPriority": false
12
+ }
13
+ ]
14
+ */
15
+
16
+ const _ = require("lodash");
17
+ const executeCheck = require("../executeCheck");
18
+ const CONSTANTS = require("../constants");
19
+
20
+ function checkLogStream(options) {
21
+ const { logStreams } = options;
22
+ return executeCheck("checkLogStream", (callback) => {
23
+ const report = [];
24
+ const hasInsufficientScope = _.some(logStreams, {
25
+ errorCode: "insufficient_scope",
26
+ });
27
+ if (hasInsufficientScope) {
28
+ return callback(report);
29
+ }
30
+ if (_.isEmpty(logStreams)) {
31
+ report.push({
32
+ field: "log_stream_not_configured",
33
+ status: CONSTANTS.FAIL,
34
+ });
35
+ } else {
36
+ logStreams.forEach((stream) => {
37
+ if (stream.status === "active") {
38
+ report.push({
39
+ field: "log_stream_active",
40
+ name: stream.name,
41
+ type: stream.type,
42
+ stream_status: stream.status,
43
+ status: CONSTANTS.SUCCESS,
44
+ });
45
+ } else {
46
+ report.push({
47
+ field: "log_stream_inactive",
48
+ name: stream.name,
49
+ type: stream.type,
50
+ stream_status: stream.status,
51
+ status: CONSTANTS.FAIL,
52
+ });
53
+ }
54
+ });
55
+ }
56
+ return callback(report);
57
+ });
58
+ }
59
+
60
+ module.exports = checkLogStream;
@@ -0,0 +1,16 @@
1
+ const { format, createLogger, transports } = require("winston");
2
+
3
+ const { combine, timestamp, colorize } = format;
4
+ const logger = createLogger({
5
+ level: process.env.DEBUG === "true" ? "debug" : "info",
6
+ format: combine(
7
+ colorize(),
8
+ timestamp(),
9
+ format.printf(
10
+ (info) => `${info.timestamp} - ${info.level}: ${info.message}`,
11
+ ),
12
+ ),
13
+ transports: [new transports.Console()],
14
+ exitOnError: false,
15
+ });
16
+ module.exports = logger;
@@ -0,0 +1,72 @@
1
+ /*
2
+ [
3
+ {
4
+ "name": "sms",
5
+ "enabled": false,
6
+ "trial_expired": false
7
+ },
8
+ {
9
+ "name": "push-notification",
10
+ "enabled": false,
11
+ "trial_expired": false
12
+ },
13
+ {
14
+ "name": "otp",
15
+ "enabled": true,
16
+ "trial_expired": false
17
+ },
18
+ {
19
+ "name": "email",
20
+ "enabled": false,
21
+ "trial_expired": false
22
+ },
23
+ {
24
+ "name": "duo",
25
+ "enabled": false,
26
+ "trial_expired": false
27
+ },
28
+ {
29
+ "name": "webauthn-roaming",
30
+ "enabled": false,
31
+ "trial_expired": false
32
+ },
33
+ {
34
+ "name": "webauthn-platform",
35
+ "enabled": false,
36
+ "trial_expired": false
37
+ },
38
+ {
39
+ "name": "recovery-code",
40
+ "enabled": false,
41
+ "trial_expired": false
42
+ }
43
+ ]
44
+ */
45
+ const _ = require("lodash");
46
+ const executeCheck = require("../executeCheck");
47
+ const CONSTANTS = require("../constants");
48
+ function checkGuardianFactors(options) {
49
+ const { guardianFactors } = options || {};
50
+ return executeCheck("checkGuardianFactors", (callback) => {
51
+ const report = [];
52
+ const enabledFactors = _.map(
53
+ _.filter(guardianFactors, { enabled: true }),
54
+ "name",
55
+ );
56
+ if (_.isEmpty(enabledFactors)) {
57
+ report.push({
58
+ field: "mfa_factors_not_enabled",
59
+ status: CONSTANTS.FAIL,
60
+ });
61
+ } else {
62
+ report.push({
63
+ field: "mfa_factors_enabled",
64
+ value: enabledFactors.join(""),
65
+ status: CONSTANTS.SUCCESS,
66
+ });
67
+ }
68
+ return callback(report);
69
+ });
70
+ }
71
+
72
+ module.exports = checkGuardianFactors;
@@ -0,0 +1,40 @@
1
+ /*
2
+ [
3
+ "all-applications"
4
+ ]
5
+ */
6
+ const _ = require("lodash");
7
+ const executeCheck = require("../executeCheck");
8
+ const CONSTANTS = require("../constants");
9
+ function checkGuardianPolicy(options) {
10
+ const { guardianPolicies } = options || { policies: [] };
11
+ return executeCheck("checkGuardianPolicy", (callback) => {
12
+ const report = [];
13
+ if (_.isEmpty(guardianPolicies)) {
14
+ report.push({
15
+ field: "mfa_policy_set_to_never",
16
+ value: CONSTANTS.MULTIFACTOR_POLICY["empty"],
17
+ status: CONSTANTS.FAIL,
18
+ });
19
+ return callback(report);
20
+ }
21
+ const policies = guardianPolicies.policies || [];
22
+ if (_.isEmpty(policies)) {
23
+ policies.push("empty");
24
+ report.push({
25
+ field: "mfa_policy_set_to_never",
26
+ value: CONSTANTS.MULTIFACTOR_POLICY[policies.join("")],
27
+ status: CONSTANTS.FAIL,
28
+ });
29
+ } else {
30
+ report.push({
31
+ field: "mfa_policy_set",
32
+ value: CONSTANTS.MULTIFACTOR_POLICY[policies.join("")],
33
+ status: CONSTANTS.SUCCESS,
34
+ });
35
+ }
36
+ return callback(report);
37
+ });
38
+ }
39
+
40
+ module.exports = checkGuardianPolicy;
@@ -0,0 +1,35 @@
1
+ const _ = require("lodash");
2
+ const executeCheck = require("../executeCheck");
3
+ const CONSTANTS = require("../constants");
4
+
5
+ function checkNetworkACL(options) {
6
+ const { networkAcl } = options || [];
7
+ return executeCheck("checkNetworkACL", (callback) => {
8
+ const report = [];
9
+ const hasInsufficientScope = _.some(networkAcl, {
10
+ errorCode: "insufficient_scope",
11
+ });
12
+ if (hasInsufficientScope) {
13
+ return callback(report);
14
+ }
15
+ if (_.isEmpty(networkAcl)) {
16
+ report.push({
17
+ field: "no_network_acl",
18
+ status: CONSTANTS.FAIL,
19
+ });
20
+ } else {
21
+ networkAcl.forEach((acl) => {
22
+ if (!acl.active) {
23
+ report.push({
24
+ field: "network_acl_inactive",
25
+ name: acl.description.concat(`(${acl.acl_id})`),
26
+ status: CONSTANTS.FAIL,
27
+ });
28
+ }
29
+ });
30
+ }
31
+ return callback(report);
32
+ });
33
+ }
34
+
35
+ module.exports = checkNetworkACL;
@@ -0,0 +1,102 @@
1
+ /*
2
+ [
3
+ {
4
+ "id": "rul_IYlu62iBa6K52fBi",
5
+ "enabled": false,
6
+ "name": "Dump Rule",
7
+ "order": 1,
8
+ "stage": "login_success"
9
+ },
10
+ {
11
+ "id": "rul_RFtsxXcHptdfNytp",
12
+ "enabled": false,
13
+ "name": "auth0-account-link-extension",
14
+ "order": 7,
15
+ "stage": "login_success"
16
+ },
17
+ {
18
+ "id": "rul_PUbmUscnlFfvqWEo",
19
+ "enabled": false,
20
+ "name": "Link Accounts with Same Email Address while Merging Metadata",
21
+ "order": 6,
22
+ "stage": "login_success"
23
+ },
24
+ {
25
+ "id": "rul_2UMKolzalvxt4x5k",
26
+ "enabled": false,
27
+ "name": "Link Accounts with Same Email Address while Merging Metadata For FB",
28
+ "order": 11,
29
+ "stage": "login_success"
30
+ },
31
+ {
32
+ "id": "rul_U9tyXS894nPYxHPT",
33
+ "enabled": false,
34
+ "name": "redirect rule rule",
35
+ "order": 9,
36
+ "stage": "login_success"
37
+ },
38
+ {
39
+ "id": "rul_f4K2T8LBE5sdM6sk",
40
+ "enabled": false,
41
+ "name": "Add attributes to a user for facebook connection",
42
+ "order": 10,
43
+ "stage": "login_success"
44
+ },
45
+ {
46
+ "id": "rul_A892yaO7K5dpmzhr",
47
+ "enabled": false,
48
+ "name": "Redirect rule for capturing email",
49
+ "order": 13,
50
+ "stage": "login_success"
51
+ },
52
+ {
53
+ "id": "rul_Wcr19IorVdhsRfnc",
54
+ "enabled": false,
55
+ "name": "MYOB SAML",
56
+ "order": 15,
57
+ "stage": "login_success"
58
+ },
59
+ {
60
+ "id": "rul_YFDdYGJSIwMPzsZR",
61
+ "enabled": true,
62
+ "name": "Override SAML Certificate",
63
+ "order": 14,
64
+ "stage": "login_success"
65
+ }
66
+ ]
67
+ */
68
+ const _ = require("lodash");
69
+ const executeCheck = require("../executeCheck");
70
+ const CONSTANTS = require("../constants");
71
+
72
+ function validateRules(config) {
73
+ const report = [];
74
+ if (_.isEmpty(config)) {
75
+ report.push({
76
+ field: "no_enabled_rules",
77
+ status: CONSTANTS.SUCCESS,
78
+ });
79
+ return report;
80
+ }
81
+ config.forEach((rule) => {
82
+ if (rule.enabled) {
83
+ report.push({
84
+ name: rule.name,
85
+ value: rule.id,
86
+ field: "enabled_rules",
87
+ status: CONSTANTS.FAIL,
88
+ });
89
+ }
90
+ return;
91
+ });
92
+ // Return the validation report
93
+ return report;
94
+ }
95
+ function checkRules(options) {
96
+ const { rules } = options || [];
97
+ return executeCheck("checkRules", (callback) => {
98
+ const report = validateRules(rules);
99
+ return callback(report);
100
+ });
101
+ }
102
+ module.exports = checkRules;
@@ -0,0 +1,53 @@
1
+ /*
2
+ {
3
+ "allowed_logout_urls": [
4
+ "https://contoso.com"
5
+ ],
6
+ "default_redirection_uri": "https://contoso.com/login",
7
+ "support_email": "",
8
+ "support_url": "",
9
+ "sandbox_version": "22",
10
+ "sandbox_versions_available": [
11
+ "22",
12
+ "18",
13
+ "16",
14
+ "12"
15
+ ]
16
+ }
17
+ */
18
+ const _ = require("lodash");
19
+ const executeCheck = require("../executeCheck");
20
+ const CONSTANTS = require("../constants");
21
+ const defaultValues = {
22
+ allowed_logout_urls: [],
23
+ default_redirection_uri: [],
24
+ default_audience: "",
25
+ default_directory: "",
26
+ support_email: null,
27
+ support_url: null,
28
+ };
29
+ function checkDefaultAudience(options) {
30
+ const { tenant } = options || {};
31
+ return executeCheck("checkDefaultAudience", (callback) => {
32
+ const report = [];
33
+ const { default_audience } = _.defaultsDeep({}, tenant, defaultValues);
34
+ if (_.isNil(default_audience) || _.isEmpty(default_audience)) {
35
+ report.push({
36
+ field: "no_default_audience",
37
+ attr: "default_audience",
38
+ status: CONSTANTS.INFO,
39
+ });
40
+ } else {
41
+ report.push({
42
+ field: "default_audience",
43
+ attr: "default_audience",
44
+ value: default_audience,
45
+ status: CONSTANTS.FAIL,
46
+ });
47
+ }
48
+
49
+ return callback(report);
50
+ });
51
+ }
52
+
53
+ module.exports = checkDefaultAudience;
@@ -0,0 +1,48 @@
1
+ /*
2
+ {
3
+ "allowed_logout_urls": [
4
+ "https://contoso.com"
5
+ ],
6
+ "default_redirection_uri": "https://contoso.com/login",
7
+ "support_email": "",
8
+ "support_url": "",
9
+ "sandbox_version": "22",
10
+ "sandbox_versions_available": [
11
+ "22",
12
+ "18",
13
+ "16",
14
+ "12"
15
+ ]
16
+ }
17
+ */
18
+ const _ = require("lodash");
19
+ const executeCheck = require("../executeCheck");
20
+ const CONSTANTS = require("../constants");
21
+
22
+ const defaultValues = {
23
+ allowed_logout_urls: [],
24
+ default_redirection_uri: [],
25
+ default_audience: "",
26
+ default_directory: "",
27
+ support_email: null,
28
+ support_url: null,
29
+ };
30
+ function checkDefaultDirectory(options) {
31
+ const { tenant } = options || {};
32
+ return executeCheck("checkDefaultDirectory", (callback) => {
33
+ const report = [];
34
+ const { default_directory } = _.defaultsDeep({}, tenant, defaultValues);
35
+ report.push({
36
+ field:
37
+ _.isNil(default_directory) || _.isEmpty(default_directory)
38
+ ? "no_default_directory"
39
+ : "default_directory",
40
+ attr: "default_directory",
41
+ value: default_directory,
42
+ status: _.isNil(default_directory) || _.isEmpty(default_directory) ? CONSTANTS.INFO : CONSTANTS.FAIL,
43
+ });
44
+ return callback(report);
45
+ });
46
+ }
47
+
48
+ module.exports = checkDefaultDirectory;
@@ -0,0 +1,60 @@
1
+
2
+ /*
3
+ {
4
+ "allowed_logout_urls": [
5
+ "https://contoso.com"
6
+ ],
7
+ "flags": {
8
+ "allow_changing_enable_sso": true,
9
+ "disable_impersonation": true,
10
+ "enable_dynamic_client_registration": true, // Can be false or undefined
11
+ "enable_sso": true,
12
+ "universal_login": true,
13
+ "revoke_refresh_token_grant": false,
14
+ "disable_clickjack_protection_headers": false
15
+ },
16
+ "default_redirection_uri": "https://contoso.com/login",
17
+ "support_email": "",
18
+ "support_url": "",
19
+ "sandbox_version": "22",
20
+ "sandbox_versions_available": [
21
+ "22",
22
+ "18",
23
+ "16",
24
+ "12"
25
+ ]
26
+ }
27
+ */
28
+ const _ = require("lodash");
29
+ const executeCheck = require("../executeCheck");
30
+ const CONSTANTS = require("../constants");
31
+
32
+ function checkEnabledDynamicClientRegistration(options) {
33
+ const { tenant } = options || {};
34
+ return executeCheck("checkEnabledDynamicClientRegistration", (callback) => {
35
+ const report = [];
36
+ if (_.isEmpty(tenant)) {
37
+ report.push({
38
+ field: "tenant_setting_missing",
39
+ status: CONSTANTS.FAIL,
40
+ });
41
+ return callback(report);
42
+ }
43
+ const { flags } = tenant;
44
+
45
+ if (flags?.enable_dynamic_client_registration) {
46
+ report.push({
47
+ field: "enabled_dynamic_client_registration",
48
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
49
+ });
50
+ } else {
51
+ report.push({
52
+ field: "enable_dynamic_client_registration",
53
+ status: CONSTANTS.FAIL,
54
+ });
55
+ }
56
+ return callback(report);
57
+ });
58
+ }
59
+
60
+ module.exports = checkEnabledDynamicClientRegistration;
@@ -0,0 +1,37 @@
1
+ /*
2
+ {
3
+ "allowed_logout_urls": [
4
+ "https://contoso.com"
5
+ ],
6
+ "default_redirection_uri": "https://contoso.com/login",
7
+ "support_email": "",
8
+ "support_url": "",
9
+ "sandbox_version": "22",
10
+ "sandbox_versions_available": [
11
+ "22",
12
+ "18",
13
+ "16",
14
+ "12"
15
+ ]
16
+ }
17
+ */
18
+ const executeCheck = require("../executeCheck");
19
+ const CONSTANTS = require("../constants");
20
+ function checkSandboxVersion(options) {
21
+ const { tenant } = options || {};
22
+ return executeCheck("checkSandboxVersion", (callback) => {
23
+ const report = [];
24
+ const sandbox_version = Number(tenant.sandbox_version);
25
+ if (sandbox_version < CONSTANTS.MINIMUM_NODE_VERSION) {
26
+ report.push({
27
+ field: "sandbox_version",
28
+ attr: "sandbox_version",
29
+ value: sandbox_version,
30
+ status: CONSTANTS.FAIL,
31
+ });
32
+ }
33
+ return callback(report);
34
+ });
35
+ }
36
+
37
+ module.exports = checkSandboxVersion;