@prosopo/procaptcha-frictionless 2.13.7 → 2.13.9
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 +6 -5
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +6 -5
- package/CHANGELOG.md +69 -0
- package/dist/ProcaptchaFrictionless.d.ts.map +1 -1
- package/dist/ProcaptchaFrictionless.js +6 -4
- package/dist/ProcaptchaFrictionless.js.map +1 -1
- package/dist/cjs/ProcaptchaFrictionless.cjs +6 -4
- package/dist/cjs/frictionlessResultGuard.cjs +35 -0
- package/dist/frictionlessResultGuard.d.ts +18 -0
- package/dist/frictionlessResultGuard.d.ts.map +1 -0
- package/dist/frictionlessResultGuard.js +34 -0
- package/dist/frictionlessResultGuard.js.map +1 -0
- package/dist/tests/frictionlessResultGuard.test.d.ts +2 -0
- package/dist/tests/frictionlessResultGuard.test.d.ts.map +1 -0
- package/dist/tests/frictionlessResultGuard.test.js +53 -0
- package/dist/tests/frictionlessResultGuard.test.js.map +1 -0
- package/package.json +8 -8
- package/src/ProcaptchaFrictionless.tsx +6 -4
- package/src/frictionlessResultGuard.ts +64 -0
- package/src/tests/frictionlessResultGuard.test.ts +104 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.9 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -26,6 +26,7 @@ ViteCommonJSConfig: .
|
|
|
26
26
|
'/home/runner/work/captcha/captcha/packages/datasets/tsconfig.json'
|
|
27
27
|
]
|
|
28
28
|
}
|
|
29
|
+
[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
|
|
29
30
|
{
|
|
30
31
|
externals: [
|
|
31
32
|
'@prosopo/locale',
|
|
@@ -49,18 +50,18 @@ ViteCommonJSConfig: .
|
|
|
49
50
|
'@prosopo/datasets'
|
|
50
51
|
]
|
|
51
52
|
}
|
|
52
|
-
[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
|
|
53
53
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
54
54
|
Bundle build started
|
|
55
55
|
[2K
|
|
56
|
-
✓
|
|
56
|
+
✓ 8 modules transformed.
|
|
57
57
|
rendering chunks...
|
|
58
58
|
computing gzip size...
|
|
59
59
|
dist/cjs/index.cjs 0.54 kB │ gzip: 0.21 kB
|
|
60
60
|
dist/cjs/detectorLoader.cjs 0.62 kB │ gzip: 0.40 kB
|
|
61
|
+
dist/cjs/frictionlessResultGuard.cjs 1.55 kB │ gzip: 0.80 kB
|
|
61
62
|
dist/cjs/sessionInvalidatedRecovery.cjs 2.07 kB │ gzip: 0.99 kB
|
|
62
63
|
dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
|
|
63
64
|
dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
|
|
64
|
-
dist/cjs/ProcaptchaFrictionless.cjs 7.
|
|
65
|
+
dist/cjs/ProcaptchaFrictionless.cjs 7.14 kB │ gzip: 2.06 kB
|
|
65
66
|
|
|
66
|
-
[32m✓ built in
|
|
67
|
+
[32m✓ built in 62ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.9 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
3:55:59 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
@@ -25,47 +25,47 @@
|
|
|
25
25
|
* ../procaptcha-react/tsconfig.json
|
|
26
26
|
* tsconfig.json
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
3:55:59 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'
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
3:55:59 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
3:55:59 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
3:55:59 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'
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
3:55:59 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'
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
3:55:59 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
3:55:59 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
3:55:59 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/objectUtils.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
3:55:59 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
3:55:59 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
3:55:59 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'
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
3:55:59 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/index.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
3:55:59 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
3:55:59 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/workers/cryptoWorker.ts' is older than output '../account/tsconfig.tsbuildinfo'
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
3:55:59 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/extensionLoader.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
3:55:59 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/index.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
3:55:59 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
3:55:59 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/dataset.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
3:55:59 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/index.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
3:55:59 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/captchaComponent.unit.test.tsx' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
3:55:59 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
3:55:59 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
|
|
71
71
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
2
|
+
> @prosopo/procaptcha-frictionless@2.13.9 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/procaptcha-frictionless@2.13.
|
|
6
|
+
> @prosopo/procaptcha-frictionless@2.13.9 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -57,15 +57,16 @@ ViteEsmConfig: .
|
|
|
57
57
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
58
58
|
Bundle build started
|
|
59
59
|
[2K
|
|
60
|
-
✓
|
|
60
|
+
✓ 8 modules transformed.
|
|
61
61
|
rendering chunks...
|
|
62
62
|
computing gzip size...
|
|
63
63
|
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
64
64
|
dist/index.js 0.32 kB │ gzip: 0.15 kB
|
|
65
65
|
dist/detectorLoader.js 0.60 kB │ gzip: 0.39 kB
|
|
66
|
+
dist/frictionlessResultGuard.js 1.48 kB │ gzip: 0.80 kB
|
|
66
67
|
dist/sessionInvalidatedRecovery.js 2.01 kB │ gzip: 0.98 kB
|
|
67
68
|
dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
|
|
68
69
|
dist/customDetectBot.js 5.37 kB │ gzip: 1.67 kB
|
|
69
|
-
dist/ProcaptchaFrictionless.js 6.
|
|
70
|
+
dist/ProcaptchaFrictionless.js 6.59 kB │ gzip: 2.02 kB
|
|
70
71
|
|
|
71
|
-
[32m✓ built in
|
|
72
|
+
[32m✓ built in 61ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @prosopo/procaptcha-frictionless
|
|
2
2
|
|
|
3
|
+
## 2.13.9
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 1214dd3: Two related fixes for the residual `INCORRECT_CAPTCHA_TYPE` class of
|
|
7
|
+
400s on frictionless-configured sitekeys.
|
|
8
|
+
|
|
9
|
+
**Server — request-time trafficFilter no longer blocks.** Move `block`
|
|
10
|
+
enforcement back to submit / verify time (via
|
|
11
|
+
`resolveTrafficFilterCheck` in the PoW / image / puzzle task classes).
|
|
12
|
+
`applyTrafficFilterAtRequestTime` now returns only `pass` or
|
|
13
|
+
`challenge` — a `challenge` match still overrides captchaType /
|
|
14
|
+
powDifficulty / solvedImagesCount / puzzleTolerance at request time,
|
|
15
|
+
but a `block` match never short-circuits with 401. This restores the
|
|
16
|
+
pre-#3045 behaviour that blocked interactions still complete a solve
|
|
17
|
+
so they bill. Without this the operator's own trafficFilter policies
|
|
18
|
+
became widget-mount failures that cascaded into
|
|
19
|
+
`INCORRECT_CAPTCHA_TYPE` (~865/hr fleet-wide, concentrated on a
|
|
20
|
+
handful of sitekeys whose trafficFilter blocks datacenter / proxy).
|
|
21
|
+
|
|
22
|
+
**Widget — defensive guard for malformed `/frictionless` responses.**
|
|
23
|
+
Extract `evaluateFrictionlessResult` in `procaptcha-frictionless` and
|
|
24
|
+
halt when the response carries no `captchaType`. The previous flow
|
|
25
|
+
fell through into a default `ProcaptchaPow` mount with an undefined
|
|
26
|
+
`sessionId` on any bare-string 401 body (`{ "error": "Unauthorized" }`)
|
|
27
|
+
— the shape emitted by access-policy hard-block, decision-machine
|
|
28
|
+
autoBan, and domain / header middleware. `HttpClientBase` does not
|
|
29
|
+
throw on 4xx JSON so the widget receives these as valid-looking
|
|
30
|
+
`GetFrictionlessCaptchaResponse` and its `error.message` check misses.
|
|
31
|
+
The provider then rejects the fall-through `/captcha/pow` call as
|
|
32
|
+
`INCORRECT_CAPTCHA_TYPE` because the sitekey is
|
|
33
|
+
frictionless-configured.
|
|
34
|
+
|
|
35
|
+
**Rate-limits config fix.** Adds the missing `AdminApiPaths.GetSession`
|
|
36
|
+
entry to `getRateLimitConfig()` in `@prosopo/cli` — introduced
|
|
37
|
+
alongside the `/admin/session/get` diagnostic endpoint but never wired
|
|
38
|
+
into the CLI's rate-limit table, which broke `npm run setup` under
|
|
39
|
+
`ProsopoConfigSchema.parse`.
|
|
40
|
+
|
|
41
|
+
Unit and integration coverage: request-time `block` matches now
|
|
42
|
+
assert `pass` in `trafficFilterHierarchy.integration.test.ts` and
|
|
43
|
+
`trafficFilterRequestTime.unit.test.ts`; new unit coverage on
|
|
44
|
+
`captchaManager.resolveTrafficFilterCheck` locks in that datacenter
|
|
45
|
+
`block` still fires at verify (billing intact), datacenter `challenge`
|
|
46
|
+
doesn't (it's a request-time concern only), and the abuser default
|
|
47
|
+
still applies at verify for unconfigured sites. New
|
|
48
|
+
`evaluateFrictionlessResult` unit tests exercise the widget guard, and
|
|
49
|
+
a `frictionlessNoCaptchaTypeCascade.cy.ts` cypress spec forces the
|
|
50
|
+
bare-string 401 via `cy.intercept` and asserts no `/captcha/pow`
|
|
51
|
+
follows.
|
|
52
|
+
- Updated dependencies [ee5d250]
|
|
53
|
+
- @prosopo/types@5.1.2
|
|
54
|
+
- @prosopo/api@4.0.7
|
|
55
|
+
- @prosopo/procaptcha-common@2.11.27
|
|
56
|
+
- @prosopo/procaptcha-pow@2.10.34
|
|
57
|
+
- @prosopo/procaptcha-puzzle@2.10.50
|
|
58
|
+
- @prosopo/procaptcha-react@2.9.107
|
|
59
|
+
|
|
60
|
+
## 2.13.8
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [2a07421]
|
|
64
|
+
- Updated dependencies [cec44bb]
|
|
65
|
+
- @prosopo/procaptcha-puzzle@2.10.49
|
|
66
|
+
- @prosopo/types@5.1.1
|
|
67
|
+
- @prosopo/api@4.0.6
|
|
68
|
+
- @prosopo/procaptcha-common@2.11.26
|
|
69
|
+
- @prosopo/procaptcha-pow@2.10.33
|
|
70
|
+
- @prosopo/procaptcha-react@2.9.106
|
|
71
|
+
|
|
3
72
|
## 2.13.7
|
|
4
73
|
### Patch Changes
|
|
5
74
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,2BAA2B,EAChC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProcaptchaFrictionless.d.ts","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAKN,KAAK,2BAA2B,EAChC,MAAM,gBAAgB,CAAC;AA2DxB,eAAO,MAAM,sBAAsB,gEAOhC,2BAA2B,4CAyR7B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import customDetectBot from "./customDetectBot.js";
|
|
2
|
+
import { evaluateFrictionlessResult } from "./frictionlessResultGuard.js";
|
|
2
3
|
import { consumeRetryMountProps, handleSessionInvalidated } from "./sessionInvalidatedRecovery.js";
|
|
3
4
|
import { loadI18next } from "@prosopo/locale";
|
|
4
5
|
import { Checkbox, TestModeBanner, getDefaultEvents, isSecureBrowserContext, providerRetry } from "@prosopo/procaptcha-common";
|
|
@@ -118,14 +119,15 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = cu
|
|
|
118
119
|
await providerRetry(async () => {
|
|
119
120
|
stateRef.current.attemptCount += 1;
|
|
120
121
|
const result = await detectBot(ProcaptchaConfigSchema.parse(config), container, restart, { attempt: stateRef.current.attemptCount });
|
|
121
|
-
|
|
122
|
+
const guard = evaluateFrictionlessResult(result);
|
|
123
|
+
if (guard.kind === "error") {
|
|
122
124
|
stateRef.current = {
|
|
123
125
|
...stateRef.current,
|
|
124
126
|
loading: false,
|
|
125
|
-
errorMessage:
|
|
127
|
+
errorMessage: guard.message
|
|
126
128
|
};
|
|
127
|
-
events.onError(new Error(
|
|
128
|
-
fallOverWithStyle(
|
|
129
|
+
events.onError(new Error(guard.message));
|
|
130
|
+
fallOverWithStyle(guard.message, guard.key);
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
131
133
|
const frictionlessState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcaptchaFrictionless.js","sourceRoot":"","sources":["../src/ProcaptchaFrictionless.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACN,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,WAAW,EAGX,sBAAsB,GAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EA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AC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,GAAI,EACzD,iBAAiB,IAChB,CACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_customDetectBot = require("./customDetectBot.cjs");
|
|
2
|
+
const require_frictionlessResultGuard = require("./frictionlessResultGuard.cjs");
|
|
2
3
|
const require_sessionInvalidatedRecovery = require("./sessionInvalidatedRecovery.cjs");
|
|
3
4
|
let _prosopo_locale = require("@prosopo/locale");
|
|
4
5
|
let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
|
|
@@ -118,14 +119,15 @@ var ProcaptchaFrictionless = ({ config, callbacks, restart, i18n, detectBot = re
|
|
|
118
119
|
await (0, _prosopo_procaptcha_common.providerRetry)(async () => {
|
|
119
120
|
stateRef.current.attemptCount += 1;
|
|
120
121
|
const result = await detectBot(_prosopo_types.ProcaptchaConfigSchema.parse(config), container, restart, { attempt: stateRef.current.attemptCount });
|
|
121
|
-
|
|
122
|
+
const guard = require_frictionlessResultGuard.evaluateFrictionlessResult(result);
|
|
123
|
+
if (guard.kind === "error") {
|
|
122
124
|
stateRef.current = {
|
|
123
125
|
...stateRef.current,
|
|
124
126
|
loading: false,
|
|
125
|
-
errorMessage:
|
|
127
|
+
errorMessage: guard.message
|
|
126
128
|
};
|
|
127
|
-
events.onError(new Error(
|
|
128
|
-
fallOverWithStyle(
|
|
129
|
+
events.onError(new Error(guard.message));
|
|
130
|
+
fallOverWithStyle(guard.message, guard.key);
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
131
133
|
const frictionlessState = {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/frictionlessResultGuard.ts
|
|
2
|
+
var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
|
|
3
|
+
/**
|
|
4
|
+
* Decide whether a `/frictionless` response is safe to mount an inner widget
|
|
5
|
+
* against.
|
|
6
|
+
*
|
|
7
|
+
* `result.error?.message` catches the well-formed error shape emitted when
|
|
8
|
+
* the provider surfaces a normal captcha error. A response with no
|
|
9
|
+
* `captchaType` is the other failure mode: request-time short-circuits
|
|
10
|
+
* (access-policy hard-block, decision-machine autoBan, domain / header
|
|
11
|
+
* middleware rejections) emit a bare-string `{ error: "..." }` that does
|
|
12
|
+
* not conform to `GetFrictionlessCaptchaResponse` but that
|
|
13
|
+
* `HttpClientBase` returns verbatim because it does not throw on 4xx JSON.
|
|
14
|
+
*
|
|
15
|
+
* Without the missing-captchaType branch the caller falls through to
|
|
16
|
+
* `renderForCaptchaType(undefined, ...)` — the default arm mounts
|
|
17
|
+
* ProcaptchaPow, which then calls `/captcha/pow` with an undefined
|
|
18
|
+
* sessionId and gets rejected as API.INCORRECT_CAPTCHA_TYPE (the sitekey
|
|
19
|
+
* is frictionless-configured, so a direct pow call isn't allowed).
|
|
20
|
+
*/
|
|
21
|
+
var evaluateFrictionlessResult = (result) => {
|
|
22
|
+
if (result.error?.message) return {
|
|
23
|
+
kind: "error",
|
|
24
|
+
message: result.error.message,
|
|
25
|
+
...result.error.key !== void 0 && { key: result.error.key }
|
|
26
|
+
};
|
|
27
|
+
if (!result.captchaType) return {
|
|
28
|
+
kind: "error",
|
|
29
|
+
message: MISSING_CAPTCHA_TYPE_MESSAGE
|
|
30
|
+
};
|
|
31
|
+
return { kind: "pass" };
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.MISSING_CAPTCHA_TYPE_MESSAGE = MISSING_CAPTCHA_TYPE_MESSAGE;
|
|
35
|
+
exports.evaluateFrictionlessResult = evaluateFrictionlessResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type FrictionlessGuardOutcome = {
|
|
2
|
+
kind: "pass";
|
|
3
|
+
} | {
|
|
4
|
+
kind: "error";
|
|
5
|
+
message: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
export type FrictionlessGuardInput = {
|
|
9
|
+
captchaType?: string;
|
|
10
|
+
error?: {
|
|
11
|
+
message?: string;
|
|
12
|
+
key?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
|
|
16
|
+
export declare const evaluateFrictionlessResult: (result: FrictionlessGuardInput) => FrictionlessGuardOutcome;
|
|
17
|
+
export { MISSING_CAPTCHA_TYPE_MESSAGE };
|
|
18
|
+
//# sourceMappingURL=frictionlessResultGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionlessResultGuard.d.ts","sourceRoot":"","sources":["../src/frictionlessResultGuard.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,wBAAwB,GACjC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAKpD,MAAM,MAAM,sBAAsB,GAAG;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC;AAEF,QAAA,MAAM,4BAA4B,qEACiC,CAAC;AAoBpE,eAAO,MAAM,0BAA0B,WAC9B,sBAAsB,KAC5B,wBAYF,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/frictionlessResultGuard.ts
|
|
2
|
+
var MISSING_CAPTCHA_TYPE_MESSAGE = "Frictionless response missing captchaType; halting captcha mount";
|
|
3
|
+
/**
|
|
4
|
+
* Decide whether a `/frictionless` response is safe to mount an inner widget
|
|
5
|
+
* against.
|
|
6
|
+
*
|
|
7
|
+
* `result.error?.message` catches the well-formed error shape emitted when
|
|
8
|
+
* the provider surfaces a normal captcha error. A response with no
|
|
9
|
+
* `captchaType` is the other failure mode: request-time short-circuits
|
|
10
|
+
* (access-policy hard-block, decision-machine autoBan, domain / header
|
|
11
|
+
* middleware rejections) emit a bare-string `{ error: "..." }` that does
|
|
12
|
+
* not conform to `GetFrictionlessCaptchaResponse` but that
|
|
13
|
+
* `HttpClientBase` returns verbatim because it does not throw on 4xx JSON.
|
|
14
|
+
*
|
|
15
|
+
* Without the missing-captchaType branch the caller falls through to
|
|
16
|
+
* `renderForCaptchaType(undefined, ...)` — the default arm mounts
|
|
17
|
+
* ProcaptchaPow, which then calls `/captcha/pow` with an undefined
|
|
18
|
+
* sessionId and gets rejected as API.INCORRECT_CAPTCHA_TYPE (the sitekey
|
|
19
|
+
* is frictionless-configured, so a direct pow call isn't allowed).
|
|
20
|
+
*/
|
|
21
|
+
var evaluateFrictionlessResult = (result) => {
|
|
22
|
+
if (result.error?.message) return {
|
|
23
|
+
kind: "error",
|
|
24
|
+
message: result.error.message,
|
|
25
|
+
...result.error.key !== void 0 && { key: result.error.key }
|
|
26
|
+
};
|
|
27
|
+
if (!result.captchaType) return {
|
|
28
|
+
kind: "error",
|
|
29
|
+
message: MISSING_CAPTCHA_TYPE_MESSAGE
|
|
30
|
+
};
|
|
31
|
+
return { kind: "pass" };
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { MISSING_CAPTCHA_TYPE_MESSAGE, evaluateFrictionlessResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionlessResultGuard.js","sourceRoot":"","sources":["../src/frictionlessResultGuard.ts"],"names":[],"mappings":"AA0BA,MAAM,4BAA4B,GACjC,kEAAkE,CAAC;AAoBpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACzC,MAA8B,EACH,EAAE;IAC7B,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAC3B,OAAO;YACN,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;YAC7B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;SAChE,CAAC;IACH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACzB,CAAC,CAAC;AAEF,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionlessResultGuard.test.d.ts","sourceRoot":"","sources":["../../src/tests/frictionlessResultGuard.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { MISSING_CAPTCHA_TYPE_MESSAGE, evaluateFrictionlessResult, } from "../frictionlessResultGuard.js";
|
|
3
|
+
describe("evaluateFrictionlessResult", () => {
|
|
4
|
+
it("passes a well-formed response with a captchaType", () => {
|
|
5
|
+
expect(evaluateFrictionlessResult({
|
|
6
|
+
captchaType: "pow",
|
|
7
|
+
})).toEqual({ kind: "pass" });
|
|
8
|
+
});
|
|
9
|
+
it("passes when a captchaType is present even if error is a bare undefined", () => {
|
|
10
|
+
expect(evaluateFrictionlessResult({
|
|
11
|
+
captchaType: "image",
|
|
12
|
+
error: undefined,
|
|
13
|
+
})).toEqual({ kind: "pass" });
|
|
14
|
+
});
|
|
15
|
+
it("returns a structured error when the server emits `{ error: { message } }`", () => {
|
|
16
|
+
expect(evaluateFrictionlessResult({
|
|
17
|
+
captchaType: "pow",
|
|
18
|
+
error: { message: "Boom", key: "API.SOMETHING" },
|
|
19
|
+
})).toEqual({ kind: "error", message: "Boom", key: "API.SOMETHING" });
|
|
20
|
+
});
|
|
21
|
+
it("omits key from the outcome when the server error carries no key", () => {
|
|
22
|
+
const outcome = evaluateFrictionlessResult({
|
|
23
|
+
captchaType: "pow",
|
|
24
|
+
error: { message: "Boom" },
|
|
25
|
+
});
|
|
26
|
+
expect(outcome.kind).toBe("error");
|
|
27
|
+
if (outcome.kind !== "error")
|
|
28
|
+
throw new Error("expected error outcome");
|
|
29
|
+
expect(outcome.message).toBe("Boom");
|
|
30
|
+
expect("key" in outcome).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it("halts when captchaType is missing (bare-string 401 body shape from access-policy / autoBan / middleware)", () => {
|
|
33
|
+
expect(evaluateFrictionlessResult({
|
|
34
|
+
error: undefined,
|
|
35
|
+
})).toEqual({ kind: "error", message: MISSING_CAPTCHA_TYPE_MESSAGE });
|
|
36
|
+
});
|
|
37
|
+
it("halts when both captchaType and error are absent (opaque parse failure)", () => {
|
|
38
|
+
expect(evaluateFrictionlessResult({})).toEqual({
|
|
39
|
+
kind: "error",
|
|
40
|
+
message: MISSING_CAPTCHA_TYPE_MESSAGE,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
it("prefers the structured error over the missing-captchaType message when both apply", () => {
|
|
44
|
+
expect(evaluateFrictionlessResult({
|
|
45
|
+
error: { message: "Server error", key: "API.SERVER_ERROR" },
|
|
46
|
+
})).toEqual({
|
|
47
|
+
kind: "error",
|
|
48
|
+
message: "Server error",
|
|
49
|
+
key: "API.SERVER_ERROR",
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=frictionlessResultGuard.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frictionlessResultGuard.test.js","sourceRoot":"","sources":["../../src/tests/frictionlessResultGuard.test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,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AC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0GAA0G,EAAE,GAAG,EAAE;QAOnH,MAAM,CACL,0BAA0B,CAAC;YAG1B,KAAK,EAAE,SAAS;SAChB,CAAC,CACF,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QAClF,MAAM,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAC9C,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,4BAA4B;SACrC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mFAAmF,EAAE,GAAG,EAAE;QAG5F,MAAM,CACL,0BAA0B,CAAC;YAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,kBAAkB,EAAE;SAC3D,CAAC,CACF,CAAC,OAAO,CAAC;YACT,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,cAAc;YACvB,GAAG,EAAE,kBAAkB;SACvB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prosopo/procaptcha-frictionless",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.9",
|
|
4
4
|
"author": "PROSOPO LIMITED <info@prosopo.io>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"browserslist": ["> 0.5%, last 2 versions, not dead"],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@prosopo/api": "4.0.
|
|
33
|
+
"@prosopo/api": "4.0.7",
|
|
34
34
|
"@prosopo/common": "3.1.50",
|
|
35
35
|
"@prosopo/locale": "3.3.0",
|
|
36
|
-
"@prosopo/procaptcha-common": "2.11.
|
|
37
|
-
"@prosopo/procaptcha-pow": "2.10.
|
|
38
|
-
"@prosopo/procaptcha-puzzle": "2.10.
|
|
39
|
-
"@prosopo/procaptcha-react": "2.9.
|
|
40
|
-
"@prosopo/types": "5.1.
|
|
36
|
+
"@prosopo/procaptcha-common": "2.11.27",
|
|
37
|
+
"@prosopo/procaptcha-pow": "2.10.34",
|
|
38
|
+
"@prosopo/procaptcha-puzzle": "2.10.50",
|
|
39
|
+
"@prosopo/procaptcha-react": "2.9.107",
|
|
40
|
+
"@prosopo/types": "5.1.2",
|
|
41
41
|
"@prosopo/widget-skeleton": "2.8.6",
|
|
42
42
|
"dotenv": "16.4.5",
|
|
43
43
|
"react": "18.3.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@prosopo/config": "3.3.
|
|
46
|
+
"@prosopo/config": "3.3.9",
|
|
47
47
|
"@types/node": "22.10.2",
|
|
48
48
|
"@vitest/coverage-v8": "4.1.10",
|
|
49
49
|
"concurrently": "9.0.1",
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
import { darkTheme, lightTheme } from "@prosopo/widget-skeleton";
|
|
31
31
|
import { useEffect, useRef, useState } from "react";
|
|
32
32
|
import customDetectBot from "./customDetectBot.js";
|
|
33
|
+
import { evaluateFrictionlessResult } from "./frictionlessResultGuard.js";
|
|
33
34
|
import {
|
|
34
35
|
type RetryCoords,
|
|
35
36
|
consumeRetryMountProps,
|
|
@@ -293,14 +294,15 @@ export const ProcaptchaFrictionless = ({
|
|
|
293
294
|
attempt: stateRef.current.attemptCount,
|
|
294
295
|
});
|
|
295
296
|
|
|
296
|
-
|
|
297
|
+
const guard = evaluateFrictionlessResult(result);
|
|
298
|
+
if (guard.kind === "error") {
|
|
297
299
|
stateRef.current = {
|
|
298
300
|
...stateRef.current,
|
|
299
301
|
loading: false,
|
|
300
|
-
errorMessage:
|
|
302
|
+
errorMessage: guard.message,
|
|
301
303
|
};
|
|
302
|
-
events.onError(new Error(
|
|
303
|
-
fallOverWithStyle(
|
|
304
|
+
events.onError(new Error(guard.message));
|
|
305
|
+
fallOverWithStyle(guard.message, guard.key);
|
|
304
306
|
return;
|
|
305
307
|
}
|
|
306
308
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright 2021-2026 Prosopo (UK) Ltd.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
export type FrictionlessGuardOutcome =
|
|
16
|
+
| { kind: "pass" }
|
|
17
|
+
| { kind: "error"; message: string; key?: string };
|
|
18
|
+
|
|
19
|
+
// Fields the guard reads off the `/frictionless` result. Kept minimal
|
|
20
|
+
// (subset of BotDetectionFunctionResult) so the helper can be exercised
|
|
21
|
+
// without pulling in the full widget config surface.
|
|
22
|
+
export type FrictionlessGuardInput = {
|
|
23
|
+
captchaType?: string;
|
|
24
|
+
error?: { message?: string; key?: string };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const MISSING_CAPTCHA_TYPE_MESSAGE =
|
|
28
|
+
"Frictionless response missing captchaType; halting captcha mount";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Decide whether a `/frictionless` response is safe to mount an inner widget
|
|
32
|
+
* against.
|
|
33
|
+
*
|
|
34
|
+
* `result.error?.message` catches the well-formed error shape emitted when
|
|
35
|
+
* the provider surfaces a normal captcha error. A response with no
|
|
36
|
+
* `captchaType` is the other failure mode: request-time short-circuits
|
|
37
|
+
* (access-policy hard-block, decision-machine autoBan, domain / header
|
|
38
|
+
* middleware rejections) emit a bare-string `{ error: "..." }` that does
|
|
39
|
+
* not conform to `GetFrictionlessCaptchaResponse` but that
|
|
40
|
+
* `HttpClientBase` returns verbatim because it does not throw on 4xx JSON.
|
|
41
|
+
*
|
|
42
|
+
* Without the missing-captchaType branch the caller falls through to
|
|
43
|
+
* `renderForCaptchaType(undefined, ...)` — the default arm mounts
|
|
44
|
+
* ProcaptchaPow, which then calls `/captcha/pow` with an undefined
|
|
45
|
+
* sessionId and gets rejected as API.INCORRECT_CAPTCHA_TYPE (the sitekey
|
|
46
|
+
* is frictionless-configured, so a direct pow call isn't allowed).
|
|
47
|
+
*/
|
|
48
|
+
export const evaluateFrictionlessResult = (
|
|
49
|
+
result: FrictionlessGuardInput,
|
|
50
|
+
): FrictionlessGuardOutcome => {
|
|
51
|
+
if (result.error?.message) {
|
|
52
|
+
return {
|
|
53
|
+
kind: "error",
|
|
54
|
+
message: result.error.message,
|
|
55
|
+
...(result.error.key !== undefined && { key: result.error.key }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (!result.captchaType) {
|
|
59
|
+
return { kind: "error", message: MISSING_CAPTCHA_TYPE_MESSAGE };
|
|
60
|
+
}
|
|
61
|
+
return { kind: "pass" };
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { MISSING_CAPTCHA_TYPE_MESSAGE };
|