@warlock.js/devtools 5.57.0 → 5.59.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/CHANGELOG.md +23 -0
- package/README.md +3 -0
- package/cjs/{ai-source-DTpxumMA.cjs → ai-source-BdvMfyKw.cjs} +84 -17
- package/cjs/ai-source-BdvMfyKw.cjs.map +1 -0
- package/cjs/app-versions-DfpPZOI2.cjs +253 -0
- package/cjs/app-versions-DfpPZOI2.cjs.map +1 -0
- package/cjs/{auth-DzU0gHDG.cjs → auth-B3wyjJnQ.cjs} +43 -406
- package/cjs/auth-B3wyjJnQ.cjs.map +1 -0
- package/cjs/{boot-Dy5OqgTM.cjs → boot-nczSvJ_F.cjs} +15 -12
- package/cjs/boot-nczSvJ_F.cjs.map +1 -0
- package/cjs/{capture-CqIiaznN.cjs → capture-CuyT8Vab.cjs} +4 -4
- package/cjs/{capture-CqIiaznN.cjs.map → capture-CuyT8Vab.cjs.map} +1 -1
- package/cjs/{cascade-store-pHjKeSFm.cjs → cascade-store-CuRRYzt_.cjs} +141 -4
- package/cjs/cascade-store-CuRRYzt_.cjs.map +1 -0
- package/cjs/{current-request-id-BoJJb3y7.cjs → current-request-id-CeQhRz9Q.cjs} +3 -3
- package/cjs/{current-request-id-BoJJb3y7.cjs.map → current-request-id-CeQhRz9Q.cjs.map} +1 -1
- package/cjs/{errors-CyZp5yS-.cjs → errors-BadbSDX8.cjs} +6 -4
- package/cjs/errors-BadbSDX8.cjs.map +1 -0
- package/cjs/helpers-BcMBFy9v.cjs +439 -0
- package/cjs/helpers-BcMBFy9v.cjs.map +1 -0
- package/cjs/{histogram-BaI-PnCv.cjs → histogram-DTOGnNBW.cjs} +6 -6
- package/cjs/{histogram-BaI-PnCv.cjs.map → histogram-DTOGnNBW.cjs.map} +1 -1
- package/cjs/{http-DCfXQvw-.cjs → http-Biauhqi0.cjs} +517 -28
- package/cjs/http-Biauhqi0.cjs.map +1 -0
- package/cjs/index.cjs +1 -1
- package/cjs/{insights-BKtqxdnP.cjs → insights-BjJA6Ret.cjs} +8 -7
- package/cjs/{insights-BKtqxdnP.cjs.map → insights-BjJA6Ret.cjs.map} +1 -1
- package/cjs/{migrations-w7GMsrQw.cjs → migrations-BP4cYTGo.cjs} +40 -5
- package/cjs/migrations-BP4cYTGo.cjs.map +1 -0
- package/cjs/{options-CWqFC5__.cjs → options-B9FHbRAJ.cjs} +29 -5
- package/cjs/options-B9FHbRAJ.cjs.map +1 -0
- package/cjs/{panels-Rcmeitu3.cjs → panels-D1ITm-jc.cjs} +77 -11
- package/cjs/panels-D1ITm-jc.cjs.map +1 -0
- package/cjs/{process-panel-DEOnLxoT.cjs → process-panel-DskSA7Cm.cjs} +4 -4
- package/cjs/{process-panel-DEOnLxoT.cjs.map → process-panel-DskSA7Cm.cjs.map} +1 -1
- package/cjs/production/index.cjs +4 -4
- package/cjs/{server-ykxsOwob.cjs → server-D3XRbSSb.cjs} +8 -5
- package/cjs/server-D3XRbSSb.cjs.map +1 -0
- package/cjs/{src-UPtTCI2j.cjs → src-QcNghoYN.cjs} +52 -15
- package/cjs/src-QcNghoYN.cjs.map +1 -0
- package/cjs/{store-aq207T8v.cjs → store-CNFv3wVp.cjs} +2 -2
- package/cjs/{stream-route-CJTABkUy.cjs → stream-route-BqyAlfxQ.cjs} +92 -17
- package/cjs/stream-route-BqyAlfxQ.cjs.map +1 -0
- package/esm/app-versions.mjs +74 -0
- package/esm/app-versions.mjs.map +1 -0
- package/esm/devtools-connector.d.mts.map +1 -1
- package/esm/devtools-connector.mjs +10 -3
- package/esm/devtools-connector.mjs.map +1 -1
- package/esm/index.d.mts +3 -3
- package/esm/panel-errors.mjs +33 -0
- package/esm/panel-errors.mjs.map +1 -0
- package/esm/panels.mjs +73 -6
- package/esm/panels.mjs.map +1 -1
- package/esm/production/auth/helpers.mjs +8 -5
- package/esm/production/auth/helpers.mjs.map +1 -1
- package/esm/production/auth/service.mjs +15 -5
- package/esm/production/auth/service.mjs.map +1 -1
- package/esm/production/boot.mjs +5 -2
- package/esm/production/boot.mjs.map +1 -1
- package/esm/production/contracts.d.mts +75 -2
- package/esm/production/contracts.d.mts.map +1 -1
- package/esm/production/contracts.mjs +5 -1
- package/esm/production/contracts.mjs.map +1 -1
- package/esm/production/errors.d.mts +1 -1
- package/esm/production/errors.mjs +5 -3
- package/esm/production/errors.mjs.map +1 -1
- package/esm/production/http/access.mjs +6 -2
- package/esm/production/http/access.mjs.map +1 -1
- package/esm/production/http/constants.mjs +7 -1
- package/esm/production/http/constants.mjs.map +1 -1
- package/esm/production/http/context.mjs.map +1 -1
- package/esm/production/http/cookie.mjs +23 -2
- package/esm/production/http/cookie.mjs.map +1 -1
- package/esm/production/http/mount.mjs +25 -3
- package/esm/production/http/mount.mjs.map +1 -1
- package/esm/production/http/share-session.mjs +114 -0
- package/esm/production/http/share-session.mjs.map +1 -0
- package/esm/production/http/share.mjs +339 -0
- package/esm/production/http/share.mjs.map +1 -0
- package/esm/production/index.d.mts +2 -2
- package/esm/production/insights/writer.mjs +2 -1
- package/esm/production/insights/writer.mjs.map +1 -1
- package/esm/production/options.d.mts +10 -1
- package/esm/production/options.d.mts.map +1 -1
- package/esm/production/options.mjs +27 -3
- package/esm/production/options.mjs.map +1 -1
- package/esm/production/store/cascade-store.mjs +49 -2
- package/esm/production/store/cascade-store.mjs.map +1 -1
- package/esm/production/store/mapping.mjs +29 -1
- package/esm/production/store/mapping.mjs.map +1 -1
- package/esm/production/store/memory-store.mjs +62 -0
- package/esm/production/store/memory-store.mjs.map +1 -1
- package/esm/production/store/migrations.d.mts +2 -1
- package/esm/production/store/migrations.d.mts.map +1 -1
- package/esm/production/store/migrations.mjs +5 -2
- package/esm/production/store/migrations.mjs.map +1 -1
- package/esm/production/store/models/index.mjs +3 -1
- package/esm/production/store/models/share.migration.mjs +27 -0
- package/esm/production/store/models/share.migration.mjs.map +1 -0
- package/esm/production/store/models/share.model.mjs +13 -0
- package/esm/production/store/models/share.model.mjs.map +1 -0
- package/esm/server/ai-routes.mjs +20 -6
- package/esm/server/ai-routes.mjs.map +1 -1
- package/esm/server/panel-files.mjs +35 -0
- package/esm/server/panel-files.mjs.map +1 -0
- package/esm/server/panel-routes.mjs +27 -7
- package/esm/server/panel-routes.mjs.map +1 -1
- package/esm/server/session-routes.mjs +4 -1
- package/esm/server/session-routes.mjs.map +1 -1
- package/esm/sources/ai-source.d.mts.map +1 -1
- package/esm/sources/ai-source.mjs +75 -7
- package/esm/sources/ai-source.mjs.map +1 -1
- package/esm/types.d.mts +91 -3
- package/esm/types.d.mts.map +1 -1
- package/llms-full.txt +57 -19
- package/package.json +8 -8
- package/skills/SKILL.md +57 -19
- package/ui/dashboard/assets/app.css +1 -1
- package/ui/dashboard/assets/app.js +16 -16
- package/ui/dashboard/build-info.json +7 -7
- package/cjs/ai-source-DTpxumMA.cjs.map +0 -1
- package/cjs/auth-DzU0gHDG.cjs.map +0 -1
- package/cjs/boot-Dy5OqgTM.cjs.map +0 -1
- package/cjs/cascade-store-pHjKeSFm.cjs.map +0 -1
- package/cjs/contracts-CVmplkNb.cjs +0 -112
- package/cjs/contracts-CVmplkNb.cjs.map +0 -1
- package/cjs/errors-CyZp5yS-.cjs.map +0 -1
- package/cjs/http-DCfXQvw-.cjs.map +0 -1
- package/cjs/migrations-w7GMsrQw.cjs.map +0 -1
- package/cjs/options-CWqFC5__.cjs.map +0 -1
- package/cjs/panels-Rcmeitu3.cjs.map +0 -1
- package/cjs/rolldown-runtime-Zuuoy_Rh.cjs +0 -52
- package/cjs/server-ykxsOwob.cjs.map +0 -1
- package/cjs/src-UPtTCI2j.cjs.map +0 -1
- package/cjs/stream-route-CJTABkUy.cjs.map +0 -1
|
@@ -1,381 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_errors = require("./errors-
|
|
1
|
+
const require_app_versions = require("./app-versions-DfpPZOI2.cjs");
|
|
2
|
+
const require_errors = require("./errors-BadbSDX8.cjs");
|
|
3
3
|
const require_ip = require("./ip-DbNhPOzi.cjs");
|
|
4
|
+
const require_helpers = require("./helpers-BcMBFy9v.cjs");
|
|
4
5
|
let node_crypto = require("node:crypto");
|
|
5
6
|
|
|
6
|
-
//#region ../../packages/devtools/src/production/auth/common-passwords.ts
|
|
7
|
-
/**
|
|
8
|
-
* Passwords the monitor refuses (compared lower-cased). Short entries are
|
|
9
|
-
* left out: the length rule already refuses them.
|
|
10
|
-
*/
|
|
11
|
-
const COMMON_PASSWORDS = /* @__PURE__ */ new Set([
|
|
12
|
-
"password",
|
|
13
|
-
"password1",
|
|
14
|
-
"password12",
|
|
15
|
-
"password123",
|
|
16
|
-
"password1234",
|
|
17
|
-
"passw0rd",
|
|
18
|
-
"p@ssw0rd",
|
|
19
|
-
"p@ssword",
|
|
20
|
-
"password!",
|
|
21
|
-
"password1!",
|
|
22
|
-
"password2",
|
|
23
|
-
"password3",
|
|
24
|
-
"password01",
|
|
25
|
-
"password11",
|
|
26
|
-
"password99",
|
|
27
|
-
"pa55word",
|
|
28
|
-
"pa$$word",
|
|
29
|
-
"12345678",
|
|
30
|
-
"123456789",
|
|
31
|
-
"1234567890",
|
|
32
|
-
"12345678910",
|
|
33
|
-
"123123123",
|
|
34
|
-
"1234qwer",
|
|
35
|
-
"1q2w3e4r",
|
|
36
|
-
"1q2w3e4r5t",
|
|
37
|
-
"1q2w3e4r5t6y",
|
|
38
|
-
"1qaz2wsx",
|
|
39
|
-
"1qaz2wsx3edc",
|
|
40
|
-
"1qazxsw2",
|
|
41
|
-
"qwertyui",
|
|
42
|
-
"qwertyuiop",
|
|
43
|
-
"qwerty123",
|
|
44
|
-
"qwerty1234",
|
|
45
|
-
"qwerty12",
|
|
46
|
-
"qwertyuio",
|
|
47
|
-
"qwerty123456",
|
|
48
|
-
"qwerty12345",
|
|
49
|
-
"asdfghjk",
|
|
50
|
-
"asdfghjkl",
|
|
51
|
-
"asdfgh123",
|
|
52
|
-
"zxcvbnm1",
|
|
53
|
-
"zxcvbnmasd",
|
|
54
|
-
"zxcvbnm123",
|
|
55
|
-
"abcd1234",
|
|
56
|
-
"abcd12345",
|
|
57
|
-
"abc12345",
|
|
58
|
-
"abc123456",
|
|
59
|
-
"abcdefgh",
|
|
60
|
-
"abcdefg1",
|
|
61
|
-
"abcdefgh1",
|
|
62
|
-
"abcdefghi",
|
|
63
|
-
"iloveyou",
|
|
64
|
-
"iloveyou1",
|
|
65
|
-
"iloveyou2",
|
|
66
|
-
"iloveyou123",
|
|
67
|
-
"letmein1",
|
|
68
|
-
"letmein123",
|
|
69
|
-
"letmein12",
|
|
70
|
-
"welcome1",
|
|
71
|
-
"welcome12",
|
|
72
|
-
"welcome123",
|
|
73
|
-
"welcome01",
|
|
74
|
-
"welcome2",
|
|
75
|
-
"monkey123",
|
|
76
|
-
"monkey12",
|
|
77
|
-
"dragon123",
|
|
78
|
-
"dragon12",
|
|
79
|
-
"master123",
|
|
80
|
-
"master12",
|
|
81
|
-
"shadow123",
|
|
82
|
-
"shadow12",
|
|
83
|
-
"sunshine",
|
|
84
|
-
"sunshine1",
|
|
85
|
-
"sunshine123",
|
|
86
|
-
"princess",
|
|
87
|
-
"princess1",
|
|
88
|
-
"princess123",
|
|
89
|
-
"football",
|
|
90
|
-
"football1",
|
|
91
|
-
"football123",
|
|
92
|
-
"baseball",
|
|
93
|
-
"baseball1",
|
|
94
|
-
"baseball123",
|
|
95
|
-
"basketball",
|
|
96
|
-
"soccer123",
|
|
97
|
-
"hockey123",
|
|
98
|
-
"superman",
|
|
99
|
-
"superman1",
|
|
100
|
-
"superman123",
|
|
101
|
-
"batman123",
|
|
102
|
-
"batman12",
|
|
103
|
-
"spiderman",
|
|
104
|
-
"spiderman1",
|
|
105
|
-
"trustno1",
|
|
106
|
-
"trustno123",
|
|
107
|
-
"trustnoone",
|
|
108
|
-
"whatever",
|
|
109
|
-
"whatever1",
|
|
110
|
-
"whatever123",
|
|
111
|
-
"freedom1",
|
|
112
|
-
"freedom123",
|
|
113
|
-
"starwars",
|
|
114
|
-
"starwars1",
|
|
115
|
-
"starwars123",
|
|
116
|
-
"pokemon1",
|
|
117
|
-
"pokemon123",
|
|
118
|
-
"charlie1",
|
|
119
|
-
"charlie123",
|
|
120
|
-
"michael1",
|
|
121
|
-
"michael123",
|
|
122
|
-
"jessica1",
|
|
123
|
-
"jessica123",
|
|
124
|
-
"jennifer",
|
|
125
|
-
"jennifer1",
|
|
126
|
-
"daniel123",
|
|
127
|
-
"daniel12",
|
|
128
|
-
"thomas123",
|
|
129
|
-
"hunter123",
|
|
130
|
-
"hunter12",
|
|
131
|
-
"hunter2hunter2",
|
|
132
|
-
"hello123",
|
|
133
|
-
"hello1234",
|
|
134
|
-
"hello12345",
|
|
135
|
-
"helloworld",
|
|
136
|
-
"helloworld1",
|
|
137
|
-
"hello@123",
|
|
138
|
-
"admin123",
|
|
139
|
-
"admin1234",
|
|
140
|
-
"admin12345",
|
|
141
|
-
"admin@123",
|
|
142
|
-
"admin@1234",
|
|
143
|
-
"administrator",
|
|
144
|
-
"administrator1",
|
|
145
|
-
"adminadmin",
|
|
146
|
-
"adminadmin1",
|
|
147
|
-
"admin2020",
|
|
148
|
-
"admin2021",
|
|
149
|
-
"admin2022",
|
|
150
|
-
"admin2023",
|
|
151
|
-
"admin2024",
|
|
152
|
-
"admin2025",
|
|
153
|
-
"admin2026",
|
|
154
|
-
"root1234",
|
|
155
|
-
"root12345",
|
|
156
|
-
"toor1234",
|
|
157
|
-
"test1234",
|
|
158
|
-
"test12345",
|
|
159
|
-
"test123456",
|
|
160
|
-
"testtest",
|
|
161
|
-
"testing123",
|
|
162
|
-
"testing1",
|
|
163
|
-
"guest123",
|
|
164
|
-
"guest1234",
|
|
165
|
-
"changeme",
|
|
166
|
-
"changeme1",
|
|
167
|
-
"changeme123",
|
|
168
|
-
"change123",
|
|
169
|
-
"default1",
|
|
170
|
-
"default123",
|
|
171
|
-
"secret123",
|
|
172
|
-
"secret1234",
|
|
173
|
-
"secretpassword",
|
|
174
|
-
"mypassword",
|
|
175
|
-
"mypassword1",
|
|
176
|
-
"mypassword123",
|
|
177
|
-
"mypass123",
|
|
178
|
-
"mysecret1",
|
|
179
|
-
"login123",
|
|
180
|
-
"login1234",
|
|
181
|
-
"access123",
|
|
182
|
-
"access14",
|
|
183
|
-
"qazwsxedc",
|
|
184
|
-
"qazwsx123",
|
|
185
|
-
"qazxswedc",
|
|
186
|
-
"qweasdzxc",
|
|
187
|
-
"qweasd123",
|
|
188
|
-
"qweqweqwe",
|
|
189
|
-
"asdasdasd",
|
|
190
|
-
"asdasd123",
|
|
191
|
-
"zaq12wsx",
|
|
192
|
-
"zaq1zaq1",
|
|
193
|
-
"zaq1xsw2",
|
|
194
|
-
"aaaaaaaa",
|
|
195
|
-
"aaaaaaa1",
|
|
196
|
-
"11111111",
|
|
197
|
-
"111111111",
|
|
198
|
-
"1111111111",
|
|
199
|
-
"00000000",
|
|
200
|
-
"000000000",
|
|
201
|
-
"0000000000",
|
|
202
|
-
"12341234",
|
|
203
|
-
"12121212",
|
|
204
|
-
"11223344",
|
|
205
|
-
"1122334455",
|
|
206
|
-
"123321123",
|
|
207
|
-
"12344321",
|
|
208
|
-
"123456789a",
|
|
209
|
-
"123456abc",
|
|
210
|
-
"1234567a",
|
|
211
|
-
"1234abcd",
|
|
212
|
-
"987654321",
|
|
213
|
-
"9876543210",
|
|
214
|
-
"98765432",
|
|
215
|
-
"88888888",
|
|
216
|
-
"66666666",
|
|
217
|
-
"55555555",
|
|
218
|
-
"77777777",
|
|
219
|
-
"99999999",
|
|
220
|
-
"22222222",
|
|
221
|
-
"33333333",
|
|
222
|
-
"44444444",
|
|
223
|
-
"pass1234",
|
|
224
|
-
"pass12345",
|
|
225
|
-
"pass123456",
|
|
226
|
-
"passpass",
|
|
227
|
-
"passpass1",
|
|
228
|
-
"pass@123",
|
|
229
|
-
"pass@1234",
|
|
230
|
-
"mustang1",
|
|
231
|
-
"mustang123",
|
|
232
|
-
"ranger123",
|
|
233
|
-
"harley123",
|
|
234
|
-
"ferrari1",
|
|
235
|
-
"porsche1",
|
|
236
|
-
"computer",
|
|
237
|
-
"computer1",
|
|
238
|
-
"computer123",
|
|
239
|
-
"internet",
|
|
240
|
-
"internet1",
|
|
241
|
-
"internet123",
|
|
242
|
-
"windows1",
|
|
243
|
-
"windows123",
|
|
244
|
-
"microsoft",
|
|
245
|
-
"linux123",
|
|
246
|
-
"ubuntu123",
|
|
247
|
-
"google123",
|
|
248
|
-
"google12",
|
|
249
|
-
"facebook",
|
|
250
|
-
"facebook1",
|
|
251
|
-
"facebook123",
|
|
252
|
-
"twitter1",
|
|
253
|
-
"youtube1",
|
|
254
|
-
"instagram",
|
|
255
|
-
"samsung1",
|
|
256
|
-
"samsung123",
|
|
257
|
-
"iphone123",
|
|
258
|
-
"android1",
|
|
259
|
-
"android123",
|
|
260
|
-
"liverpool",
|
|
261
|
-
"liverpool1",
|
|
262
|
-
"manchester",
|
|
263
|
-
"chelsea1",
|
|
264
|
-
"arsenal1",
|
|
265
|
-
"barcelona",
|
|
266
|
-
"realmadrid1",
|
|
267
|
-
"cheese123",
|
|
268
|
-
"chocolate",
|
|
269
|
-
"chocolate1",
|
|
270
|
-
"cookie123",
|
|
271
|
-
"banana123",
|
|
272
|
-
"butterfly",
|
|
273
|
-
"butterfly1",
|
|
274
|
-
"flower123",
|
|
275
|
-
"rainbow1",
|
|
276
|
-
"rainbow123",
|
|
277
|
-
"summer123",
|
|
278
|
-
"summer2024",
|
|
279
|
-
"summer2025",
|
|
280
|
-
"winter123",
|
|
281
|
-
"winter2024",
|
|
282
|
-
"winter2025",
|
|
283
|
-
"spring123",
|
|
284
|
-
"autumn123",
|
|
285
|
-
"january1",
|
|
286
|
-
"february1",
|
|
287
|
-
"december1",
|
|
288
|
-
"qwerty@123",
|
|
289
|
-
"abc@12345",
|
|
290
|
-
"p@55w0rd",
|
|
291
|
-
"p@$$w0rd",
|
|
292
|
-
"passw0rd1",
|
|
293
|
-
"passw0rd!",
|
|
294
|
-
"warlock123",
|
|
295
|
-
"warlock1",
|
|
296
|
-
"devtools",
|
|
297
|
-
"devtools1",
|
|
298
|
-
"devtools123",
|
|
299
|
-
"monitor123",
|
|
300
|
-
"monitor1",
|
|
301
|
-
"dashboard",
|
|
302
|
-
"dashboard1",
|
|
303
|
-
"dashboard123"
|
|
304
|
-
]);
|
|
305
|
-
|
|
306
|
-
//#endregion
|
|
307
|
-
//#region ../../packages/devtools/src/production/auth/helpers.ts
|
|
308
|
-
const MIN_PASSWORD_LENGTH = 8;
|
|
309
|
-
const MAX_PASSWORD_BYTES = 72;
|
|
310
|
-
/** The alphabet of recovery codes and references: no 0, 1, 8, 9, I, L, O. */
|
|
311
|
-
const CODE_ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789";
|
|
312
|
-
/** Letters and digits that cannot be mistaken for each other. */
|
|
313
|
-
const TEMPORARY_ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
|
|
314
|
-
/**
|
|
315
|
-
* The password rules: at least 8 characters, at most 72 bytes (UTF-8), not in
|
|
316
|
-
* the built-in common list (compared lower-cased), not equal to the email
|
|
317
|
-
* (lower-cased). Returns the failing rule's error code, or `null`.
|
|
318
|
-
*/
|
|
319
|
-
function checkPasswordPolicy(password, email) {
|
|
320
|
-
if (typeof password !== "string" || [...password].length < MIN_PASSWORD_LENGTH) return "auth.password-too-short";
|
|
321
|
-
if (Buffer.byteLength(password, "utf8") > MAX_PASSWORD_BYTES) return "auth.password-too-long";
|
|
322
|
-
const lower = password.toLowerCase();
|
|
323
|
-
if (COMMON_PASSWORDS.has(lower)) return "auth.password-common";
|
|
324
|
-
if (email !== null && lower === email.trim().toLowerCase()) return "auth.password-same-as-email";
|
|
325
|
-
return null;
|
|
326
|
-
}
|
|
327
|
-
/** 32 random bytes, base64url (43 characters): session, CSRF and invite tokens. */
|
|
328
|
-
function generateToken() {
|
|
329
|
-
return (0, node_crypto.randomBytes)(32).toString("base64url");
|
|
330
|
-
}
|
|
331
|
-
/** SHA-256 hex of a token: what the store keeps. */
|
|
332
|
-
function hashToken(token) {
|
|
333
|
-
return (0, node_crypto.createHash)("sha256").update(token).digest("hex");
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* A random temporary password for `warlock devtools:reset-admin`: 20
|
|
337
|
-
* characters from an unambiguous alphabet, passes `checkPasswordPolicy`.
|
|
338
|
-
*/
|
|
339
|
-
function generateTemporaryPassword() {
|
|
340
|
-
for (;;) {
|
|
341
|
-
let password = "";
|
|
342
|
-
for (let index = 0; index < 20; index++) password += TEMPORARY_ALPHABET[(0, node_crypto.randomInt)(54)];
|
|
343
|
-
if (checkPasswordPolicy(password, null) === null) return password;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
/** Compares two strings in constant time (both are hashed first, so lengths do not leak). */
|
|
347
|
-
function safeEqual(a, b) {
|
|
348
|
-
const left = (0, node_crypto.createHash)("sha256").update(String(a)).digest();
|
|
349
|
-
const right = (0, node_crypto.createHash)("sha256").update(String(b)).digest();
|
|
350
|
-
return (0, node_crypto.timingSafeEqual)(left, right);
|
|
351
|
-
}
|
|
352
|
-
/** Emails are compared trimmed and lower-cased. */
|
|
353
|
-
function normalizeEmail(email) {
|
|
354
|
-
return typeof email === "string" ? email.trim().toLowerCase() : "";
|
|
355
|
-
}
|
|
356
|
-
/** A deliberately plain shape check; the invite flow is the real proof of ownership. */
|
|
357
|
-
function isPlausibleEmail(email) {
|
|
358
|
-
return email.length <= 254 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
359
|
-
}
|
|
360
|
-
/** One recovery code, `xxxxx-xxxxx` from the unambiguous alphabet. */
|
|
361
|
-
function generateRecoveryCode() {
|
|
362
|
-
let code = "";
|
|
363
|
-
for (let index = 0; index < 10; index++) {
|
|
364
|
-
if (index === 5) code += "-";
|
|
365
|
-
code += CODE_ALPHABET[(0, node_crypto.randomInt)(31)];
|
|
366
|
-
}
|
|
367
|
-
return code;
|
|
368
|
-
}
|
|
369
|
-
/** The form a recovery code is hashed in: upper case, letters and digits only. */
|
|
370
|
-
function normalizeRecoveryCode(code) {
|
|
371
|
-
return String(code).toUpperCase().replace(/[^A-Z0-9]/g, "");
|
|
372
|
-
}
|
|
373
|
-
/** SHA-256 hex of a normalized recovery code. */
|
|
374
|
-
function hashRecoveryCode(code) {
|
|
375
|
-
return hashToken(normalizeRecoveryCode(code));
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
//#endregion
|
|
379
7
|
//#region ../../packages/devtools/src/production/auth/service.ts
|
|
380
8
|
const MINUTE = 6e4;
|
|
381
9
|
const HOUR = 60 * MINUTE;
|
|
@@ -440,7 +68,8 @@ function createDevtoolsAuth(deps) {
|
|
|
440
68
|
const hashPassword = (password) => withSlot(() => crypto.hashPassword(password));
|
|
441
69
|
const passwordInput = (value) => typeof value === "string" ? value.slice(0, MAX_PASSWORD_INPUT) : "";
|
|
442
70
|
function requirePolicy(password, email) {
|
|
443
|
-
const problem = checkPasswordPolicy(password, email);
|
|
71
|
+
const problem = require_helpers.checkPasswordPolicy(password, email, options.passwords);
|
|
72
|
+
if (problem === "auth.password-too-short") throw new require_errors.DevtoolsApiError(problem, { message: `Use a password of at least ${options.passwords.minLength} characters.` });
|
|
444
73
|
if (problem !== null) fail(problem);
|
|
445
74
|
}
|
|
446
75
|
const csrfToken = (session) => Buffer.from(crypto.hmac(`devtools-csrf:${session.id}:${session.csrfSecret}`)).toString("base64url");
|
|
@@ -475,7 +104,7 @@ function createDevtoolsAuth(deps) {
|
|
|
475
104
|
usedAt: invite.usedAt
|
|
476
105
|
};
|
|
477
106
|
}
|
|
478
|
-
const twoFactorRequired = (account) => options.twoFactor === "everyone" || account.role === "admin";
|
|
107
|
+
const twoFactorRequired = (account) => options.twoFactor === "everyone" || options.twoFactor === "admins" && account.role === "admin";
|
|
479
108
|
/** Where an account goes after its password is accepted. */
|
|
480
109
|
function nextStage(account) {
|
|
481
110
|
if (account.mustChangePassword) return "password-change";
|
|
@@ -568,7 +197,7 @@ function createDevtoolsAuth(deps) {
|
|
|
568
197
|
const cached = blockedIps.get(client);
|
|
569
198
|
if (cached && now() < cached.until && cached.checkedAt >= stateResetAt) return true;
|
|
570
199
|
if (await store.audit.count({
|
|
571
|
-
types:
|
|
200
|
+
types: require_app_versions.DEVTOOLS_FAILURE_AUDIT_TYPES,
|
|
572
201
|
since,
|
|
573
202
|
ip
|
|
574
203
|
}) < limits.ip) {
|
|
@@ -603,7 +232,7 @@ function createDevtoolsAuth(deps) {
|
|
|
603
232
|
const locked = state.lockedUntil !== null && state.lockedUntil > at;
|
|
604
233
|
const overIp = await ipOverLimit(ip, since, stateResetAt);
|
|
605
234
|
const accountCount = await store.audit.count({
|
|
606
|
-
types:
|
|
235
|
+
types: require_app_versions.DEVTOOLS_FAILURE_AUDIT_TYPES,
|
|
607
236
|
since: accountSince,
|
|
608
237
|
accountId: account?.id ?? "-"
|
|
609
238
|
});
|
|
@@ -618,7 +247,7 @@ function createDevtoolsAuth(deps) {
|
|
|
618
247
|
if (state.lockedUntil !== null && state.lockedUntil > at) return;
|
|
619
248
|
const since = Math.max(at - windowMs, state.failuresResetAt ?? 0);
|
|
620
249
|
const count = await store.audit.count({
|
|
621
|
-
types:
|
|
250
|
+
types: require_app_versions.DEVTOOLS_FAILURE_AUDIT_TYPES,
|
|
622
251
|
since
|
|
623
252
|
});
|
|
624
253
|
if (count < limits.global) return;
|
|
@@ -658,11 +287,11 @@ function createDevtoolsAuth(deps) {
|
|
|
658
287
|
}));
|
|
659
288
|
}
|
|
660
289
|
async function createSession(account, stage, meta) {
|
|
661
|
-
const token = generateToken();
|
|
290
|
+
const token = require_helpers.generateToken();
|
|
662
291
|
const at = now();
|
|
663
292
|
const lifetime = stage === "active" ? options.session.maxHours * HOUR : options.session.pendingMinutes * MINUTE;
|
|
664
293
|
const session = await store.sessions.create({
|
|
665
|
-
tokenHash: hashToken(token),
|
|
294
|
+
tokenHash: require_helpers.hashToken(token),
|
|
666
295
|
accountId: account.id,
|
|
667
296
|
stage,
|
|
668
297
|
csrfSecret: (0, node_crypto.randomBytes)(32).toString("base64url"),
|
|
@@ -714,10 +343,10 @@ function createDevtoolsAuth(deps) {
|
|
|
714
343
|
if (auth.stage !== "active" || auth.account.role !== "admin") fail("role.forbidden");
|
|
715
344
|
}
|
|
716
345
|
function newRecoveryCodes() {
|
|
717
|
-
const codes = Array.from({ length: RECOVERY_CODE_COUNT }, () => generateRecoveryCode());
|
|
346
|
+
const codes = Array.from({ length: RECOVERY_CODE_COUNT }, () => require_helpers.generateRecoveryCode());
|
|
718
347
|
return {
|
|
719
348
|
codes,
|
|
720
|
-
hashes: codes.map(hashRecoveryCode)
|
|
349
|
+
hashes: codes.map(require_helpers.hashRecoveryCode)
|
|
721
350
|
};
|
|
722
351
|
}
|
|
723
352
|
/** The step a TOTP code matches for this account, or `null` (also `null` when the step was already used). */
|
|
@@ -737,12 +366,12 @@ function createDevtoolsAuth(deps) {
|
|
|
737
366
|
}
|
|
738
367
|
async function ensureFirstAdmin() {
|
|
739
368
|
const admin = options.admin;
|
|
740
|
-
const email = normalizeEmail(admin.email);
|
|
369
|
+
const email = require_helpers.normalizeEmail(admin.email);
|
|
741
370
|
const existing = email ? await store.accounts.findByEmail(email) : null;
|
|
742
371
|
if (existing && existing.role === "admin") {
|
|
743
372
|
if (existing.passwordSource === "env" && admin.password !== null) {
|
|
744
373
|
if (!await withSlot(() => verifyPassword(admin.password, existing.passwordHash))) {
|
|
745
|
-
if (checkPasswordPolicy(admin.password, email) !== null) throw new require_errors.DevtoolsProductionConfigError("DT004");
|
|
374
|
+
if (require_helpers.checkPasswordPolicy(admin.password, email, options.passwords) !== null) throw new require_errors.DevtoolsProductionConfigError("DT004");
|
|
746
375
|
const hash = await hashPassword(admin.password);
|
|
747
376
|
const updated = await casAccount(existing, (fresh) => fresh.passwordSource === "env" ? {
|
|
748
377
|
passwordHash: hash,
|
|
@@ -764,7 +393,7 @@ function createDevtoolsAuth(deps) {
|
|
|
764
393
|
if (existing || !email || admin.password === null && admin.setupToken === null) throw new require_errors.DevtoolsProductionConfigError("DT003");
|
|
765
394
|
let record;
|
|
766
395
|
if (admin.password !== null) {
|
|
767
|
-
if (checkPasswordPolicy(admin.password, email) !== null) throw new require_errors.DevtoolsProductionConfigError("DT004");
|
|
396
|
+
if (require_helpers.checkPasswordPolicy(admin.password, email, options.passwords) !== null) throw new require_errors.DevtoolsProductionConfigError("DT004");
|
|
768
397
|
record = {
|
|
769
398
|
email,
|
|
770
399
|
role: "admin",
|
|
@@ -806,7 +435,7 @@ function createDevtoolsAuth(deps) {
|
|
|
806
435
|
}
|
|
807
436
|
}
|
|
808
437
|
async function login(input, meta) {
|
|
809
|
-
const email = normalizeEmail(input?.email);
|
|
438
|
+
const email = require_helpers.normalizeEmail(input?.email);
|
|
810
439
|
const password = passwordInput(input?.password);
|
|
811
440
|
const account = email ? await store.accounts.findByEmail(email) : null;
|
|
812
441
|
const blockedReason = await blockedBy(account, meta.ip);
|
|
@@ -842,10 +471,10 @@ function createDevtoolsAuth(deps) {
|
|
|
842
471
|
}
|
|
843
472
|
async function setup(input, meta) {
|
|
844
473
|
const configured = options.admin.setupToken;
|
|
845
|
-
const adminEmail = normalizeEmail(options.admin.email);
|
|
474
|
+
const adminEmail = require_helpers.normalizeEmail(options.admin.email);
|
|
846
475
|
const account = adminEmail ? await store.accounts.findByEmail(adminEmail) : null;
|
|
847
476
|
const blocked = await isBlocked(null, meta.ip);
|
|
848
|
-
const tokenMatches = safeEqual(hashToken(typeof input?.token === "string" ? input.token : ""), hashToken(configured ?? ""));
|
|
477
|
+
const tokenMatches = require_helpers.safeEqual(require_helpers.hashToken(typeof input?.token === "string" ? input.token : ""), require_helpers.hashToken(configured ?? ""));
|
|
849
478
|
const usable = configured !== null && tokenMatches && account !== null && account.passwordSource === "setup";
|
|
850
479
|
if (blocked) return failLogin("login.blocked", "auth.invalid-setup-token", {
|
|
851
480
|
email: adminEmail || null,
|
|
@@ -878,7 +507,7 @@ function createDevtoolsAuth(deps) {
|
|
|
878
507
|
}
|
|
879
508
|
async function findOpenInvite(token) {
|
|
880
509
|
if (typeof token !== "string" || token === "" || token.length > 200) fail("invite.invalid");
|
|
881
|
-
const invite = await store.invites.findByTokenHash(hashToken(token));
|
|
510
|
+
const invite = await store.invites.findByTokenHash(require_helpers.hashToken(token));
|
|
882
511
|
if (!invite || invite.usedAt !== null || invite.expiresAt <= now()) fail("invite.invalid");
|
|
883
512
|
return invite;
|
|
884
513
|
}
|
|
@@ -926,7 +555,7 @@ function createDevtoolsAuth(deps) {
|
|
|
926
555
|
}
|
|
927
556
|
async function authenticate(token) {
|
|
928
557
|
if (typeof token !== "string" || token === "" || token.length > 200) return null;
|
|
929
|
-
const session = await store.sessions.findByTokenHash(hashToken(token));
|
|
558
|
+
const session = await store.sessions.findByTokenHash(require_helpers.hashToken(token));
|
|
930
559
|
if (!session) return null;
|
|
931
560
|
const at = now();
|
|
932
561
|
if (at >= session.expiresAt || at - session.lastSeenAt > options.session.idleMinutes * MINUTE) {
|
|
@@ -951,7 +580,7 @@ function createDevtoolsAuth(deps) {
|
|
|
951
580
|
}
|
|
952
581
|
function verifyCsrf(auth, header) {
|
|
953
582
|
if (typeof header !== "string" || header === "") return false;
|
|
954
|
-
return safeEqual(header, csrfToken(auth.session));
|
|
583
|
+
return require_helpers.safeEqual(header, csrfToken(auth.session));
|
|
955
584
|
}
|
|
956
585
|
function sessionView(auth) {
|
|
957
586
|
if (!auth) return {
|
|
@@ -962,7 +591,10 @@ function createDevtoolsAuth(deps) {
|
|
|
962
591
|
csrf: null,
|
|
963
592
|
expiresAt: null,
|
|
964
593
|
instance: null,
|
|
965
|
-
methods: null
|
|
594
|
+
methods: null,
|
|
595
|
+
share: null,
|
|
596
|
+
warlockVersion: null,
|
|
597
|
+
app: null
|
|
966
598
|
};
|
|
967
599
|
return {
|
|
968
600
|
mode: "production",
|
|
@@ -975,6 +607,11 @@ function createDevtoolsAuth(deps) {
|
|
|
975
607
|
methods: {
|
|
976
608
|
totp: true,
|
|
977
609
|
passkeys: passkeys !== null
|
|
610
|
+
},
|
|
611
|
+
share: { enabled: options.share.enabled },
|
|
612
|
+
...auth.stage === "active" ? require_app_versions.readVersions() : {
|
|
613
|
+
warlockVersion: null,
|
|
614
|
+
app: null
|
|
978
615
|
}
|
|
979
616
|
};
|
|
980
617
|
}
|
|
@@ -1179,12 +816,12 @@ function createDevtoolsAuth(deps) {
|
|
|
1179
816
|
});
|
|
1180
817
|
return moveTo(auth, consumed, "active", meta);
|
|
1181
818
|
}
|
|
1182
|
-
const given = hashRecoveryCode(input.recoveryCode);
|
|
819
|
+
const given = require_helpers.hashRecoveryCode(input.recoveryCode);
|
|
1183
820
|
let left = 0;
|
|
1184
821
|
const used = await casAccount(auth.account, (account) => {
|
|
1185
822
|
let found = -1;
|
|
1186
823
|
account.recoveryCodes.forEach((stored, index) => {
|
|
1187
|
-
if (safeEqual(stored, given) && normalizeRecoveryCode(input.recoveryCode).length === 10) found = index;
|
|
824
|
+
if (require_helpers.safeEqual(stored, given) && require_helpers.normalizeRecoveryCode(input.recoveryCode).length === 10) found = index;
|
|
1188
825
|
});
|
|
1189
826
|
if (found === -1) return null;
|
|
1190
827
|
const remaining = account.recoveryCodes.filter((_, index) => index !== found);
|
|
@@ -1373,13 +1010,13 @@ function createDevtoolsAuth(deps) {
|
|
|
1373
1010
|
}
|
|
1374
1011
|
async function createInvite(auth, input, meta) {
|
|
1375
1012
|
requireAdmin(auth);
|
|
1376
|
-
const email = normalizeEmail(input?.email);
|
|
1377
|
-
if (!isPlausibleEmail(email) || input.role !== "admin" && input.role !== "viewer") fail("input.invalid");
|
|
1013
|
+
const email = require_helpers.normalizeEmail(input?.email);
|
|
1014
|
+
if (!require_helpers.isPlausibleEmail(email) || input.role !== "admin" && input.role !== "viewer") fail("input.invalid");
|
|
1378
1015
|
if (await store.accounts.findByEmail(email)) fail("invite.email-taken");
|
|
1379
|
-
const token = generateToken();
|
|
1016
|
+
const token = require_helpers.generateToken();
|
|
1380
1017
|
const at = now();
|
|
1381
1018
|
const invite = await store.invites.create({
|
|
1382
|
-
tokenHash: hashToken(token),
|
|
1019
|
+
tokenHash: require_helpers.hashToken(token),
|
|
1383
1020
|
email,
|
|
1384
1021
|
role: input.role,
|
|
1385
1022
|
createdBy: auth.account.id,
|
|
@@ -1485,7 +1122,7 @@ function createDevtoolsAuth(deps) {
|
|
|
1485
1122
|
const state = await store.state.read();
|
|
1486
1123
|
if (await store.state.update(state.version, {
|
|
1487
1124
|
disabled: true,
|
|
1488
|
-
disabledPathHash: hashToken(options.path),
|
|
1125
|
+
disabledPathHash: require_helpers.hashToken(options.path),
|
|
1489
1126
|
disabledAt: now(),
|
|
1490
1127
|
disabledBy: auth.account.id
|
|
1491
1128
|
})) {
|
|
@@ -1645,11 +1282,11 @@ async function loadDevtoolsPasskeys() {
|
|
|
1645
1282
|
}
|
|
1646
1283
|
|
|
1647
1284
|
//#endregion
|
|
1648
|
-
exports.checkPasswordPolicy = checkPasswordPolicy;
|
|
1285
|
+
exports.checkPasswordPolicy = require_helpers.checkPasswordPolicy;
|
|
1649
1286
|
exports.createDevtoolsAuth = createDevtoolsAuth;
|
|
1650
1287
|
exports.defaultDevtoolsCrypto = defaultDevtoolsCrypto;
|
|
1651
|
-
exports.generateTemporaryPassword = generateTemporaryPassword;
|
|
1652
|
-
exports.generateToken = generateToken;
|
|
1653
|
-
exports.hashToken = hashToken;
|
|
1288
|
+
exports.generateTemporaryPassword = require_helpers.generateTemporaryPassword;
|
|
1289
|
+
exports.generateToken = require_helpers.generateToken;
|
|
1290
|
+
exports.hashToken = require_helpers.hashToken;
|
|
1654
1291
|
exports.loadDevtoolsPasskeys = loadDevtoolsPasskeys;
|
|
1655
|
-
//# sourceMappingURL=auth-
|
|
1292
|
+
//# sourceMappingURL=auth-B3wyjJnQ.cjs.map
|