@prosopo/provider 5.13.3 → 5.14.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/.turbo/turbo-build$colon$cjs.log +13 -11
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +14 -12
- package/CHANGELOG.md +124 -0
- package/dist/api/adminAuthOptions.d.ts +4 -0
- package/dist/api/adminAuthOptions.d.ts.map +1 -0
- package/dist/api/adminAuthOptions.js +34 -0
- package/dist/api/adminAuthOptions.js.map +1 -0
- package/dist/api/detectorPoolBodyParser.d.ts +4 -0
- package/dist/api/detectorPoolBodyParser.d.ts.map +1 -0
- package/dist/api/detectorPoolBodyParser.js +31 -0
- package/dist/api/detectorPoolBodyParser.js.map +1 -0
- package/dist/api/domainMiddleware.d.ts.map +1 -1
- package/dist/api/domainMiddleware.js +5 -1
- package/dist/api/domainMiddleware.js.map +1 -1
- package/dist/api/metrics.d.ts +2 -1
- package/dist/api/metrics.d.ts.map +1 -1
- package/dist/api/metrics.js +46 -4
- package/dist/api/metrics.js.map +1 -1
- package/dist/api/startProviderApi.d.ts.map +1 -1
- package/dist/api/startProviderApi.js +6 -3
- package/dist/api/startProviderApi.js.map +1 -1
- package/dist/api/verify.d.ts.map +1 -1
- package/dist/api/verify.js +50 -8
- package/dist/api/verify.js.map +1 -1
- package/dist/cjs/api/adminAuthOptions.cjs +35 -0
- package/dist/cjs/api/detectorPoolBodyParser.cjs +33 -0
- package/dist/cjs/api/domainMiddleware.cjs +5 -1
- package/dist/cjs/api/metrics.cjs +46 -3
- package/dist/cjs/api/startProviderApi.cjs +6 -3
- package/dist/cjs/api/verify.cjs +50 -8
- package/dist/cjs/tasks/client/clientTasks.cjs +25 -4
- package/dist/cjs/tasks/dataset/datasetTasksUtils.cjs +1 -1
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +2 -2
- package/dist/cjs/utils/tarpitPadding.cjs +81 -9
- package/dist/tasks/client/clientTasks.d.ts +1 -0
- package/dist/tasks/client/clientTasks.d.ts.map +1 -1
- package/dist/tasks/client/clientTasks.js +25 -5
- package/dist/tasks/client/clientTasks.js.map +1 -1
- package/dist/tasks/dataset/datasetTasksUtils.js +1 -1
- package/dist/tasks/dataset/datasetTasksUtils.js.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +2 -2
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js.map +1 -1
- package/dist/tests/unit/api/adminAuthOptions.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/adminAuthOptions.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/adminAuthOptions.unit.test.js +38 -0
- package/dist/tests/unit/api/adminAuthOptions.unit.test.js.map +1 -0
- package/dist/tests/unit/api/captcha/trafficFilterRequestTime.unit.test.js +24 -0
- package/dist/tests/unit/api/captcha/trafficFilterRequestTime.unit.test.js.map +1 -1
- package/dist/tests/unit/api/detectorPoolBodyParser.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/detectorPoolBodyParser.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/detectorPoolBodyParser.unit.test.js +64 -0
- package/dist/tests/unit/api/detectorPoolBodyParser.unit.test.js.map +1 -0
- package/dist/tests/unit/api/domainMiddlewareErrorBody.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/domainMiddlewareErrorBody.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/domainMiddlewareErrorBody.unit.test.js +67 -0
- package/dist/tests/unit/api/domainMiddlewareErrorBody.unit.test.js.map +1 -0
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js +76 -1
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js.map +1 -1
- package/dist/tests/unit/api/metricsAccess.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/metricsAccess.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/metricsAccess.unit.test.js +87 -0
- package/dist/tests/unit/api/metricsAccess.unit.test.js.map +1 -0
- package/dist/tests/unit/api/public.unit.test.js +4 -1
- package/dist/tests/unit/api/public.unit.test.js.map +1 -1
- package/dist/tests/unit/api/validateAddress.unit.test.js +1 -1
- package/dist/tests/unit/api/validateAddress.unit.test.js.map +1 -1
- package/dist/tests/unit/api/verifyBadDappSignature.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/verifyBadDappSignature.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/verifyBadDappSignature.unit.test.js +96 -0
- package/dist/tests/unit/api/verifyBadDappSignature.unit.test.js.map +1 -0
- package/dist/tests/unit/api/verifyMalformedToken.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/verifyMalformedToken.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/verifyMalformedToken.unit.test.js +89 -0
- package/dist/tests/unit/api/verifyMalformedToken.unit.test.js.map +1 -0
- package/dist/tests/unit/tasks/client/clientTasks.unit.test.js +33 -1
- package/dist/tests/unit/tasks/client/clientTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/dataset/datasetTasksUtils.unit.test.js +14 -1
- package/dist/tests/unit/tasks/dataset/datasetTasksUtils.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js +41 -1
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js.map +1 -1
- package/dist/tests/unit/utils/tarpitPadding.unit.test.d.ts +2 -0
- package/dist/tests/unit/utils/tarpitPadding.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/utils/tarpitPadding.unit.test.js +181 -0
- package/dist/tests/unit/utils/tarpitPadding.unit.test.js.map +1 -0
- package/dist/utils/tarpitPadding.d.ts.map +1 -1
- package/dist/utils/tarpitPadding.js +81 -9
- package/dist/utils/tarpitPadding.js.map +1 -1
- package/package.json +20 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/provider@5.
|
|
2
|
+
> @prosopo/provider@5.14.0 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -59,7 +59,7 @@ ViteCommonJSConfig: .
|
|
|
59
59
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
60
60
|
Bundle build started
|
|
61
61
|
[2K
|
|
62
|
-
✓
|
|
62
|
+
✓ 120 modules transformed.
|
|
63
63
|
rendering chunks...
|
|
64
64
|
computing gzip size...
|
|
65
65
|
dist/cjs/tasks/index.cjs 0.08 kB │ gzip: 0.07 kB
|
|
@@ -79,7 +79,6 @@ dist/cjs/api/validateAddress.cjs 0
|
|
|
79
79
|
dist/cjs/api/ja4.cjs 0.85 kB │ gzip: 0.47 kB
|
|
80
80
|
dist/cjs/api/dnsEventUrl.cjs 0.85 kB │ gzip: 0.46 kB
|
|
81
81
|
dist/cjs/tasks/dataset/datasetTasks.cjs 0.92 kB │ gzip: 0.41 kB
|
|
82
|
-
dist/cjs/utils/tarpitPadding.cjs 0.98 kB │ gzip: 0.54 kB
|
|
83
82
|
dist/cjs/api/captcha/assetSeal.cjs 0.99 kB │ gzip: 0.51 kB
|
|
84
83
|
dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
|
|
85
84
|
dist/cjs/api/headerCheckMiddleware.cjs 1.02 kB │ gzip: 0.45 kB
|
|
@@ -94,13 +93,14 @@ dist/cjs/api/admin/apiRemoveSiteKeysEndpoint.cjs 1
|
|
|
94
93
|
dist/cjs/tasks/puzzle/nativeBackground.cjs 1.16 kB │ gzip: 0.62 kB
|
|
95
94
|
dist/cjs/api/admin/apiRemoveSiteKeyEndpoint.cjs 1.17 kB │ gzip: 0.50 kB
|
|
96
95
|
dist/cjs/schedulers/captchaScheduler.cjs 1.21 kB │ gzip: 0.50 kB
|
|
96
|
+
dist/cjs/api/detectorPoolBodyParser.cjs 1.22 kB │ gzip: 0.63 kB
|
|
97
97
|
dist/cjs/api/block.cjs 1.28 kB │ gzip: 0.48 kB
|
|
98
98
|
dist/cjs/schedulers/getClientList.cjs 1.28 kB │ gzip: 0.55 kB
|
|
99
99
|
dist/cjs/api/admin/apiGetDecisionMachineEndpoint.cjs 1.33 kB │ gzip: 0.52 kB
|
|
100
100
|
dist/cjs/api/admin/apiRemoveDecisionMachineEndpoint.cjs 1.36 kB │ gzip: 0.52 kB
|
|
101
101
|
dist/cjs/api/admin/apiRemoveAllDecisionMachinesEndpoint.cjs 1.36 kB │ gzip: 0.54 kB
|
|
102
|
-
dist/cjs/tasks/dataset/datasetTasksUtils.cjs 1.42 kB │ gzip: 0.49 kB
|
|
103
102
|
dist/cjs/tasks/puzzle/backgroundBuffer.cjs 1.44 kB │ gzip: 0.54 kB
|
|
103
|
+
dist/cjs/tasks/dataset/datasetTasksUtils.cjs 1.45 kB │ gzip: 0.49 kB
|
|
104
104
|
dist/cjs/utils/clientMetaData.cjs 1.48 kB │ gzip: 0.72 kB
|
|
105
105
|
dist/cjs/tasks/detection/assignSecret.cjs 1.48 kB │ gzip: 0.75 kB
|
|
106
106
|
dist/cjs/api/assetDocument.cjs 1.50 kB │ gzip: 0.81 kB
|
|
@@ -111,6 +111,7 @@ dist/cjs/api/admin/apiReplaceDetectorPoolEndpoint.cjs 1
|
|
|
111
111
|
dist/cjs/utils/devicePlatform.cjs 1.72 kB │ gzip: 0.91 kB
|
|
112
112
|
dist/cjs/api/admin/apiGetSessionEndpoint.cjs 1.75 kB │ gzip: 0.82 kB
|
|
113
113
|
dist/cjs/api/ja4Middleware.cjs 1.76 kB │ gzip: 0.79 kB
|
|
114
|
+
dist/cjs/api/adminAuthOptions.cjs 1.77 kB │ gzip: 0.82 kB
|
|
114
115
|
dist/cjs/api/admin/apiUpdateDecisionMachineEndpoint.cjs 1.77 kB │ gzip: 0.60 kB
|
|
115
116
|
dist/cjs/tasks/imgCaptcha/imgCaptchaTasksUtils.cjs 1.78 kB │ gzip: 0.78 kB
|
|
116
117
|
dist/cjs/api/admin/apiToggleMaintenanceModeEndpoint.cjs 1.80 kB │ gzip: 0.72 kB
|
|
@@ -142,9 +143,10 @@ dist/cjs/api/captcha/assetSealFormat.cjs 3
|
|
|
142
143
|
dist/cjs/api/captcha/assignDetectorBundle.cjs 3.63 kB │ gzip: 1.37 kB
|
|
143
144
|
dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.cjs 3.66 kB │ gzip: 1.35 kB
|
|
144
145
|
dist/cjs/api/admin/apiAdminRoutesProvider.cjs 3.67 kB │ gzip: 0.62 kB
|
|
146
|
+
dist/cjs/utils/tarpitPadding.cjs 3.71 kB │ gzip: 1.51 kB
|
|
145
147
|
dist/cjs/tasks/tasks.cjs 3.82 kB │ gzip: 1.07 kB
|
|
146
148
|
dist/cjs/api/rawTlsSignalsMiddleware.cjs 3.84 kB │ gzip: 1.16 kB
|
|
147
|
-
dist/cjs/api/domainMiddleware.cjs 3.
|
|
149
|
+
dist/cjs/api/domainMiddleware.cjs 3.95 kB │ gzip: 1.28 kB
|
|
148
150
|
dist/cjs/tasks/spam/evaluateEmailSpamRules.cjs 4.03 kB │ gzip: 1.60 kB
|
|
149
151
|
dist/cjs/services/ipComparison.cjs 4.06 kB │ gzip: 1.22 kB
|
|
150
152
|
dist/cjs/tasks/spam/checkSpamEmail.cjs 4.14 kB │ gzip: 1.14 kB
|
|
@@ -167,21 +169,21 @@ dist/cjs/tasks/spam/checkTrafficFilter.cjs 7
|
|
|
167
169
|
dist/cjs/api/captcha/submitPoWCaptchaSolution.cjs 9.28 kB │ gzip: 2.74 kB
|
|
168
170
|
dist/cjs/tasks/detection/bundlePool.cjs 9.29 kB │ gzip: 3.38 kB
|
|
169
171
|
dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.cjs 10.33 kB │ gzip: 1.82 kB
|
|
170
|
-
dist/cjs/api/startProviderApi.cjs 11.
|
|
171
|
-
dist/cjs/tasks/client/clientTasks.cjs
|
|
172
|
-
dist/cjs/api/metrics.cjs 11.98 kB │ gzip: 3.58 kB
|
|
172
|
+
dist/cjs/api/startProviderApi.cjs 11.96 kB │ gzip: 3.79 kB
|
|
173
|
+
dist/cjs/tasks/client/clientTasks.cjs 12.31 kB │ gzip: 3.23 kB
|
|
173
174
|
dist/cjs/tasks/decisionMachine/decisionMachineRunner.cjs 12.69 kB │ gzip: 3.91 kB
|
|
174
175
|
dist/cjs/util.cjs 13.15 kB │ gzip: 3.26 kB
|
|
175
176
|
dist/cjs/api/blacklistRequestInspector.cjs 13.39 kB │ gzip: 4.50 kB
|
|
176
|
-
dist/cjs/api/
|
|
177
|
+
dist/cjs/api/metrics.cjs 13.94 kB │ gzip: 4.32 kB
|
|
178
|
+
dist/cjs/api/verify.cjs 18.33 kB │ gzip: 3.16 kB
|
|
177
179
|
dist/cjs/tasks/frictionless/frictionlessTasks.cjs 18.43 kB │ gzip: 4.88 kB
|
|
178
180
|
dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs 20.15 kB │ gzip: 4.63 kB
|
|
179
181
|
dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs 24.26 kB │ gzip: 5.18 kB
|
|
180
182
|
dist/cjs/tasks/captchaManager.cjs 25.12 kB │ gzip: 7.48 kB
|
|
181
183
|
dist/cjs/tasks/powCaptcha/powTasks.cjs 25.99 kB │ gzip: 6.23 kB
|
|
182
|
-
dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs 28.
|
|
184
|
+
dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs 28.93 kB │ gzip: 6.55 kB
|
|
183
185
|
|
|
184
|
-
[32m✓ built in
|
|
186
|
+
[32m✓ built in 218ms[39m
|
|
185
187
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodeBehavior.js to /home/runner/work/captcha/captcha/packages/provider/dist/cjs/tasks/detection/decodeBehavior.js
|
|
186
188
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodePayload.js to /home/runner/work/captcha/captcha/packages/provider/dist/cjs/tasks/detection/decodePayload.js
|
|
187
189
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodeSimd.js to /home/runner/work/captcha/captcha/packages/provider/dist/cjs/tasks/detection/decodeSimd.js
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/provider@5.
|
|
2
|
+
> @prosopo/provider@5.14.0 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
12:39:18 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../util/tsconfig.json
|
|
8
8
|
* ../logger/tsconfig.json
|
|
@@ -28,53 +28,53 @@
|
|
|
28
28
|
* ../web-bot-auth/tsconfig.json
|
|
29
29
|
* tsconfig.json
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
12:39:18 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
12:39:18 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
12:39:18 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
12:39:18 PM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/tsconfig.tsbuildinfo'
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
12:39:18 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
12:39:18 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
12:39:18 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
12:39:18 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
12:39:18 PM - Project '../ipinfo/tsconfig.json' is up to date because newest input '../ipinfo/src/index.ts' is older than output '../ipinfo/tsconfig.tsbuildinfo'
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
12:39:18 PM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/tsconfig.tsbuildinfo'
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
12:39:18 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
12:39:18 PM - Project '../user-access-policy/tsconfig.json' is up to date because newest input '../user-access-policy/src/transformRule.ts' is older than output '../user-access-policy/tsconfig.tsbuildinfo'
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
12:39:18 PM - Project '../types-database/tsconfig.json' is up to date because newest input '../types-database/src/index.ts' is older than output '../types-database/tsconfig.tsbuildinfo'
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
12:39:18 PM - Project '../database/tsconfig.json' is up to date because newest input '../database/src/tests/unit/captchaLabel.unit.test.ts' is older than output '../database/tsconfig.tsbuildinfo'
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
12:39:18 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/pair/decode.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
12:39:18 PM - Project '../types-env/tsconfig.json' is up to date because newest input '../types-env/src/index.ts' is older than output '../types-env/tsconfig.tsbuildinfo'
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
12:39:18 PM - Project '../env/tsconfig.json' is up to date because newest input '../env/src/env.ts' is older than output '../env/tsconfig.tsbuildinfo'
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
12:39:18 PM - Project '../api-express-router/tsconfig.json' is up to date because newest input '../api-express-router/src/errorHandler.ts' is older than output '../api-express-router/tsconfig.tsbuildinfo'
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
12:39:18 PM - Project '../captcha-severity/tsconfig.json' is up to date because newest input '../captcha-severity/src/index.test.ts' is older than output '../captcha-severity/tsconfig.tsbuildinfo'
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
12:39:18 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/index.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
12:39:18 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/balancer.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
12:39:18 PM - Project '../puzzle-assets/tsconfig.json' is up to date because newest input '../puzzle-assets/src/background.ts' is older than output '../puzzle-assets/tsconfig.tsbuildinfo'
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
12:39:18 PM - Project '../web-bot-auth/tsconfig.json' is up to date because newest input '../web-bot-auth/src/base64.ts' is older than output '../web-bot-auth/tsconfig.tsbuildinfo'
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
12:39:18 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
12:39:18 PM - Building project '/home/runner/work/captcha/captcha/packages/provider/tsconfig.json'...
|
|
80
80
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/provider@5.
|
|
2
|
+
> @prosopo/provider@5.14.0 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/provider@5.
|
|
6
|
+
> @prosopo/provider@5.14.0 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -63,7 +63,7 @@ ViteEsmConfig: .
|
|
|
63
63
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
64
64
|
Bundle build started
|
|
65
65
|
[2K
|
|
66
|
-
✓
|
|
66
|
+
✓ 120 modules transformed.
|
|
67
67
|
rendering chunks...
|
|
68
68
|
computing gzip size...
|
|
69
69
|
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
@@ -87,12 +87,12 @@ dist/tasks/dataset/datasetTasks.js 0.85 k
|
|
|
87
87
|
dist/tasks/powCaptcha/powTasksUtils.js 0.89 kB │ gzip: 0.46 kB
|
|
88
88
|
dist/api/captcha/assetSeal.js 0.91 kB │ gzip: 0.50 kB
|
|
89
89
|
dist/api/headerCheckMiddleware.js 0.91 kB │ gzip: 0.43 kB
|
|
90
|
-
dist/utils/tarpitPadding.js 0.95 kB │ gzip: 0.53 kB
|
|
91
90
|
dist/api/captcha/getFrictionlessCaptchaChallenge/honeypotResponse.js 0.95 kB │ gzip: 0.51 kB
|
|
92
91
|
dist/api/admin/apiRegisterSiteKeyEndpoint.js 1.00 kB │ gzip: 0.46 kB
|
|
93
92
|
dist/api/captcha/getFrictionlessCaptchaChallenge/sessionDedup.js 1.01 kB │ gzip: 0.45 kB
|
|
94
93
|
dist/api/captcha/getFrictionlessCaptchaChallenge/constants.js 1.04 kB │ gzip: 0.57 kB
|
|
95
94
|
dist/tasks/puzzle/nativeBackground.js 1.06 kB │ gzip: 0.58 kB
|
|
95
|
+
dist/api/detectorPoolBodyParser.js 1.07 kB │ gzip: 0.57 kB
|
|
96
96
|
dist/api/admin/apiRemoveSiteKeysEndpoint.js 1.07 kB │ gzip: 0.48 kB
|
|
97
97
|
dist/api/admin/apiRegisterSiteKeysEndpoint.js 1.08 kB │ gzip: 0.50 kB
|
|
98
98
|
dist/api/admin/apiRemoveSiteKeyEndpoint.js 1.08 kB │ gzip: 0.48 kB
|
|
@@ -104,7 +104,7 @@ dist/api/admin/apiGetDecisionMachineEndpoint.js 1.26 k
|
|
|
104
104
|
dist/tasks/puzzle/backgroundBuffer.js 1.26 kB │ gzip: 0.51 kB
|
|
105
105
|
dist/api/admin/apiRemoveAllDecisionMachinesEndpoint.js 1.27 kB │ gzip: 0.51 kB
|
|
106
106
|
dist/api/admin/apiRemoveDecisionMachineEndpoint.js 1.29 kB │ gzip: 0.51 kB
|
|
107
|
-
dist/tasks/dataset/datasetTasksUtils.js 1.
|
|
107
|
+
dist/tasks/dataset/datasetTasksUtils.js 1.33 kB │ gzip: 0.48 kB
|
|
108
108
|
dist/api/assetDocument.js 1.36 kB │ gzip: 0.75 kB
|
|
109
109
|
dist/tasks/detection/assignSecret.js 1.42 kB │ gzip: 0.74 kB
|
|
110
110
|
dist/utils/clientMetaData.js 1.42 kB │ gzip: 0.72 kB
|
|
@@ -115,6 +115,7 @@ dist/api/ja4Middleware.js 1.59 k
|
|
|
115
115
|
dist/utils/honeypot/encoders.js 1.62 kB │ gzip: 0.67 kB
|
|
116
116
|
dist/api/admin/apiGetSessionEndpoint.js 1.66 kB │ gzip: 0.80 kB
|
|
117
117
|
dist/api/admin/apiToggleMaintenanceModeEndpoint.js 1.66 kB │ gzip: 0.69 kB
|
|
118
|
+
dist/api/adminAuthOptions.js 1.67 kB │ gzip: 0.79 kB
|
|
118
119
|
dist/tasks/imgCaptcha/imgCaptchaTasksUtils.js 1.67 kB │ gzip: 0.74 kB
|
|
119
120
|
dist/utils/devicePlatform.js 1.68 kB │ gzip: 0.90 kB
|
|
120
121
|
dist/api/admin/apiUpdateDecisionMachineEndpoint.js 1.68 kB │ gzip: 0.58 kB
|
|
@@ -148,7 +149,8 @@ dist/api/captcha/assetSealFormat.js 3.38 k
|
|
|
148
149
|
dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js 3.39 kB │ gzip: 1.32 kB
|
|
149
150
|
dist/api/captcha/assignDetectorBundle.js 3.40 kB │ gzip: 1.34 kB
|
|
150
151
|
dist/tasks/tasks.js 3.44 kB │ gzip: 1.01 kB
|
|
151
|
-
dist/api/domainMiddleware.js 3.
|
|
152
|
+
dist/api/domainMiddleware.js 3.61 kB │ gzip: 1.24 kB
|
|
153
|
+
dist/utils/tarpitPadding.js 3.67 kB │ gzip: 1.51 kB
|
|
152
154
|
dist/api/rawTlsSignalsMiddleware.js 3.69 kB │ gzip: 1.13 kB
|
|
153
155
|
dist/tasks/spam/evaluateEmailSpamRules.js 3.84 kB │ gzip: 1.59 kB
|
|
154
156
|
dist/tasks/puzzle/puzzleRenderer.js 3.99 kB │ gzip: 1.52 kB
|
|
@@ -171,21 +173,21 @@ dist/tasks/spam/checkTrafficFilter.js 7.63 k
|
|
|
171
173
|
dist/api/captcha/submitPoWCaptchaSolution.js 8.70 kB │ gzip: 2.69 kB
|
|
172
174
|
dist/tasks/detection/bundlePool.js 8.86 kB │ gzip: 3.34 kB
|
|
173
175
|
dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js 9.36 kB │ gzip: 1.80 kB
|
|
174
|
-
dist/api/startProviderApi.js 10.
|
|
175
|
-
dist/
|
|
176
|
-
dist/tasks/client/clientTasks.js 11.27 kB │ gzip: 3.00 kB
|
|
176
|
+
dist/api/startProviderApi.js 10.22 kB │ gzip: 3.50 kB
|
|
177
|
+
dist/tasks/client/clientTasks.js 11.83 kB │ gzip: 3.18 kB
|
|
177
178
|
dist/tasks/decisionMachine/decisionMachineRunner.js 12.28 kB │ gzip: 3.85 kB
|
|
178
179
|
dist/util.js 12.47 kB │ gzip: 3.20 kB
|
|
179
180
|
dist/api/blacklistRequestInspector.js 12.75 kB │ gzip: 4.46 kB
|
|
180
|
-
dist/api/
|
|
181
|
+
dist/api/metrics.js 13.17 kB │ gzip: 4.27 kB
|
|
182
|
+
dist/api/verify.js 16.55 kB │ gzip: 3.04 kB
|
|
181
183
|
dist/tasks/frictionless/frictionlessTasks.js 17.86 kB │ gzip: 4.86 kB
|
|
182
184
|
dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js 18.63 kB │ gzip: 4.53 kB
|
|
183
185
|
dist/tasks/puzzleCaptcha/puzzleTasks.js 22.85 kB │ gzip: 5.14 kB
|
|
184
186
|
dist/tasks/powCaptcha/powTasks.js 24.56 kB │ gzip: 6.17 kB
|
|
185
187
|
dist/tasks/captchaManager.js 24.61 kB │ gzip: 7.41 kB
|
|
186
|
-
dist/tasks/imgCaptcha/imgCaptchaTasks.js 27.
|
|
188
|
+
dist/tasks/imgCaptcha/imgCaptchaTasks.js 27.41 kB │ gzip: 6.51 kB
|
|
187
189
|
|
|
188
|
-
[32m✓ built in
|
|
190
|
+
[32m✓ built in 219ms[39m
|
|
189
191
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodeBehavior.js to /home/runner/work/captcha/captcha/packages/provider/dist/tasks/detection/decodeBehavior.js
|
|
190
192
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodePayload.js to /home/runner/work/captcha/captcha/packages/provider/dist/tasks/detection/decodePayload.js
|
|
191
193
|
[copy-plugin] copying /home/runner/work/captcha/captcha/packages/provider/src/tasks/detection/decodeSimd.js to /home/runner/work/captcha/captcha/packages/provider/dist/tasks/detection/decodeSimd.js
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,129 @@
|
|
|
1
1
|
# @prosopo/provider
|
|
2
2
|
|
|
3
|
+
## 5.14.0
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
- ede4352: Admin tokens can now be bound to one provider and used only once. `jwtVerify` takes optional checks for the `aud` claim and for the longest allowed lifetime, and the provider's admin check uses them. A token that names an audience must name this provider: its host, `https://` plus its host, or one of the values in `PROSOPO_ADMIN_JWT_AUDIENCE`. A token that carries a `jti` is accepted once per provider process. Tokens may live at most one hour (`PROSOPO_ADMIN_JWT_MAX_LIFETIME_SECONDS`).
|
|
7
|
+
|
|
8
|
+
Migration: tokens without `aud` or `jti` are still accepted, so current callers keep working. Callers should add both, for example `pair.jwtIssue({ expiresIn }, { aud: provider.url, jti: randomUUID() })`, minting one token per provider and per request. Callers that reuse one token for several requests to the same provider must mint a new one per request before they add `jti`. Once every caller sends `aud`, set `PROSOPO_ADMIN_JWT_REQUIRE_AUDIENCE=true` to refuse tokens without it.
|
|
9
|
+
- e62661c: `/metrics` is no longer open to everyone by default. Without `PROSOPO_METRICS_TOKEN`, only direct requests from loopback or private addresses are served, such as a scraper on the docker network. Requests relayed by a reverse proxy (they carry `X-Forwarded-For`, `Forwarded` or `X-Real-IP`) get 403. With `PROSOPO_METRICS_TOKEN` set, any caller with `Authorization: Bearer <token>` is served, as before. The token is now compared in constant time. Set `PROSOPO_METRICS_PUBLIC=true` to keep the old open endpoint. A scraper that reaches the provider through a proxy or from a public address needs either the token or that flag.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fc79e06: The provider now only accepts a detector-pool upload of up to 128 MB from a caller with a valid admin token. Before, the large upload limit applied to anyone who sent a request to that path, because the body was read and parsed before the admin check and the rate limits ran, so unauthenticated requests could make the provider buffer and parse up to 128 MB each. Other requests to that path now get the normal 1 MB limit and are then refused by the admin check.
|
|
14
|
+
- 382f96b: Allowed-domain patterns that contain `*` are now matched without a regular expression. A pattern such as `*a*a*a*a*a*a*a*a*a*b` used to take tens of seconds to check against a long hostname, blocking the provider for every other request while it ran. Matching now takes time proportional to the pattern and hostname lengths, with the same results as before.
|
|
15
|
+
- 9ed0afd: 401 responses no longer include server internals. The admin auth check returned the whole error object, which included the request's i18n instance with its settings and file paths (about 16 KB per response), or whatever a failing check had thrown. It now returns `{ error: { code: 401, key, message } }`, the same shape as other API errors. The domain check returned unexpected errors, such as database errors, in the response body. It now returns a fixed message and logs the error.
|
|
16
|
+
- 3fe7b19: Check the number of unsolved captchas in a dataset against the configured minimum, instead of checking the number of solved ones twice.
|
|
17
|
+
|
|
18
|
+
The unsolved check compared the solved count with `unsolved.count`, so a dataset where every captcha was solved passed even when unsolved captchas were required. It now counts the captchas without a solution. Production sets `unsolved.count` to 0, so its behaviour does not change.
|
|
19
|
+
- b1becee: Stop padding the `/frictionless` response. The tarpit pads the challenge, and that endpoint does not serve one.
|
|
20
|
+
|
|
21
|
+
`GetFrictionlessCaptchaResponse` is `{captchaType, sessionId, dns_url}` — a session envelope. The widget then fetches the challenge from `/captcha/pow`, `/captcha/image` or `/captcha/puzzle`, and each of those resolves its own traffic-filter verdict and pads there, which is where the original feature put it.
|
|
22
|
+
|
|
23
|
+
Padding the envelope as well charged a tarpitted session twice. Measured on one site over 6h: 418 of 868 padded responses (48%, 1.48 GB of 3.09 GB) were `/frictionless`, roughly one per padded challenge.
|
|
24
|
+
|
|
25
|
+
This restores the frictionless handler to its pre-tarpit state, so it also reverts the hoist that extended envelope padding to reused sessions and pinned-captcha-type sites. Nothing is lost from the feature: each of those sessions still fetches a challenge from a typed endpoint, which pads it.
|
|
26
|
+
|
|
27
|
+
Kept from the same work: `padBytes` on the Mongoose traffic-category schema, without which the setting could not persist at all, and the padding writer's handling of a fieldless or non-object body.
|
|
28
|
+
- 3e1053b: Pad the challenge on the two frictionless paths that return early: a reused session, and a site pinned to a concrete captcha type.
|
|
29
|
+
|
|
30
|
+
`applyTrafficFilterAtRequestTime` ran after both short-circuits, so neither resolved a verdict and neither response was padded. On a site whose traffic is mostly returning visitors that is most of the traffic — on Twickets, session reuse is 11–18% of decisions and rose to ~16% after their proxy pool consolidated onto fewer IPs.
|
|
31
|
+
|
|
32
|
+
The verdict now resolves once, before both, and the pad is attached from it. No extra work: the call is synchronous and reads `req.ipInfo`, which `ipInfoMiddleware` already populates for every request.
|
|
33
|
+
|
|
34
|
+
The pad is read live on every request rather than stored on the session, unlike `captchaType`, `powDifficulty` and `puzzleTolerance`. Those are frozen because they are part of the issued challenge — the PoW string was minted at that difficulty — so re-deriving them mid-session would invalidate work already handed out. Nothing verifies the pad, so it has no such constraint, and reading it live means a newly-configured pad applies on the next request instead of only after every live session has expired.
|
|
35
|
+
|
|
36
|
+
A reused session keeps its cached captcha type, and a pinned site keeps serving the type it pinned. Making a category's `captchaType` override win over a site-level pin is a larger behaviour change and is left on prosopo/captcha#3463.
|
|
37
|
+
|
|
38
|
+
Blocking was never affected by any of this: `resolveTrafficFilterCheck` runs at submit time from the site's current settings and a fresh IP lookup, so a blocked category was always rejected regardless of how the challenge was issued.
|
|
39
|
+
|
|
40
|
+
Tests: the pad is attached on a reused session without evicting it or changing its cached type, and on a site pinned to each of pow / image / puzzle without changing which challenge is sent.
|
|
41
|
+
- df06006: Stream the traffic-filter tarpit padding with backpressure, and spread it across the response body instead of a single leading field.
|
|
42
|
+
|
|
43
|
+
The padding is written in 64 KiB chunks that wait for the socket to drain, and is abandoned if the connection goes away, so provider memory stays flat while a padded response is in flight however slowly it is read.
|
|
44
|
+
|
|
45
|
+
It is also split into several members with generated keys, one before each real field, rather than one `pad` member at the front. The body is the same size and parses the same way; no consumer reads these fields.
|
|
46
|
+
- 06784d0: Translation keys are now a typed union built from the English catalogue, so calling the translator with a key that does not exist fails to compile. Error classes only pass a message to the translator when it is a real catalogue key, and free-text messages are shown as they are.
|
|
47
|
+
- 7e9cd1e: The verify endpoints (image, PoW, puzzle and authenticated session) now answer 400 `GENERAL.INVALID_SIGNATURE` when the `dappSignature` is not hex, is the wrong length, or does not match the site key. Before, the error from the signature check fell into each handler's catch-all and came back as a 500. Anyone could call these endpoints and push up the provider's 500 rate, which made it look unhealthy and skewed the error-rate metrics. Real server faults later in the handlers still return 500.
|
|
48
|
+
- f7cfa1c: Return 400, not 500, when a verify request carries an undecodable token.
|
|
49
|
+
|
|
50
|
+
Every verify endpoint (image, PoW, puzzle and authenticated-session) decodes
|
|
51
|
+
the hex `ProcaptchaToken` inside a `try` whose `catch` answers
|
|
52
|
+
`API.BAD_REQUEST` with HTTP 500. The body schema only checks that the token is
|
|
53
|
+
a bounded `0x`-prefixed string, so a value like `0x1234` passes validation and
|
|
54
|
+
then fails to decode into a `ProcaptchaToken` SCALE struct — a bad-input case,
|
|
55
|
+
not a server fault.
|
|
56
|
+
|
|
57
|
+
The endpoints are unauthenticated, so any caller could make the provider
|
|
58
|
+
answer 500 at will. That mis-signals provider health and inflates the
|
|
59
|
+
error-rate metrics that alerting and the http_requests_total status label feed
|
|
60
|
+
from, without leaking anything (the response body is unchanged).
|
|
61
|
+
|
|
62
|
+
Decoding now goes through a helper that maps a decode failure to a 400
|
|
63
|
+
`CAPTCHA.PARSE_ERROR`, matching the existing 400 the same endpoints already
|
|
64
|
+
return for a non-hex token. Genuine server errors later in each handler still
|
|
65
|
+
surface as 500.
|
|
66
|
+
- Updated dependencies [ede4352]
|
|
67
|
+
- Updated dependencies [f53ddb2]
|
|
68
|
+
- Updated dependencies [97d65fa]
|
|
69
|
+
- Updated dependencies [08daf16]
|
|
70
|
+
- Updated dependencies [1144e04]
|
|
71
|
+
- Updated dependencies [de6bb08]
|
|
72
|
+
- Updated dependencies [2145922]
|
|
73
|
+
- Updated dependencies [b017dfb]
|
|
74
|
+
- Updated dependencies [8ed0eb8]
|
|
75
|
+
- Updated dependencies [9ed0afd]
|
|
76
|
+
- Updated dependencies [70fcefd]
|
|
77
|
+
- Updated dependencies [06784d0]
|
|
78
|
+
- Updated dependencies [06784d0]
|
|
79
|
+
- Updated dependencies [8d7ba8c]
|
|
80
|
+
- Updated dependencies [995e954]
|
|
81
|
+
- Updated dependencies [97a799e]
|
|
82
|
+
- Updated dependencies [9fc1e8a]
|
|
83
|
+
- Updated dependencies [4461043]
|
|
84
|
+
- Updated dependencies [92edebd]
|
|
85
|
+
- Updated dependencies [54a07f3]
|
|
86
|
+
- Updated dependencies [b75e9b7]
|
|
87
|
+
- Updated dependencies [6d5b7f5]
|
|
88
|
+
- @prosopo/util-crypto@13.6.0
|
|
89
|
+
- @prosopo/keyring@2.10.0
|
|
90
|
+
- @prosopo/types@5.12.0
|
|
91
|
+
- @prosopo/api-express-router@3.2.0
|
|
92
|
+
- @prosopo/database@4.1.3
|
|
93
|
+
- @prosopo/datasets@3.2.0
|
|
94
|
+
- @prosopo/util@3.3.13
|
|
95
|
+
- @prosopo/locale@3.6.2
|
|
96
|
+
- @prosopo/load-balancer@2.11.4
|
|
97
|
+
- @prosopo/common@3.1.61
|
|
98
|
+
- @prosopo/types-database@5.7.3
|
|
99
|
+
- @prosopo/env@3.6.68
|
|
100
|
+
- @prosopo/user-access-policy@3.14.14
|
|
101
|
+
- @prosopo/types-env@2.11.14
|
|
102
|
+
- @prosopo/api@4.3.8
|
|
103
|
+
- @prosopo/ipinfo@0.4.13
|
|
104
|
+
- @prosopo/logger@2.1.2
|
|
105
|
+
- @prosopo/api-route@2.6.62
|
|
106
|
+
- @prosopo/redis-client@1.0.39
|
|
107
|
+
|
|
108
|
+
## 5.13.4
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- bcf59f1: Make the traffic-filter tarpit actually reach a visitor. As shipped, `padBytes` could not survive being saved and never fired on the endpoint nearly every site uses, so no response was ever padded.
|
|
112
|
+
|
|
113
|
+
`TrafficCategoryPolicySchema` in `types-database` never declared `padBytes`, and Mongoose drops undeclared fields on write. The setting round-tripped through zod at both ends — the portal's site save and the provider's client-list push — and was then thrown away by the database at each, so `checkTrafficFilter` only ever read `undefined`. Declared now, bounded to the same 0–5 MiB range zod enforces.
|
|
114
|
+
|
|
115
|
+
The frictionless endpoint resolved a traffic-filter verdict but never passed its `padBytes` to the response middleware, so only the direct `/pow`, `/image` and `/puzzle` endpoints padded anything. It is now set as soon as the verdict is known, which covers both the challenge the traffic filter dispatches and the one the decision machine issues.
|
|
116
|
+
|
|
117
|
+
Also stops the padding writer emitting invalid JSON for a body with no fields (it spliced in a trailing comma), and leaves a non-object body unpadded rather than corrupting it.
|
|
118
|
+
|
|
119
|
+
Tests: the Mongoose round-trip for a challenge and a blocked category plus the cap, `resolvePadBytes` across block/challenge/multiple matches, the request-time verdict carrying the count, the frictionless handler attaching it, and the padding middleware itself — byte count, pad-first ordering, incompressibility, the 5 MiB clamp, and the untouched-by-default path.
|
|
120
|
+
- Updated dependencies [bcf59f1]
|
|
121
|
+
- @prosopo/types-database@5.7.2
|
|
122
|
+
- @prosopo/database@4.1.2
|
|
123
|
+
- @prosopo/types-env@2.11.13
|
|
124
|
+
- @prosopo/env@3.6.67
|
|
125
|
+
- @prosopo/api-express-router@3.1.98
|
|
126
|
+
|
|
3
127
|
## 5.13.3
|
|
4
128
|
### Patch Changes
|
|
5
129
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type AuthMiddlewareOptions } from "@prosopo/api-express-router";
|
|
2
|
+
export declare const DEFAULT_ADMIN_JWT_MAX_LIFETIME_SECONDS = 3600;
|
|
3
|
+
export declare const adminAuthOptions: (vars: Record<string, string | undefined>, host: string | undefined) => AuthMiddlewareOptions;
|
|
4
|
+
//# sourceMappingURL=adminAuthOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminAuthOptions.d.ts","sourceRoot":"","sources":["../../src/api/adminAuthOptions.ts"],"names":[],"mappings":"AAcA,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,6BAA6B,CAAC;AAGrC,eAAO,MAAM,sCAAsC,OAAO,CAAC;AAmB3D,eAAO,MAAM,gBAAgB,SACtB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,QAClC,MAAM,GAAG,SAAS,KACtB,qBAyBF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createMemoryJwtReplayGuard } from "@prosopo/api-express-router";
|
|
2
|
+
//#region src/api/adminAuthOptions.ts
|
|
3
|
+
/** Longest admin token lifetime (exp - iat) accepted by default, in seconds. */
|
|
4
|
+
var DEFAULT_ADMIN_JWT_MAX_LIFETIME_SECONDS = 3600;
|
|
5
|
+
var parseList = (value) => (value ?? "").split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
6
|
+
/**
|
|
7
|
+
* Admin JWT checks for this provider.
|
|
8
|
+
*
|
|
9
|
+
* - Audience: a token carrying `aud` must name this provider. The accepted
|
|
10
|
+
* values come from PROSOPO_ADMIN_JWT_AUDIENCE (comma separated), else from
|
|
11
|
+
* the provider host as both `host` and `https://host`. Tokens without `aud`
|
|
12
|
+
* are still accepted until PROSOPO_ADMIN_JWT_REQUIRE_AUDIENCE=true.
|
|
13
|
+
* - Replay: a token carrying `jti` is accepted once per process.
|
|
14
|
+
* - Lifetime: exp - iat may not exceed PROSOPO_ADMIN_JWT_MAX_LIFETIME_SECONDS
|
|
15
|
+
* (default one hour).
|
|
16
|
+
*/
|
|
17
|
+
var adminAuthOptions = (vars, host) => {
|
|
18
|
+
const configured = parseList(vars.PROSOPO_ADMIN_JWT_AUDIENCE);
|
|
19
|
+
const requireAudience = vars.PROSOPO_ADMIN_JWT_REQUIRE_AUDIENCE === "true";
|
|
20
|
+
const derived = host ? [host, `https://${host}`] : [];
|
|
21
|
+
const candidates = configured.length > 0 ? configured : derived;
|
|
22
|
+
const audience = candidates.length > 0 || requireAudience ? candidates : void 0;
|
|
23
|
+
const maxLifetime = Number.parseInt(vars.PROSOPO_ADMIN_JWT_MAX_LIFETIME_SECONDS ?? "", 10);
|
|
24
|
+
return {
|
|
25
|
+
verify: {
|
|
26
|
+
audience,
|
|
27
|
+
requireAudience,
|
|
28
|
+
maxLifetimeSeconds: Number.isFinite(maxLifetime) && maxLifetime > 0 ? maxLifetime : DEFAULT_ADMIN_JWT_MAX_LIFETIME_SECONDS
|
|
29
|
+
},
|
|
30
|
+
replayGuard: createMemoryJwtReplayGuard()
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DEFAULT_ADMIN_JWT_MAX_LIFETIME_SECONDS, adminAuthOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminAuthOptions.js","sourceRoot":"","sources":["../../src/api/adminAuthOptions.ts"],"names":[],"mappings":"AAcA,OAAO,EAEN,0BAA0B,GAC1B,MAAM,6BAA6B,CAAC;AAGrC,MAAM,CAAC,MAAM,sCAAsC,GAAG,IAAI,CAAC;AAE3D,MAAM,SAAS,GAAG,CAAC,KAAyB,EAAY,EAAE,CACzD,CAAC,KAAK,IAAI,EAAE,CAAC;KACX,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;KAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAavC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC/B,IAAwC,EACxC,IAAwB,EACA,EAAE;IAC1B,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,kCAAkC,KAAK,MAAM,CAAC;IAC3E,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtD,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;IAEhE,MAAM,QAAQ,GACb,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;IAEnE,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAClC,IAAI,CAAC,sCAAsC,IAAI,EAAE,EACjD,EAAE,CACF,CAAC;IAEF,OAAO;QACN,MAAM,EAAE;YACP,QAAQ;YACR,eAAe;YACf,kBAAkB,EACjB,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC;gBAC9C,CAAC,CAAC,WAAW;gBACb,CAAC,CAAC,sCAAsC;SAC1C;QACD,WAAW,EAAE,0BAA0B,EAAE;KACzC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KeyringPair } from "@prosopo/types";
|
|
2
|
+
import { type NextFunction, type Request, type Response } from "express";
|
|
3
|
+
export declare const detectorPoolBodyParser: (limit: string, pair: KeyringPair | undefined, authAccount: KeyringPair | undefined) => (req: Request, res: Response, next: NextFunction) => void;
|
|
4
|
+
//# sourceMappingURL=detectorPoolBodyParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectorPoolBodyParser.d.ts","sourceRoot":"","sources":["../../src/api/detectorPoolBodyParser.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAgB,EACf,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,SAAS,CAAC;AA2BjB,eAAO,MAAM,sBAAsB,UAC3B,MAAM,QACP,WAAW,GAAG,SAAS,eAChB,WAAW,GAAG,SAAS,WAGvB,OAAO,OAAO,QAAQ,QAAQ,YAAY,KAAG,IAO1D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
//#region src/api/detectorPoolBodyParser.ts
|
|
3
|
+
var hasValidAdminJwt = (req, pair, authAccount) => {
|
|
4
|
+
const header = req.headers.authorization;
|
|
5
|
+
if (typeof header !== "string" || !header.startsWith("Bearer ")) return false;
|
|
6
|
+
const jwt = header.slice(7);
|
|
7
|
+
try {
|
|
8
|
+
return authAccount?.jwtVerify(jwt).isValid === true || pair?.jwtVerify(jwt).isValid === true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Parses the detector-pool push body with its large limit, but only for a
|
|
15
|
+
* request that carries a valid admin JWT. This parser runs before the admin
|
|
16
|
+
* auth middleware and the rate limits, so without the check anyone could make
|
|
17
|
+
* the provider buffer and parse a body of up to `limit`. Other requests fall
|
|
18
|
+
* through to the default, much smaller, JSON parser.
|
|
19
|
+
*/
|
|
20
|
+
var detectorPoolBodyParser = (limit, pair, authAccount) => {
|
|
21
|
+
const parse = express.json({ limit });
|
|
22
|
+
return (req, res, next) => {
|
|
23
|
+
if (!hasValidAdminJwt(req, pair, authAccount)) {
|
|
24
|
+
next();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
parse(req, res, next);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { detectorPoolBodyParser };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectorPoolBodyParser.js","sourceRoot":"","sources":["../../src/api/detectorPoolBodyParser.ts"],"names":[],"mappings":"AAgBA,OAAO,OAIN,MAAM,SAAS,CAAC;AAEjB,MAAM,gBAAgB,GAAG,CACxB,GAAY,EACZ,IAA6B,EAC7B,WAAoC,EAC1B,EAAE;IACZ,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;IACzC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9E,MAAM,GAAG,GAAQ,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChD,IAAI,CAAC;QACJ,OAAO,CACN,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,IAAI;YAC5C,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,IAAI,CACrC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC;AASF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACrC,KAAa,EACb,IAA6B,EAC7B,WAAoC,EACnC,EAAE;IACH,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAQ,EAAE;QAChE,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;YAC/C,IAAI,EAAE,CAAC;YACP,OAAO;QACR,CAAC;QACD,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domainMiddleware.d.ts","sourceRoot":"","sources":["../../src/api/domainMiddleware.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQ/D,eAAO,MAAM,gBAAgB,QAAS,mBAAmB,WAOrC,OAAO,OAAO,QAAQ,QAAQ,YAAY,
|
|
1
|
+
{"version":3,"file":"domainMiddleware.d.ts","sourceRoot":"","sources":["../../src/api/domainMiddleware.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQ/D,eAAO,MAAM,gBAAgB,QAAS,mBAAmB,WAOrC,OAAO,OAAO,QAAQ,QAAQ,YAAY,kBAwF7D,CAAC"}
|
|
@@ -48,9 +48,13 @@ var domainMiddleware = (env) => {
|
|
|
48
48
|
recordDomainValidation("rejected");
|
|
49
49
|
if (err instanceof ProsopoApiError || err instanceof ZodError || err instanceof SyntaxError) handleErrors(err, req, res, next);
|
|
50
50
|
else {
|
|
51
|
+
req.logger.error(() => ({
|
|
52
|
+
err,
|
|
53
|
+
msg: "Domain middleware error"
|
|
54
|
+
}));
|
|
51
55
|
res.status(401).json({
|
|
52
56
|
error: "Unauthorized",
|
|
53
|
-
message:
|
|
57
|
+
message: "Unauthorized"
|
|
54
58
|
});
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domainMiddleware.js","sourceRoot":"","sources":["../../src/api/domainMiddleware.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAwB,EAAE,EAAE;IAK5D,IAAI,WAA8B,CAAC;IAEnC,OAAO,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE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,EAAE;QACrC,IAAI;QACJ,MAAM;KACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC3B,IAAgD,EAChD,OAAe,EACf,MAAe,EACd,EAAE;IACH,OAAO,IAAI,eAAe,CAAC,sBAAsB,EAAE;QAClD,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE;QACxC,IAAI;QACJ,MAAM;KACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC/B,IAAgD,EAChD,MAAe,EACf,MAAe,EACd,EAAE;IACH,OAAO,IAAI,eAAe,CAAC,6BAA6B,EAAE;QACzD,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE;QAC9B,IAAI;QACJ,MAAM;KACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CACjC,IAAgD,EAChD,IAAY,EACZ,MAAc,EACd,MAAe,EACd,EAAE;IACH,OAAO,IAAI,eAAe,CAAC,6BAA6B,EAAE;QACzD,OAAO,EAAE;YACR,IAAI,EAAE,GAAG;YACT,OAAO,EACN,+EAA+E;YAChF,OAAO,EAAE,IAAI;YACb,MAAM;SACN;QACD,IAAI;QACJ,MAAM;KACN,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/api/metrics.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProviderEnvironment } from "@prosopo/env";
|
|
2
2
|
import { type CaptchaType } from "@prosopo/types";
|
|
3
|
-
import type { RequestHandler } from "express";
|
|
3
|
+
import type { Request, RequestHandler } from "express";
|
|
4
4
|
import { Counter, Gauge, Histogram, Registry } from "prom-client";
|
|
5
5
|
import type { HealthzGeoOutcome } from "./healthzGeo.js";
|
|
6
6
|
export declare const metricsEnabled: () => boolean;
|
|
@@ -47,6 +47,7 @@ export declare const setMaintenanceModeGauge: (on: boolean) => void;
|
|
|
47
47
|
export declare const recordDecoderOutcome: (decoder: string, outcome: "ok" | "error", durationSeconds: number) => void;
|
|
48
48
|
export declare const measureSync: <T>(span: SyncSpan, fn: () => T) => T;
|
|
49
49
|
export declare const metricsMiddleware: () => RequestHandler;
|
|
50
|
+
export declare const metricsAccess: (req: Request, vars?: Record<string, string | undefined>) => 200 | 401 | 403;
|
|
50
51
|
export declare const metricsHandler: (env: ProviderEnvironment) => RequestHandler;
|
|
51
52
|
export {};
|
|
52
53
|
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/api/metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/api/metrics.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAEN,KAAK,WAAW,EAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAgB,OAAO,EAAE,cAAc,EAAY,MAAM,SAAS,CAAC;AAC/E,OAAO,EACN,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EAER,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKzD,eAAO,MAAM,cAAc,QAAO,OACc,CAAC;AA0BjD,eAAO,MAAM,UAAU,4FAKb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAsBnD,UAAU,eAAe;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAC1D,mBAAmB,EAAE,SAAS,CAAC,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC,CAAC;IAC9D,kBAAkB,EAAE,OAA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