@prosopo/procaptcha-frictionless 2.21.4 → 2.21.6
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 +10 -10
- package/.turbo/turbo-build$colon$tsc.log +26 -26
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +83 -0
- package/dist/authenticatedBadge.d.ts +4 -0
- package/dist/authenticatedBadge.d.ts.map +1 -1
- package/dist/authenticatedBadge.js +30 -16
- package/dist/authenticatedBadge.js.map +1 -1
- package/dist/cjs/authenticatedBadge.cjs +29 -15
- package/dist/cjs/customDetectBot.cjs +10 -3
- package/dist/cjs/frictionlessResultGuard.cjs +31 -25
- package/dist/cjs/procaptchaFrictionless.cjs +24 -15
- package/dist/customDetectBot.d.ts.map +1 -1
- package/dist/customDetectBot.js +10 -3
- package/dist/customDetectBot.js.map +1 -1
- package/dist/errorSites.d.ts +10 -0
- package/dist/errorSites.d.ts.map +1 -0
- package/dist/errorSites.js +2 -0
- package/dist/errorSites.js.map +1 -0
- package/dist/frictionlessResultGuard.d.ts +3 -5
- package/dist/frictionlessResultGuard.d.ts.map +1 -1
- package/dist/frictionlessResultGuard.js +31 -25
- package/dist/frictionlessResultGuard.js.map +1 -1
- package/dist/procaptchaFrictionless.d.ts.map +1 -1
- package/dist/procaptchaFrictionless.js +30 -21
- package/dist/procaptchaFrictionless.js.map +1 -1
- package/dist/tests/authenticatedBadge.unit.test.js +79 -0
- package/dist/tests/authenticatedBadge.unit.test.js.map +1 -1
- package/dist/tests/customDetectBot.test.js +5 -5
- package/dist/tests/customDetectBot.test.js.map +1 -1
- package/dist/tests/escalationHandoff.integration.test.js +4 -3
- package/dist/tests/escalationHandoff.integration.test.js.map +1 -1
- package/dist/tests/frictionlessResultGuard.test.js +63 -43
- package/dist/tests/frictionlessResultGuard.test.js.map +1 -1
- package/dist/tests/procaptchaFrictionless.test.js +12 -4
- package/dist/tests/procaptchaFrictionless.test.js.map +1 -1
- package/package.json +17 -17
|
@@ -8,7 +8,6 @@ ViteCommonJSConfig: .
|
|
|
8
8
|
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
9
9
|
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
10
10
|
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
11
|
-
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
12
11
|
'/home/runner/work/captcha/captcha/packages/procaptcha-audio/tsconfig.json',
|
|
13
12
|
'/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
|
|
14
13
|
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
@@ -22,7 +21,8 @@ ViteCommonJSConfig: .
|
|
|
22
21
|
'/home/runner/work/captcha/captcha/packages/procaptcha-puzzle/tsconfig.json',
|
|
23
22
|
'/home/runner/work/captcha/captcha/packages/procaptcha-react/tsconfig.json',
|
|
24
23
|
'/home/runner/work/captcha/captcha/packages/procaptcha/tsconfig.json',
|
|
25
|
-
'/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json'
|
|
24
|
+
'/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json',
|
|
25
|
+
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json'
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
{
|
|
@@ -33,7 +33,6 @@ ViteCommonJSConfig: .
|
|
|
33
33
|
'@prosopo/util',
|
|
34
34
|
'@prosopo/util-crypto',
|
|
35
35
|
'@prosopo/common',
|
|
36
|
-
'@prosopo/logger',
|
|
37
36
|
'@prosopo/procaptcha-audio',
|
|
38
37
|
'@prosopo/procaptcha-common',
|
|
39
38
|
'@prosopo/load-balancer',
|
|
@@ -47,11 +46,12 @@ ViteCommonJSConfig: .
|
|
|
47
46
|
'@prosopo/procaptcha-puzzle',
|
|
48
47
|
'@prosopo/procaptcha-react',
|
|
49
48
|
'@prosopo/procaptcha',
|
|
50
|
-
'@prosopo/datasets'
|
|
49
|
+
'@prosopo/datasets',
|
|
50
|
+
'@prosopo/logger'
|
|
51
51
|
]
|
|
52
52
|
}
|
|
53
53
|
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
54
|
-
[36mvite v8.1.
|
|
54
|
+
[36mvite v8.1.6 [32mbuilding ssr environment for production...[36m[39m
|
|
55
55
|
Bundle build started
|
|
56
56
|
[2K
|
|
57
57
|
✓ 9 modules transformed.
|
|
@@ -60,10 +60,10 @@ computing gzip size...
|
|
|
60
60
|
dist/cjs/index.cjs 0.55 kB │ gzip: 0.21 kB
|
|
61
61
|
dist/cjs/detectorLoader.cjs 1.65 kB │ gzip: 0.90 kB
|
|
62
62
|
dist/cjs/sessionInvalidatedRecovery.cjs 2.50 kB │ gzip: 1.14 kB
|
|
63
|
-
dist/cjs/frictionlessResultGuard.cjs 2.
|
|
63
|
+
dist/cjs/frictionlessResultGuard.cjs 2.78 kB │ gzip: 1.42 kB
|
|
64
64
|
dist/cjs/detectorPrefetch.cjs 3.12 kB │ gzip: 1.40 kB
|
|
65
|
-
dist/cjs/authenticatedBadge.cjs 3.
|
|
66
|
-
dist/cjs/customDetectBot.cjs 6.
|
|
67
|
-
dist/cjs/procaptchaFrictionless.cjs 13.
|
|
65
|
+
dist/cjs/authenticatedBadge.cjs 3.81 kB │ gzip: 1.45 kB
|
|
66
|
+
dist/cjs/customDetectBot.cjs 6.35 kB │ gzip: 1.91 kB
|
|
67
|
+
dist/cjs/procaptchaFrictionless.cjs 13.84 kB │ gzip: 3.84 kB
|
|
68
68
|
|
|
69
|
-
[32m✓ built in
|
|
69
|
+
[32m✓ built in 60ms[39m
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
$ tsc --build --verbose
|
|
2
|
-
|
|
2
|
+
5:08:38 PM - Projects in this build:
|
|
3
3
|
* ../../dev/config/tsconfig.json
|
|
4
4
|
* ../util/tsconfig.json
|
|
5
5
|
* ../locale/tsconfig.json
|
|
6
6
|
* ../util-crypto/tsconfig.json
|
|
7
7
|
* ../types/tsconfig.json
|
|
8
8
|
* ../api/tsconfig.json
|
|
9
|
-
* ../logger/tsconfig.json
|
|
10
9
|
* ../common/tsconfig.json
|
|
11
10
|
* ../load-balancer/tsconfig.json
|
|
12
11
|
* ../widget-skeleton/tsconfig.json
|
|
@@ -19,56 +18,57 @@ $ tsc --build --verbose
|
|
|
19
18
|
* ../procaptcha-icon-order/tsconfig.json
|
|
20
19
|
* ../procaptcha-pow/tsconfig.json
|
|
21
20
|
* ../procaptcha-puzzle/tsconfig.json
|
|
21
|
+
* ../logger/tsconfig.json
|
|
22
22
|
* ../datasets/tsconfig.json
|
|
23
23
|
* ../procaptcha/tsconfig.json
|
|
24
24
|
* ../procaptcha-react/tsconfig.json
|
|
25
25
|
* tsconfig.json
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
5:08:38 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'
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
5:08:38 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
5:08:38 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
5:08:38 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'
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
5:08:38 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'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
5:08:38 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
5:08:38 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/errorCodes.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
5:08:38 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/developmentProviderUrl.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
5:08:38 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/theme.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
5:08:38 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
5:08:38 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.test.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
5:08:38 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
5:08:39 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/workers/cryptoWorker.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
5:08:39 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/reload.unit.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
5:08:39 PM - Project '../procaptcha-audio/tsconfig.json' is up to date because newest input '../procaptcha-audio/src/errorSites.ts' is older than output '../procaptcha-audio/tsconfig.tsbuildinfo'
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
5:08:39 PM - Project '../procaptcha-icon-order/tsconfig.json' is up to date because newest input '../procaptcha-icon-order/src/errorSites.ts' is older than output '../procaptcha-icon-order/tsconfig.tsbuildinfo'
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
5:08:39 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/errorSites.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
5:08:39 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/tests/invisibleCanvasVisibility.unit.test.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
5:08:39 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
5:08:39 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/errorSites.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
5:08:39 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/ProsopoCaptchaApi.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
5:08:39 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
5:08:39 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
5:08:39 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
74
74
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -9,7 +9,6 @@ ViteEsmConfig: .
|
|
|
9
9
|
'/home/runner/work/captcha/captcha/packages/util/tsconfig.json',
|
|
10
10
|
'/home/runner/work/captcha/captcha/packages/util-crypto/tsconfig.json',
|
|
11
11
|
'/home/runner/work/captcha/captcha/packages/common/tsconfig.json',
|
|
12
|
-
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json',
|
|
13
12
|
'/home/runner/work/captcha/captcha/packages/procaptcha-audio/tsconfig.json',
|
|
14
13
|
'/home/runner/work/captcha/captcha/packages/procaptcha-common/tsconfig.json',
|
|
15
14
|
'/home/runner/work/captcha/captcha/packages/load-balancer/tsconfig.json',
|
|
@@ -23,7 +22,8 @@ ViteEsmConfig: .
|
|
|
23
22
|
'/home/runner/work/captcha/captcha/packages/procaptcha-puzzle/tsconfig.json',
|
|
24
23
|
'/home/runner/work/captcha/captcha/packages/procaptcha-react/tsconfig.json',
|
|
25
24
|
'/home/runner/work/captcha/captcha/packages/procaptcha/tsconfig.json',
|
|
26
|
-
'/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json'
|
|
25
|
+
'/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json',
|
|
26
|
+
'/home/runner/work/captcha/captcha/packages/logger/tsconfig.json'
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
29
|
{
|
|
@@ -34,7 +34,6 @@ ViteEsmConfig: .
|
|
|
34
34
|
'@prosopo/util',
|
|
35
35
|
'@prosopo/util-crypto',
|
|
36
36
|
'@prosopo/common',
|
|
37
|
-
'@prosopo/logger',
|
|
38
37
|
'@prosopo/procaptcha-audio',
|
|
39
38
|
'@prosopo/procaptcha-common',
|
|
40
39
|
'@prosopo/load-balancer',
|
|
@@ -48,11 +47,12 @@ ViteEsmConfig: .
|
|
|
48
47
|
'@prosopo/procaptcha-puzzle',
|
|
49
48
|
'@prosopo/procaptcha-react',
|
|
50
49
|
'@prosopo/procaptcha',
|
|
51
|
-
'@prosopo/datasets'
|
|
50
|
+
'@prosopo/datasets',
|
|
51
|
+
'@prosopo/logger'
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
55
|
-
[36mvite v8.1.
|
|
55
|
+
[36mvite v8.1.6 [32mbuilding ssr environment for production...[36m[39m
|
|
56
56
|
Bundle build started
|
|
57
57
|
[2K
|
|
58
58
|
✓ 9 modules transformed.
|
|
@@ -62,10 +62,10 @@ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
|
62
62
|
dist/index.js 0.33 kB │ gzip: 0.15 kB
|
|
63
63
|
dist/detectorLoader.js 1.63 kB │ gzip: 0.90 kB
|
|
64
64
|
dist/sessionInvalidatedRecovery.js 2.41 kB │ gzip: 1.13 kB
|
|
65
|
-
dist/
|
|
66
|
-
dist/frictionlessResultGuard.js 2.68 kB │ gzip: 1.39 kB
|
|
65
|
+
dist/frictionlessResultGuard.js 2.71 kB │ gzip: 1.41 kB
|
|
67
66
|
dist/detectorPrefetch.js 2.98 kB │ gzip: 1.37 kB
|
|
68
|
-
dist/
|
|
69
|
-
dist/
|
|
67
|
+
dist/authenticatedBadge.js 3.30 kB │ gzip: 1.42 kB
|
|
68
|
+
dist/customDetectBot.js 6.15 kB │ gzip: 1.88 kB
|
|
69
|
+
dist/procaptchaFrictionless.js 13.15 kB │ gzip: 3.81 kB
|
|
70
70
|
|
|
71
|
-
[32m✓ built in
|
|
71
|
+
[32m✓ built in 410ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,88 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.21.6
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 46b97b7: Roll up the open Dependabot updates: express 5 (with `@types/express` 5), dotenv 18, undici 8, geolib 4, vitest 5, vite 8.1.6 everywhere, 17 minor and patch bumps (Babel, mongoose, i18next, ip-address, turbo and others), `@angular/router` in the Angular demo, and a GitHub Actions bump.
|
|
7
|
+
|
|
8
|
+
The whole vitest family moves to 5.0.4, including `@vitest/coverage-v8`, because `@vitest/browser-playwright` 5 only works with vitest 5. The `@types/express-serve-static-core` override moves to 5.1.3 to match `@types/express` 5.
|
|
9
|
+
|
|
10
|
+
`@prosopo/dotenv` now loads env files with `quiet: true`. Since dotenv 17, every load prints an "injected env" line to stderr unless told not to.
|
|
11
|
+
- d2148c8: Errors now carry a fixed code and a site instead of a translation key.
|
|
12
|
+
|
|
13
|
+
Every error is a `ProsopoError` with a `code` from one list in
|
|
14
|
+
`@prosopo/common` (`ERROR_CODES`) and an `errorSite` such as `PROV-12`, which
|
|
15
|
+
names the one place it was thrown. Together they make the `errorId`, e.g.
|
|
16
|
+
`SITE_KEY_INVALID:PROV-31`, which the widget shows after the message so a
|
|
17
|
+
screenshot is enough to find the throw.
|
|
18
|
+
|
|
19
|
+
What a client sees:
|
|
20
|
+
|
|
21
|
+
- A public error (bad site key, blocked network, and so on) sends its code,
|
|
22
|
+
English message, data and errorId.
|
|
23
|
+
- Anything else sends only `BACKEND_ERROR:<site>` (or `FRONTEND_ERROR:<site>`
|
|
24
|
+
from the widget) and a status. Internal details never leave the server.
|
|
25
|
+
|
|
26
|
+
The provider no longer translates errors. The widget looks up
|
|
27
|
+
`ERRORS.<CODE>` in its catalogue and falls back to the English message. The
|
|
28
|
+
old error classes (`ProsopoApiError`, `ProsopoEnvError` and the rest), the
|
|
29
|
+
`key`/`messageEn` fields and `localiseErrorMessage` are gone.
|
|
30
|
+
|
|
31
|
+
Other changes in behaviour:
|
|
32
|
+
|
|
33
|
+
- An error with no specific code is a hidden 500.
|
|
34
|
+
- Errors no longer log themselves when they are created. The server logs each
|
|
35
|
+
unhandled one once: 5xx as errors, 4xx at debug.
|
|
36
|
+
- An invalid PoW signature is a 401 instead of a 500.
|
|
37
|
+
- `stringifyBigInts` returns a copy instead of changing its input, so frozen
|
|
38
|
+
error context can be logged.
|
|
39
|
+
- The provider's last hand-written error replies now use the same error body.
|
|
40
|
+
These were the missing-header 401s, the access-policy block, autoBan, the
|
|
41
|
+
metrics 401/403 and the rate limiter. The rate limiter answers with a new
|
|
42
|
+
public `RATE_LIMITED` (429) code.
|
|
43
|
+
- Updated dependencies [f31f0d5]
|
|
44
|
+
- Updated dependencies [46b97b7]
|
|
45
|
+
- Updated dependencies [d2148c8]
|
|
46
|
+
- Updated dependencies [2bcf2fe]
|
|
47
|
+
- @prosopo/widget-skeleton@2.10.3
|
|
48
|
+
- @prosopo/api@4.7.4
|
|
49
|
+
- @prosopo/common@3.3.0
|
|
50
|
+
- @prosopo/locale@3.12.0
|
|
51
|
+
- @prosopo/procaptcha-audio@0.2.7
|
|
52
|
+
- @prosopo/procaptcha-common@2.21.6
|
|
53
|
+
- @prosopo/procaptcha-icon-order@0.2.7
|
|
54
|
+
- @prosopo/procaptcha-pow@2.13.16
|
|
55
|
+
- @prosopo/procaptcha-puzzle@2.17.6
|
|
56
|
+
- @prosopo/procaptcha-react@2.14.7
|
|
57
|
+
- @prosopo/types@5.17.0
|
|
58
|
+
|
|
59
|
+
## 2.21.5
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- 3c5d196: Make the Web Bot Auth agent pass work end to end. Driving a signing agent through the demo site turned up six things that stopped an allowed agent getting through, or let a blocked one past:
|
|
63
|
+
|
|
64
|
+
- A site set to a fixed captcha type (PoW, image, puzzle, icon order), or a provider with no detector bundles, served its challenge before the signature was checked. A verified agent's Allow and Block rules are now applied first.
|
|
65
|
+
- An agent with an existing challenge session for the same user, IP and site got that session back. A matching Allow rule now replaces it with a fresh authenticated session.
|
|
66
|
+
- An agent whose page sent no detector token failed with "Failed to store session". The session now gets a generated token, the way the other no-detector paths do.
|
|
67
|
+
- A provider that sees clients as IPv4-mapped IPv6 (`::ffff:1.2.3.4`) rejected every verify, because the site forwards the plain `1.2.3.4`. The IP check now treats the two as the same address.
|
|
68
|
+
- Deleting or filtering access rules by `webBotAuthAgent` sent Redis an unescaped URL, which is a query syntax error, so nothing was deleted. Removing an Agent Trust rule in the portal left it in force.
|
|
69
|
+
- The widget issued the token at page load and never refreshed it. In invisible mode it drew the badge and fired the callback before the user did anything; it now draws nothing and issues the token on execute(). In both modes the pass now expires and renews like a solved PoW, so an agent that takes more than three minutes to fill a form no longer fails with "not recent".
|
|
70
|
+
|
|
71
|
+
Rejected signatures are now logged with the reason.
|
|
72
|
+
- Updated dependencies [b6e9459]
|
|
73
|
+
- Updated dependencies [a5c953d]
|
|
74
|
+
- @prosopo/locale@3.11.1
|
|
75
|
+
- @prosopo/procaptcha-react@2.14.6
|
|
76
|
+
- @prosopo/widget-skeleton@2.10.2
|
|
77
|
+
- @prosopo/common@3.2.3
|
|
78
|
+
- @prosopo/procaptcha-audio@0.2.6
|
|
79
|
+
- @prosopo/procaptcha-icon-order@0.2.6
|
|
80
|
+
- @prosopo/procaptcha-pow@2.13.15
|
|
81
|
+
- @prosopo/procaptcha-puzzle@2.17.5
|
|
82
|
+
- @prosopo/types@5.16.3
|
|
83
|
+
- @prosopo/procaptcha-common@2.21.5
|
|
84
|
+
- @prosopo/api@4.7.3
|
|
85
|
+
|
|
3
86
|
## 2.21.4
|
|
4
87
|
### Patch Changes
|
|
5
88
|
|
|
@@ -10,6 +10,10 @@ export type AuthenticatedBadgeProps = {
|
|
|
10
10
|
callbacks: ProcaptchaCallbacks;
|
|
11
11
|
theme?: Theme;
|
|
12
12
|
labels?: AuthenticatedBadgeLabels;
|
|
13
|
+
invisible?: boolean;
|
|
14
|
+
widgetContainer?: HTMLElement;
|
|
15
|
+
expiresInMs: number;
|
|
16
|
+
restart: () => void;
|
|
13
17
|
};
|
|
14
18
|
export type AuthenticatedBadgeLabels = {
|
|
15
19
|
verifiedAgent: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticatedBadge.d.ts","sourceRoot":"","sources":["../src/authenticatedBadge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authenticatedBadge.d.ts","sourceRoot":"","sources":["../src/authenticatedBadge.ts"],"names":[],"mappings":"AA6BA,OAAO,EAEN,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,KAAK,EAAyB,MAAM,0BAA0B,CAAC;AAE7E,MAAM,MAAM,uBAAuB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AA2DF,eAAO,MAAM,uBAAuB,cACxB,WAAW,SACf,uBAAuB,KAC5B,eA2EF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement, createSvgElement, getDefaultEvents } from "@prosopo/procaptcha-common";
|
|
1
|
+
import { PROCAPTCHA_EXECUTE_EVENT, createElement, createSvgElement, getDefaultEvents } from "@prosopo/procaptcha-common";
|
|
2
2
|
import { ApiParams, CaptchaType, encodeProcaptchaOutput } from "@prosopo/types";
|
|
3
3
|
import { lightTheme, withAlpha } from "@prosopo/widget-skeleton";
|
|
4
4
|
//#region src/authenticatedBadge.ts
|
|
@@ -39,6 +39,7 @@ var buildTick = () => {
|
|
|
39
39
|
var mountAuthenticatedBadge = (container, props) => {
|
|
40
40
|
const { sessionId, agent, dapp, userAccount, provider, callbacks } = props;
|
|
41
41
|
const { palette } = props.theme ?? lightTheme;
|
|
42
|
+
const events = getDefaultEvents(callbacks);
|
|
42
43
|
const badge = createElement("div", {
|
|
43
44
|
style: {
|
|
44
45
|
display: "inline-flex",
|
|
@@ -56,24 +57,37 @@ var mountAuthenticatedBadge = (container, props) => {
|
|
|
56
57
|
attributes: { role: "status" },
|
|
57
58
|
children: [buildTick(), buildLabel(props.labels ?? DEFAULT_LABELS, agent)]
|
|
58
59
|
});
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
let expiryTimer;
|
|
61
|
+
const issueToken = () => {
|
|
62
|
+
const token = encodeProcaptchaOutput({
|
|
63
|
+
[ApiParams.providerUrl]: provider.provider.url,
|
|
64
|
+
[ApiParams.user]: userAccount.account.address,
|
|
65
|
+
[ApiParams.dapp]: dapp,
|
|
66
|
+
[ApiParams.commitmentId]: sessionId,
|
|
67
|
+
[ApiParams.timestamp]: Date.now().toString(),
|
|
68
|
+
[ApiParams.signature]: {
|
|
69
|
+
[ApiParams.provider]: {},
|
|
70
|
+
[ApiParams.user]: {}
|
|
71
|
+
},
|
|
72
|
+
[ApiParams.captchaType]: CaptchaType.authenticated
|
|
73
|
+
});
|
|
74
|
+
events.onHuman(token);
|
|
75
|
+
if (expiryTimer === void 0) expiryTimer = setTimeout(() => {
|
|
76
|
+
events.onExpired();
|
|
77
|
+
props.restart();
|
|
78
|
+
}, props.expiresInMs);
|
|
79
|
+
};
|
|
80
|
+
const executeTargets = [...props.widgetContainer ? [props.widgetContainer] : [], ...props.invisible ? [document] : []];
|
|
81
|
+
for (const target of executeTargets) target.addEventListener(PROCAPTCHA_EXECUTE_EVENT, issueToken);
|
|
82
|
+
if (!props.invisible) {
|
|
83
|
+
container.appendChild(badge);
|
|
84
|
+
issueToken();
|
|
85
|
+
}
|
|
74
86
|
return {
|
|
75
87
|
update: () => void 0,
|
|
76
88
|
destroy: () => {
|
|
89
|
+
clearTimeout(expiryTimer);
|
|
90
|
+
for (const target of executeTargets) target.removeEventListener(PROCAPTCHA_EXECUTE_EVENT, issueToken);
|
|
77
91
|
badge.parentNode?.removeChild(badge);
|
|
78
92
|
}
|
|
79
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticatedBadge.js","sourceRoot":"","sources":["../src/authenticatedBadge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authenticatedBadge.js","sourceRoot":"","sources":["../src/authenticatedBadge.ts"],"names":[],"mappings":"AA6BA,OAAO,EACN,wBAAwB,EAExB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEN,SAAS,EACT,WAAW,EAGX,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAc,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAuB7E,MAAM,cAAc,GAA6B;IAChD,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;CACjC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,KAAc,EAAU,EAAE;IAC9C,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,CAAC;QACJ,OAAO,IAA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B,OAAO,EAAE,GAAG,EAAE;YACb,YAAY,CAAC,WAAW,CAAC,CAAC;YAC1B,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;gBACrC,MAAM,CAAC,mBAAmB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;YAClE,CAAC;YACD,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QACtC,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -39,6 +39,7 @@ var buildTick = () => {
|
|
|
39
39
|
var mountAuthenticatedBadge = (container, props) => {
|
|
40
40
|
const { sessionId, agent, dapp, userAccount, provider, callbacks } = props;
|
|
41
41
|
const { palette } = props.theme ?? _prosopo_widget_skeleton.lightTheme;
|
|
42
|
+
const events = (0, _prosopo_procaptcha_common.getDefaultEvents)(callbacks);
|
|
42
43
|
const badge = (0, _prosopo_procaptcha_common.createElement)("div", {
|
|
43
44
|
style: {
|
|
44
45
|
display: "inline-flex",
|
|
@@ -56,24 +57,37 @@ var mountAuthenticatedBadge = (container, props) => {
|
|
|
56
57
|
attributes: { role: "status" },
|
|
57
58
|
children: [buildTick(), buildLabel(props.labels ?? DEFAULT_LABELS, agent)]
|
|
58
59
|
});
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
let expiryTimer;
|
|
61
|
+
const issueToken = () => {
|
|
62
|
+
const token = (0, _prosopo_types.encodeProcaptchaOutput)({
|
|
63
|
+
[_prosopo_types.ApiParams.providerUrl]: provider.provider.url,
|
|
64
|
+
[_prosopo_types.ApiParams.user]: userAccount.account.address,
|
|
65
|
+
[_prosopo_types.ApiParams.dapp]: dapp,
|
|
66
|
+
[_prosopo_types.ApiParams.commitmentId]: sessionId,
|
|
67
|
+
[_prosopo_types.ApiParams.timestamp]: Date.now().toString(),
|
|
68
|
+
[_prosopo_types.ApiParams.signature]: {
|
|
69
|
+
[_prosopo_types.ApiParams.provider]: {},
|
|
70
|
+
[_prosopo_types.ApiParams.user]: {}
|
|
71
|
+
},
|
|
72
|
+
[_prosopo_types.ApiParams.captchaType]: _prosopo_types.CaptchaType.authenticated
|
|
73
|
+
});
|
|
74
|
+
events.onHuman(token);
|
|
75
|
+
if (expiryTimer === void 0) expiryTimer = setTimeout(() => {
|
|
76
|
+
events.onExpired();
|
|
77
|
+
props.restart();
|
|
78
|
+
}, props.expiresInMs);
|
|
79
|
+
};
|
|
80
|
+
const executeTargets = [...props.widgetContainer ? [props.widgetContainer] : [], ...props.invisible ? [document] : []];
|
|
81
|
+
for (const target of executeTargets) target.addEventListener(_prosopo_procaptcha_common.PROCAPTCHA_EXECUTE_EVENT, issueToken);
|
|
82
|
+
if (!props.invisible) {
|
|
83
|
+
container.appendChild(badge);
|
|
84
|
+
issueToken();
|
|
85
|
+
}
|
|
74
86
|
return {
|
|
75
87
|
update: () => void 0,
|
|
76
88
|
destroy: () => {
|
|
89
|
+
clearTimeout(expiryTimer);
|
|
90
|
+
for (const target of executeTargets) target.removeEventListener(_prosopo_procaptcha_common.PROCAPTCHA_EXECUTE_EVENT, issueToken);
|
|
77
91
|
badge.parentNode?.removeChild(badge);
|
|
78
92
|
}
|
|
79
93
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_detectorLoader = require("./detectorLoader.cjs");
|
|
2
2
|
const require_detectorPrefetch = require("./detectorPrefetch.cjs");
|
|
3
|
+
let _prosopo_common = require("@prosopo/common");
|
|
3
4
|
let _prosopo_locale = require("@prosopo/locale");
|
|
4
5
|
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
5
6
|
let _prosopo_api = require("@prosopo/api");
|
|
6
|
-
let _prosopo_common = require("@prosopo/common");
|
|
7
7
|
//#region src/customDetectBot.ts
|
|
8
8
|
var ASSIGN_TIMEOUT_MS = 1e4;
|
|
9
9
|
var sanitiseHref = (href) => {
|
|
@@ -53,7 +53,11 @@ var withTimeout = async (promise, ms) => {
|
|
|
53
53
|
let timeoutId;
|
|
54
54
|
const timeoutPromise = new Promise((_, reject) => {
|
|
55
55
|
timeoutId = setTimeout(() => {
|
|
56
|
-
reject(new _prosopo_common.
|
|
56
|
+
reject(new _prosopo_common.ProsopoError({
|
|
57
|
+
code: "UNEXPECTED",
|
|
58
|
+
errorSite: "FRIC-1",
|
|
59
|
+
message: "Unknown API error"
|
|
60
|
+
}));
|
|
57
61
|
}, ms);
|
|
58
62
|
});
|
|
59
63
|
try {
|
|
@@ -66,7 +70,10 @@ var withTimeout = async (promise, ms) => {
|
|
|
66
70
|
}
|
|
67
71
|
};
|
|
68
72
|
var customDetectBot = async (config, container, restartFn, retryContext, refreshOf, switchToImage) => {
|
|
69
|
-
if (!config.account.address) throw new _prosopo_common.
|
|
73
|
+
if (!config.account.address) throw new _prosopo_common.ProsopoError({
|
|
74
|
+
code: "SITE_KEY_MISSING",
|
|
75
|
+
errorSite: "FRIC-2"
|
|
76
|
+
});
|
|
70
77
|
const ipMode = (0, _prosopo_procaptcha_common.pickIpMode)(config);
|
|
71
78
|
const extClassPromise = (0, _prosopo_procaptcha_common.ExtensionLoader)(config.web2);
|
|
72
79
|
const prefetched = !retryContext || retryContext.attempt <= 1 ? require_detectorPrefetch.takePrefetchedDetector(config.defaultEnvironment, ipMode, config.account.address) : void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/frictionlessResultGuard.ts
|
|
2
2
|
/**
|
|
3
|
-
* Error
|
|
3
|
+
* Error codes that describe the caller's situation rather than the provider's
|
|
4
4
|
* health, so re-rolling onto another provider would return the same answer.
|
|
5
5
|
*
|
|
6
6
|
* Two groups. Integration faults (site key, origin, captcha type) need the
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
* Anything outside this list is treated as the provider failing, not the
|
|
13
13
|
* caller: see {@link evaluateFrictionlessResult}.
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
15
|
+
var TERMINAL_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
16
|
+
"SITE_KEY_NOT_REGISTERED",
|
|
17
|
+
"SITE_KEY_INVALID",
|
|
18
|
+
"ORIGIN_NOT_ALLOWED",
|
|
19
|
+
"INCORRECT_CAPTCHA_TYPE",
|
|
20
|
+
"ACCESS_POLICY_BLOCK",
|
|
21
|
+
"ABUSER_BLOCKED",
|
|
22
|
+
"CRAWLER_BLOCKED",
|
|
23
|
+
"DATACENTER_BLOCKED",
|
|
24
|
+
"DISALLOWED_WEBVIEW",
|
|
25
|
+
"MOBILE_BLOCKED",
|
|
26
|
+
"PROXY_BLOCKED",
|
|
27
|
+
"SATELLITE_BLOCKED",
|
|
28
|
+
"TOR_BLOCKED",
|
|
29
|
+
"VPN_BLOCKED",
|
|
30
|
+
"FORBIDDEN",
|
|
31
|
+
"UNAUTHORIZED",
|
|
32
|
+
"NO_SESSION_FOUND"
|
|
33
33
|
]);
|
|
34
34
|
var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
|
|
35
35
|
/**
|
|
36
36
|
* Decide whether a `/frictionless` response is safe to mount an inner widget
|
|
37
37
|
* against.
|
|
38
38
|
*
|
|
39
|
-
* `result.error?.
|
|
39
|
+
* `result.error?.code` catches the well-formed error shape emitted when
|
|
40
40
|
* the provider surfaces a normal captcha error. A response with no
|
|
41
41
|
* `captchaType` is the other failure mode: request-time short-circuits
|
|
42
42
|
* (access-policy hard-block, decision-machine autoBan, domain / header
|
|
@@ -51,13 +51,19 @@ var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; h
|
|
|
51
51
|
* is frictionless-configured, so a direct pow call isn't allowed).
|
|
52
52
|
*/
|
|
53
53
|
var evaluateFrictionlessResult = (result) => {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const code = result.error?.code;
|
|
55
|
+
if (code) {
|
|
56
|
+
const errorId = result.error?.errorId ?? code;
|
|
57
|
+
const message = result.error?.message;
|
|
56
58
|
return {
|
|
57
59
|
kind: "error",
|
|
58
|
-
message:
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
message: message ?? errorId,
|
|
61
|
+
error: {
|
|
62
|
+
code,
|
|
63
|
+
errorId,
|
|
64
|
+
...message !== void 0 && { message }
|
|
65
|
+
},
|
|
66
|
+
retryable: !TERMINAL_ERROR_CODES.has(code)
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
if (!result.captchaType) return {
|