@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,226 @@
1
+ Checkmate for Auth0 Third Party Licenses and Notices
2
+
3
+ This document contains third party open source licenses and notices for the Checkmate for Auth0 product. Certain licenses and notices may appear in other parts of the
4
+ product in accordance with the applicable license requirements.
5
+
6
+ The Checkmate for Auth0 product that this document references does not necessarily use all the
7
+ open source software packages referred to below and may also only use portions
8
+ of a given package.
9
+
10
+ Third Party Notices
11
+ -------------------------------------------------------------------------------
12
+
13
+ acorn (8.14.0)
14
+ License: MIT
15
+ Copyright (c) 2012-2022 by various contributors (see AUTHORS)
16
+ Repository: https://github.com/acornjs/acorn
17
+
18
+ axios (1.12.0)
19
+ License: MIT
20
+ Copyright (c) 2014-present Matt Zabriskie & Collaborators
21
+ Repository: https://github.com/axios/axios
22
+
23
+ chalk (4.1.2)
24
+ License: MIT
25
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
26
+ Repository: https://github.com/chalk/chalk
27
+
28
+ cli-table3 (0.6.5)
29
+ License: MIT
30
+ Copyright (c) 2014 James Talmage <james@talmage.io>
31
+ Repository: https://github.com/cli-table/cli-table3
32
+
33
+ estree-walker (2.0.2)
34
+ License: MIT
35
+ Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/contributors)
36
+ Repository: https://github.com/Rich-Harris/estree-walker
37
+
38
+ figlet (1.8.0)
39
+ License: MIT
40
+ Copyright (C) 2014-present Patrick Gillespie and other contributors
41
+ Repository: https://github.com/patorjk/figlet.js
42
+
43
+ glob (11.0.1)
44
+ License: ISC
45
+ Copyright (c) 2009-2023 Isaac Z. Schlueter and Contributors
46
+ Repository: https://github.com/isaacs/node-glob
47
+
48
+ handlebars (4.7.8)
49
+ License: MIT
50
+ Copyright (C) 2011-2019 by Yehuda Katz
51
+ Repository: https://github.com/handlebars-lang/handlebars.js
52
+
53
+ i18n (0.15.1)
54
+ License: MIT
55
+ Copyright (c) 2011-present Marcus Spiegel <marcus.spiegel@gmail.com>
56
+ Repository: https://github.com/mashpie/i18n-node
57
+
58
+ inquirer (12.3.3)
59
+ License: MIT
60
+ Copyright (c) 2025 Simon Boudrias
61
+ Repository: https://github.com/SBoudrias/Inquirer.js
62
+
63
+ jsonwebtoken (9.0.2)
64
+ License: MIT
65
+ Copyright (c) 2015 Auth0, Inc. <support@auth0.com> (http://auth0.com)
66
+ Repository: https://github.com/auth0/node-jsonwebtoken
67
+
68
+ lodash (4.17.21)
69
+ License: MIT
70
+ Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
71
+ Repository: https://github.com/lodash/lodash
72
+
73
+ moment (2.30.1)
74
+ License: MIT
75
+ Copyright (c) JS Foundation and other contributors
76
+ Repository: https://github.com/moment/moment
77
+
78
+ puppeteer (23.10.0)
79
+ License: Apache-2.0
80
+ Copyright 2017 Google Inc.
81
+ Repository: https://github.com/puppeteer/puppeteer
82
+
83
+ semver (7.7.1)
84
+ License: ISC
85
+ Copyright (c) Isaac Z. Schlueter and Contributors
86
+ Repository: https://github.com/npm/node-semver
87
+
88
+ winston (3.17.0)
89
+ License: MIT
90
+ Copyright (c) 2010 Charlie Robbins
91
+ Repository: https://github.com/winstonjs/winston
92
+
93
+ -------------------------------------------------------------------------------
94
+ Development Dependencies
95
+ -------------------------------------------------------------------------------
96
+
97
+ @eslint/js (9.23.0)
98
+ License: MIT
99
+ Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
100
+ Repository: https://github.com/eslint/eslint
101
+
102
+ chai (5.2.0)
103
+ License: MIT
104
+ Copyright (c) 2017 Chai.js Assertion Library
105
+ Repository: https://github.com/chaijs/chai
106
+
107
+ eslint (9.23.0)
108
+ License: MIT
109
+ Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
110
+ Repository: https://github.com/eslint/eslint
111
+
112
+ eslint-plugin-mocha (10.5.0)
113
+ License: MIT
114
+ Copyright (c) 2014 Mathias Schreck <schreck.mathias@gmail.com>
115
+ Repository: https://github.com/lo1tuma/eslint-plugin-mocha
116
+
117
+ globals (16.0.0)
118
+ License: MIT
119
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
120
+ Repository: https://github.com/sindresorhus/globals
121
+
122
+ mocha (11.1.0)
123
+ License: MIT
124
+ Copyright (c) 2011-2022 OpenJS Foundation and contributors, https://openjsf.org
125
+ Repository: https://github.com/mochajs/mocha
126
+
127
+ nock (14.0.1)
128
+ License: MIT
129
+ Copyright (c) 2011-2019 Pedro Teixeira and other contributors
130
+ Repository: https://github.com/nock/nock
131
+
132
+ nyc (17.1.0)
133
+ License: ISC
134
+ Copyright (c) 2015, Contributors
135
+ Repository: https://github.com/istanbuljs/nyc
136
+
137
+ proxyquire (2.1.3)
138
+ License: MIT
139
+ Copyright 2013 Thorsten Lorenz
140
+ Repository: https://github.com/thlorenz/proxyquire
141
+
142
+ sinon (19.0.2)
143
+ License: BSD-3-Clause
144
+ Copyright (c) 2010-2020, Christian Johansen
145
+ Repository: https://github.com/sinonjs/sinon
146
+
147
+ -------------------------------------------------------------------------------
148
+ License Texts
149
+ -------------------------------------------------------------------------------
150
+
151
+ MIT License
152
+
153
+ Permission is hereby granted, free of charge, to any person obtaining a copy
154
+ of this software and associated documentation files (the "Software"), to deal
155
+ in the Software without restriction, including without limitation the rights
156
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
157
+ copies of the Software, and to permit persons to whom the Software is
158
+ furnished to do so, subject to the following conditions:
159
+
160
+ The above copyright notice and this permission notice shall be included in all
161
+ copies or substantial portions of the Software.
162
+
163
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
164
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
166
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
167
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
168
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
169
+ SOFTWARE.
170
+
171
+ ISC License
172
+
173
+ Permission to use, copy, modify, and/or distribute this software for any
174
+ purpose with or without fee is hereby granted, provided that the above
175
+ copyright notice and this permission notice appear in all copies.
176
+
177
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
178
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
179
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
180
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
181
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
182
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
183
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
184
+
185
+ Apache License 2.0
186
+
187
+ Licensed under the Apache License, Version 2.0 (the "License");
188
+ you may not use this file except in compliance with the License.
189
+ You may obtain a copy of the License at
190
+
191
+ http://www.apache.org/licenses/LICENSE-2.0
192
+
193
+ Unless required by applicable law or agreed to in writing, software
194
+ distributed under the License is distributed on an "AS IS" BASIS,
195
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
196
+ See the License for the specific language governing permissions and
197
+ limitations under the License.
198
+
199
+ BSD 3-Clause License
200
+
201
+ Redistribution and use in source and binary forms, with or without
202
+ modification, are permitted provided that the following conditions are met:
203
+
204
+ 1. Redistributions of source code must retain the above copyright notice, this
205
+ list of conditions and the following disclaimer.
206
+
207
+ 2. Redistributions in binary form must reproduce the above copyright notice,
208
+ this list of conditions and the following disclaimer in the documentation
209
+ and/or other materials provided with the distribution.
210
+
211
+ 3. Neither the name of the copyright holder nor the names of its
212
+ contributors may be used to endorse or promote products derived from
213
+ this software without specific prior written permission.
214
+
215
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
216
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
217
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
218
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
219
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
220
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
221
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
222
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
223
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
224
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
225
+
226
+
@@ -0,0 +1,151 @@
1
+ /*
2
+ {
3
+ "actions": [
4
+ {
5
+ "id": "0cdb84c6-9faf-4344-b1c5-affa9db5a63f",
6
+ "name": "Custom Phone Provider",
7
+ "supported_triggers": [
8
+ {
9
+ "id": "custom-phone-provider",
10
+ "version": "v1"
11
+ }
12
+ ],
13
+ "created_at": "2024-12-05T03:14:55.811465959Z",
14
+ "updated_at": "2024-12-05T03:14:55.831277001Z",
15
+ "code": "exports.onExecuteCustomPhoneProvider = async (event, api) => {\n // Code goes here\n return;\n};",
16
+ "dependencies": [],
17
+ "runtime": "node18",
18
+ "status": "built",
19
+ "secrets": [],
20
+ "all_changes_deployed": false
21
+ },
22
+ {
23
+ "id": "89df9e29-d521-43f4-9b80-8a8f9623ad39",
24
+ "name": "Console Log",
25
+ "supported_triggers": [
26
+ {
27
+ "id": "post-login",
28
+ "version": "v3"
29
+ }
30
+ ],
31
+ "created_at": "2024-12-05T03:48:52.546705182Z",
32
+ "updated_at": "2025-02-05T04:33:20.935611754Z",
33
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n const PASSWORD = \"abcd1234\";\n console.log(JSON.stringify(event.user, null, 2));\n};",
34
+ "dependencies": [
35
+ {
36
+ "name": "aws-sdk",
37
+ "version": "2.1448.0"
38
+ }
39
+ ],
40
+ "runtime": "node18-actions",
41
+ "status": "built",
42
+ "secrets": [],
43
+ "all_changes_deployed": true
44
+ },
45
+ {
46
+ "id": "7d24512b-aa56-4ddc-8b51-68583110c5fa",
47
+ "name": "action example 1",
48
+ "supported_triggers": [
49
+ {
50
+ "id": "post-login",
51
+ "version": "v3"
52
+ }
53
+ ],
54
+ "created_at": "2025-02-05T03:03:04.643668771Z",
55
+ "updated_at": "2025-02-05T03:03:04.666046787Z",
56
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n};",
57
+ "dependencies": [],
58
+ "runtime": "node22",
59
+ "status": "built",
60
+ "secrets": [],
61
+ "all_changes_deployed": false
62
+ }
63
+ ],
64
+ "total": 3
65
+ }
66
+ */
67
+ const _ = require("lodash");
68
+ const executeCheck = require("../executeCheck");
69
+ const CONSTANTS = require("../constants");
70
+ const acorn = require("acorn");
71
+ const walk = require("estree-walker").walk;
72
+
73
+ function detectHardcodedValues(code, scriptName) {
74
+ let processedCode = code.replace(/(?!\w+#)\b#(\w+)/g, "_$1");
75
+ const ast = acorn.parse(processedCode, {
76
+ ecmaVersion: "latest",
77
+ locations: true,
78
+ });
79
+
80
+ const hardcodedValues = [];
81
+
82
+ // Walk through the AST
83
+ walk(ast, {
84
+ enter(node) {
85
+ // Check for variable assignments with hardcoded literals
86
+ if (node.type === "VariableDeclaration") {
87
+ node.declarations.forEach((declaration) => {
88
+ if (
89
+ declaration.init &&
90
+ declaration.init.type === "Literal" &&
91
+ typeof declaration.init.value === "string"
92
+ ) {
93
+ // Add the variable name and the type of the hardcoded literal
94
+ hardcodedValues.push({
95
+ scriptName: scriptName,
96
+ variableName: declaration.id.name,
97
+ field: "hard_coded_value_detected",
98
+ status: CONSTANTS.FAIL,
99
+ type: typeof declaration.init.value,
100
+ line: declaration.loc.start.line,
101
+ column: declaration.loc.start.column,
102
+ });
103
+ }
104
+ });
105
+ }
106
+ },
107
+ });
108
+
109
+ return hardcodedValues.filter(
110
+ (entry) =>
111
+ !isCommonException(entry.value) && !isConstantDeclaration(this.parent),
112
+ );
113
+ }
114
+
115
+ // Helper functions
116
+ function isCommonException(value) {
117
+ const exceptions = [
118
+ /^[0-1]$/, // Allow 0 and 1
119
+ /^[a-z]$/i, // Single letters
120
+ /^\s*$/, // Whitespace-only
121
+ /^[{}()[]<>]+$/, // Common brackets
122
+ ];
123
+ return exceptions.some((regex) => regex.test(String(value)));
124
+ }
125
+
126
+ function isConstantDeclaration(node) {
127
+ return node?.type === "VariableDeclarator" && node.parent?.kind === "const";
128
+ }
129
+
130
+ function checkActionsHardCodedValues(options) {
131
+ const { actions } = options || [];
132
+ return executeCheck("checkActionsHardCodedValues", (callback) => {
133
+ const actionsList = _.isArray(actions) ? actions : actions.actions;
134
+ const reports = [];
135
+ if (_.isEmpty(actionsList)) {
136
+ return callback(reports);
137
+ }
138
+ actionsList.forEach((action) => {
139
+ var actionName = action.name.concat(
140
+ ` (${action.supported_triggers[0].id})`,
141
+ );
142
+ var report = detectHardcodedValues(action.code, actionName);
143
+ if (report.length > 0) {
144
+ reports.push({ name: actionName, report: report });
145
+ }
146
+ });
147
+ return callback(reports);
148
+ });
149
+ }
150
+
151
+ module.exports = checkActionsHardCodedValues;
@@ -0,0 +1,105 @@
1
+ /*
2
+ {
3
+ "actions": [
4
+ {
5
+ "id": "0cdb84c6-9faf-4344-b1c5-affa9db5a63f",
6
+ "name": "Custom Phone Provider",
7
+ "supported_triggers": [
8
+ {
9
+ "id": "custom-phone-provider",
10
+ "version": "v1"
11
+ }
12
+ ],
13
+ "created_at": "2024-12-05T03:14:55.811465959Z",
14
+ "updated_at": "2024-12-05T03:14:55.831277001Z",
15
+ "code": "exports.onExecuteCustomPhoneProvider = async (event, api) => {\n // Code goes here\n return;\n};",
16
+ "dependencies": [],
17
+ "runtime": "node18",
18
+ "status": "built",
19
+ "secrets": [],
20
+ "all_changes_deployed": false
21
+ },
22
+ {
23
+ "id": "89df9e29-d521-43f4-9b80-8a8f9623ad39",
24
+ "name": "Console Log",
25
+ "supported_triggers": [
26
+ {
27
+ "id": "post-login",
28
+ "version": "v3"
29
+ }
30
+ ],
31
+ "created_at": "2024-12-05T03:48:52.546705182Z",
32
+ "updated_at": "2025-02-05T04:33:20.935611754Z",
33
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n const PASSWORD = \"abcd1234\";\n console.log(JSON.stringify(event.user, null, 2));\n};",
34
+ "dependencies": [
35
+ {
36
+ "name": "aws-sdk",
37
+ "version": "2.1448.0"
38
+ }
39
+ ],
40
+ "runtime": "node18-actions",
41
+ "status": "built",
42
+ "secrets": [],
43
+ "all_changes_deployed": true
44
+ },
45
+ {
46
+ "id": "7d24512b-aa56-4ddc-8b51-68583110c5fa",
47
+ "name": "action example 1",
48
+ "supported_triggers": [
49
+ {
50
+ "id": "post-login",
51
+ "version": "v3"
52
+ }
53
+ ],
54
+ "created_at": "2025-02-05T03:03:04.643668771Z",
55
+ "updated_at": "2025-02-05T03:03:04.666046787Z",
56
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n};",
57
+ "dependencies": [],
58
+ "runtime": "node22",
59
+ "status": "built",
60
+ "secrets": [],
61
+ "all_changes_deployed": false
62
+ }
63
+ ],
64
+ "total": 3
65
+ }
66
+ */
67
+ const _ = require("lodash");
68
+ const executeCheck = require("../executeCheck");
69
+ const CONSTANTS = require("../constants");
70
+
71
+ const getRuntimeVersion = (runtime) => {
72
+ const regex = /node(\d*)/;
73
+ const [, version] = runtime.match(regex) ?? [];
74
+ return Number(version);
75
+ };
76
+ function checkActionsRuntime(options) {
77
+ const { actions } = options || [];
78
+ return executeCheck("checkActionsRuntime", (callback) => {
79
+ const report = [];
80
+ if (_.isEmpty(actions)) {
81
+ return callback(report);
82
+ }
83
+ const actionsList = _.isArray(actions) ? actions : actions.actions;
84
+ if (_.isEmpty(actionsList)) {
85
+ return callback(report);
86
+ }
87
+ actionsList.forEach((action) => {
88
+ if (action.runtime.includes("node")) {
89
+ const version = getRuntimeVersion(action.runtime);
90
+ if (version < CONSTANTS.MINIMUM_NODE_VERSION) {
91
+ report.push({
92
+ name: action.name.concat(` (${action.supported_triggers[0].id})`),
93
+ field: "old_node_version",
94
+ status: CONSTANTS.FAIL,
95
+ value: version,
96
+ });
97
+ return;
98
+ }
99
+ }
100
+ });
101
+ return callback(report);
102
+ });
103
+ }
104
+
105
+ module.exports = checkActionsRuntime;
@@ -0,0 +1,111 @@
1
+ /*
2
+ {
3
+ "actions": [
4
+ {
5
+ "id": "0cdb84c6-9faf-4344-b1c5-affa9db5a63f",
6
+ "name": "Custom Phone Provider",
7
+ "supported_triggers": [
8
+ {
9
+ "id": "custom-phone-provider",
10
+ "version": "v1"
11
+ }
12
+ ],
13
+ "created_at": "2024-12-05T03:14:55.811465959Z",
14
+ "updated_at": "2024-12-05T03:14:55.831277001Z",
15
+ "code": "exports.onExecuteCustomPhoneProvider = async (event, api) => {\n // Code goes here\n return;\n};",
16
+ "dependencies": [],
17
+ "runtime": "node18",
18
+ "status": "built",
19
+ "secrets": [],
20
+ "all_changes_deployed": false
21
+ },
22
+ {
23
+ "id": "89df9e29-d521-43f4-9b80-8a8f9623ad39",
24
+ "name": "Console Log",
25
+ "supported_triggers": [
26
+ {
27
+ "id": "post-login",
28
+ "version": "v3"
29
+ }
30
+ ],
31
+ "created_at": "2024-12-05T03:48:52.546705182Z",
32
+ "updated_at": "2025-02-05T04:33:20.935611754Z",
33
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n const PASSWORD = \"abcd1234\";\n console.log(JSON.stringify(event.user, null, 2));\n};",
34
+ "dependencies": [
35
+ {
36
+ "name": "aws-sdk",
37
+ "version": "2.1448.0"
38
+ }
39
+ ],
40
+ "runtime": "node18-actions",
41
+ "status": "built",
42
+ "secrets": [],
43
+ "all_changes_deployed": true
44
+ },
45
+ {
46
+ "id": "7d24512b-aa56-4ddc-8b51-68583110c5fa",
47
+ "name": "action example 1",
48
+ "supported_triggers": [
49
+ {
50
+ "id": "post-login",
51
+ "version": "v3"
52
+ }
53
+ ],
54
+ "created_at": "2025-02-05T03:03:04.643668771Z",
55
+ "updated_at": "2025-02-05T03:03:04.666046787Z",
56
+ "code": "exports.onExecutePostLogin = async (event, api) => {\n};",
57
+ "dependencies": [],
58
+ "runtime": "node22",
59
+ "status": "built",
60
+ "secrets": [],
61
+ "all_changes_deployed": false
62
+ }
63
+ ],
64
+ "total": 3
65
+ }
66
+ */
67
+ const _ = require("lodash");
68
+ const executeCheck = require("../executeCheck");
69
+ const { getActionDependencies } = require("../../tools/helpers");
70
+ const CONSTANTS = require("../constants");
71
+
72
+ async function checkDependencies(options) {
73
+ const { actions } = options || [];
74
+ return executeCheck("checkDependencies", async (callback) => {
75
+ const report = [];
76
+ if (_.isEmpty(actions)) {
77
+ return callback(report);
78
+ }
79
+ const actionsList = _.isArray(actions) ? actions : actions.actions;
80
+ if (_.isEmpty(actionsList)) {
81
+ return callback(report);
82
+ }
83
+ var actionDependencyVulnList = await getActionDependencies(actionsList);
84
+ for (let i = 0; i < actionDependencyVulnList.length; i++) {
85
+ var actionDependencyVuln = actionDependencyVulnList[i];
86
+
87
+ if (!_.isEmpty(actionDependencyVulnList[i])) {
88
+ const vulnFindings = actionDependencyVuln.vulnFindings.filter(
89
+ (item) => item.severity === "high" || item.severity === "critical",
90
+ );
91
+ if (vulnFindings.length > 0) {
92
+ report.push({
93
+ name: actionDependencyVuln.actionName.concat(
94
+ ` (${actionDependencyVuln.trigger}-action)`,
95
+ ),
96
+ field: "dependency_with_vuln",
97
+ status: CONSTANTS.FAIL,
98
+ vulnFindings: vulnFindings,
99
+ value:
100
+ actionDependencyVuln.name +
101
+ " version " +
102
+ actionDependencyVuln.version,
103
+ });
104
+ }
105
+ }
106
+ }
107
+ return callback(report);
108
+ });
109
+ }
110
+
111
+ module.exports = checkDependencies;
@@ -0,0 +1,76 @@
1
+ /*
2
+ {
3
+ "selected": "auth0_v2",
4
+ "policy": "off",
5
+ "passwordless_policy": "always_on",
6
+ "password_reset_policy": "off",
7
+ "providers": {
8
+ },
9
+ "allowlist": []
10
+ }
11
+ */
12
+ const _ = require("lodash");
13
+ const executeCheck = require("../executeCheck");
14
+ const CONSTANTS = require("../constants");
15
+
16
+ function validateBotDetectionSettings(config) {
17
+ const report = [];
18
+ if (_.isEmpty(config)) {
19
+ return report;
20
+ }
21
+ if (config.policy !== "off") {
22
+ report.push({
23
+ field: "policy_enabled",
24
+ status: CONSTANTS.SUCCESS,
25
+ });
26
+ } else {
27
+ report.push({
28
+ field: "policy_disabled",
29
+ status: CONSTANTS.FAIL,
30
+ });
31
+ }
32
+ if (config.passwordless_policy !== "off") {
33
+ report.push({
34
+ field: "passwordless_policy_enabled",
35
+ status: CONSTANTS.SUCCESS,
36
+ });
37
+ } else {
38
+ report.push({
39
+ field: "passwordless_policy_disabled",
40
+ status: CONSTANTS.FAIL,
41
+ });
42
+ }
43
+ if (config.password_reset_policy !== "off") {
44
+ report.push({
45
+ field: "password_reset_policy_enabled",
46
+ status: CONSTANTS.SUCCESS,
47
+ });
48
+ } else {
49
+ report.push({
50
+ field: "password_reset_policy_disabled",
51
+ status: CONSTANTS.FAIL,
52
+ });
53
+ }
54
+ // Check allowlist
55
+ if (config.allowlist.length > 0) {
56
+ report.push({
57
+ field: "allowlistPresent",
58
+ status: CONSTANTS.FAIL,
59
+ value: config.allowlist.join(", "),
60
+ });
61
+ } else {
62
+ report.push({
63
+ field: "allowlistEmpty",
64
+ status: CONSTANTS.SUCCESS,
65
+ });
66
+ }
67
+ // Return the validation report
68
+ return report;
69
+ }
70
+ function checkBotDetectionSetting(options) {
71
+ const { botDetection } = options.attackProtection || {};
72
+ return executeCheck("checkBotDetectionSetting", (callback) => {
73
+ return callback(validateBotDetectionSettings(botDetection));
74
+ });
75
+ }
76
+ module.exports = checkBotDetectionSetting;