@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,95 @@
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
+ "idle_session_lifetime": 72, //default
18
+ "session_lifetime": 168, //default
19
+ "oidc_logout": {
20
+ "rp_logout_end_session_endpoint_discovery": true
21
+ },
22
+ "session_cookie": {
23
+ "mode": "persistent" //default
24
+ },
25
+ "support_email": "",
26
+ "support_url": "",
27
+ "sandbox_version": "22",
28
+ "sandbox_versions_available": [
29
+ "22",
30
+ "18",
31
+ "16",
32
+ "12"
33
+ ]
34
+ }
35
+ */
36
+ const _ = require("lodash");
37
+ const executeCheck = require("../executeCheck");
38
+ const CONSTANTS = require("../constants");
39
+
40
+ function checkSessionLifetime(options) {
41
+ const { tenant } = options || {};
42
+ return executeCheck("checkSessionLifetime", (callback) => {
43
+ const report = [];
44
+ if (_.isEmpty(tenant)) {
45
+ report.push({
46
+ field: "tenant_setting_missing",
47
+ status: CONSTANTS.FAIL,
48
+ });
49
+ return callback(report);
50
+ }
51
+ const { idle_session_lifetime, session_lifetime, session_cookie } = tenant;
52
+ if (_.isEmpty(idle_session_lifetime)) {
53
+ report.push({
54
+ field: "idle_session_lifetime",
55
+ value: CONSTANTS.DEFAULT_IDLE_SESSION_LIFETIME,
56
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
57
+ });
58
+ } else {
59
+ report.push({
60
+ field: "idle_session_lifetime",
61
+ value: `${idle_session_lifetime}h`,
62
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
63
+ });
64
+ }
65
+ if (_.isEmpty(session_lifetime)) {
66
+ report.push({
67
+ field: "session_lifetime",
68
+ value: CONSTANTS.DEFAULT_SESSION_LIFETIME,
69
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
70
+ });
71
+ } else {
72
+ report.push({
73
+ field: "session_lifetime",
74
+ value: `${session_lifetime}h`,
75
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
76
+ });
77
+ }
78
+ if (_.isEmpty(session_cookie)) {
79
+ report.push({
80
+ field: "session_cookie_mode",
81
+ value: CONSTANTS.DEFAULT_SESSION_COOKIE_MODE,
82
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
83
+ });
84
+ } else {
85
+ report.push({
86
+ field: "session_cookie_mode",
87
+ value: session_cookie?.mode,
88
+ status: CONSTANTS.FAIL, //to surface this configuration in the report
89
+ });
90
+ }
91
+ return callback(report);
92
+ });
93
+ }
94
+
95
+ module.exports = checkSessionLifetime;
@@ -0,0 +1,61 @@
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 checkSupportEmail(options) {
31
+ const { tenant } = options || {};
32
+ return executeCheck("checkSupportEmail", (callback) => {
33
+ const report = [];
34
+ if (_.isEmpty(tenant)) {
35
+ report.push({
36
+ field: "tenant_setting_missing",
37
+ status: CONSTANTS.FAIL,
38
+ });
39
+ return callback(report);
40
+ }
41
+ const { support_email } = _.defaultsDeep({}, tenant, defaultValues);
42
+
43
+ if (support_email) {
44
+ report.push({
45
+ field: "support_email",
46
+ attr: "support_email",
47
+ value: support_email,
48
+ status: CONSTANTS.SUCCESS,
49
+ });
50
+ } else {
51
+ report.push({
52
+ field: "no_support_email",
53
+ attr: "support_email",
54
+ status: CONSTANTS.FAIL,
55
+ });
56
+ }
57
+ return callback(report);
58
+ });
59
+ }
60
+
61
+ module.exports = checkSupportEmail;
@@ -0,0 +1,61 @@
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 checkSupportUrl(options) {
31
+ const { tenant } = options || {};
32
+ return executeCheck("checkSupportUrl", (callback) => {
33
+ const report = [];
34
+ if (_.isEmpty(tenant)) {
35
+ report.push({
36
+ field: "tenant_setting_missing",
37
+ status: CONSTANTS.FAIL,
38
+ });
39
+ return callback(report);
40
+ }
41
+ const { support_url } = _.defaultsDeep({}, tenant, defaultValues);
42
+
43
+ if (support_url) {
44
+ report.push({
45
+ field: "support_url",
46
+ attr: "support_url",
47
+ value: support_url,
48
+ status: CONSTANTS.SUCCESS,
49
+ });
50
+ } else {
51
+ report.push({
52
+ field: "no_support_url",
53
+ attr: "support_url",
54
+ status: CONSTANTS.FAIL,
55
+ });
56
+ }
57
+ return callback(report);
58
+ });
59
+ }
60
+
61
+ module.exports = checkSupportUrl;
@@ -0,0 +1,71 @@
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 checkTenantLoginUrl(options) {
30
+ const { tenant } = options || {};
31
+ return executeCheck("checkTenantLoginUrl", (callback) => {
32
+ const report = [];
33
+ const { default_redirection_uri } = _.defaultsDeep(
34
+ {},
35
+ tenant,
36
+ defaultValues,
37
+ );
38
+ // allowed_logout_urls
39
+ const insecurePatterns = CONSTANTS.INSECURE_URL_PATTERN; //['localhost', 'http://', '127.0.0.1'];
40
+ //default_redirection_uri
41
+ if (_.isEmpty(default_redirection_uri)) {
42
+ report.push({
43
+ field: "no_default_redirection_uri",
44
+ attr: "default_redirection_uri",
45
+ status: CONSTANTS.FAIL,
46
+ });
47
+ } else {
48
+ const subArr = insecurePatterns.filter((str) =>
49
+ default_redirection_uri.includes(str),
50
+ );
51
+ if (subArr.length > 0) {
52
+ report.push({
53
+ field: "invalid_default_redirection_uri",
54
+ attr: "default_redirection_uri",
55
+ value: default_redirection_uri,
56
+ status: CONSTANTS.FAIL,
57
+ });
58
+ } else {
59
+ report.push({
60
+ field: "default_redirection_uri",
61
+ attr: "default_redirection_uri",
62
+ value: default_redirection_uri,
63
+ status: CONSTANTS.SUCCESS,
64
+ });
65
+ }
66
+ }
67
+ return callback(report);
68
+ });
69
+ }
70
+
71
+ module.exports = checkTenantLoginUrl;
@@ -0,0 +1,60 @@
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 checkTenantLogoutUrl(options) {
30
+ const { tenant } = options || {};
31
+ return executeCheck("checkTenantLogoutUrl", (callback) => {
32
+ const report = [];
33
+ const { allowed_logout_urls } = _.defaultsDeep({}, tenant, defaultValues);
34
+ // allowed_logout_urls
35
+ const insecurePatterns = CONSTANTS.INSECURE_URL_PATTERN;
36
+ if (allowed_logout_urls.length === 0) {
37
+ report.push({
38
+ field: "missing_allowed_logout_urls",
39
+ attr: "allowed_logout_urls",
40
+ value: ["[]"].join(","),
41
+ status: CONSTANTS.FAIL,
42
+ });
43
+ } else {
44
+ allowed_logout_urls.forEach((url) => {
45
+ const subArr = insecurePatterns.filter((str) => url.includes(str));
46
+ if (subArr.length > 0) {
47
+ report.push({
48
+ field: "invalid_allowed_logout_urls",
49
+ attr: "allowed_logout_urls",
50
+ value: url,
51
+ status: CONSTANTS.FAIL,
52
+ });
53
+ }
54
+ });
55
+ }
56
+ return callback(report);
57
+ });
58
+ }
59
+
60
+ module.exports = checkTenantLogoutUrl;