@prosopo/procaptcha-frictionless 2.13.1 → 2.13.3

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.13.1 build:cjs
2
+ > @prosopo/procaptcha-frictionless@2.13.3 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -60,7 +60,7 @@ 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
61
  dist/cjs/sessionInvalidatedRecovery.cjs 2.07 kB │ gzip: 0.99 kB
62
62
  dist/cjs/detectorPrefetch.cjs 2.98 kB │ gzip: 1.35 kB
63
- dist/cjs/customDetectBot.cjs 5.50 kB │ gzip: 1.67 kB
63
+ dist/cjs/customDetectBot.cjs 5.55 kB │ gzip: 1.70 kB
64
64
  dist/cjs/ProcaptchaFrictionless.cjs 7.00 kB │ gzip: 2.02 kB
65
65
 
66
- ✓ built in 44ms
66
+ ✓ built in 56ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.13.1 build:tsc
2
+ > @prosopo/procaptcha-frictionless@2.13.3 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 12:44:41 PM - Projects in this build:
5
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
28
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
30
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
32
+ 9:45:56 AM - 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
- 12:44:41 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
+ 9:45:56 AM - 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
- 12:44:41 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
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
38
+ 9:45:56 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/tests/apiHarness.ts' is older than output '../api/tsconfig.tsbuildinfo'
39
39
 
40
- 12:44:41 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
40
+ 9:45:56 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/logger.ts' is older than output '../logger/tsconfig.tsbuildinfo'
41
41
 
42
- 12:44:41 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
42
+ 9:45:56 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/batches.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
43
43
 
44
- 12:44:41 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
44
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
46
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/index.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
48
+ 9:45:56 AM - 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
- 12:44:41 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'
50
+ 9:45:56 AM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/constants.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
51
51
 
52
- 12:44:41 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/pair/decode.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
52
+ 9:45:56 AM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.test.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
53
53
 
54
- 12:44:41 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
54
+ 9:45:56 AM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/custom.d.ts' is older than output '../account/tsconfig.tsbuildinfo'
55
55
 
56
- 12:44:41 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'
56
+ 9:45:56 AM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/defaultEvents.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
57
57
 
58
- 12:44:41 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/manager.unit.test.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
58
+ 9:45:56 AM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/tests/managerHarness.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
59
59
 
60
- 12:44:41 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'
60
+ 9:45:56 AM - 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
- 12:44:41 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/mocks/data/captchas.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
62
+ 9:45:56 AM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/index.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
63
63
 
64
- 12:44:41 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
64
+ 9:45:56 AM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/modules/Manager.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
65
65
 
66
- 12:44:41 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/tests/procaptcha.unit.test.tsx' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
66
+ 9:45:56 AM - 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
- 12:44:41 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
68
+ 9:45:56 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
69
69
 
70
- 12:44:41 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
70
+ 9:45:56 AM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
71
71
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.13.1 build
2
+ > @prosopo/procaptcha-frictionless@2.13.3 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-frictionless@2.13.1 build:cross-env
6
+ > @prosopo/procaptcha-frictionless@2.13.3 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -65,7 +65,7 @@ dist/index.js 0.32 kB │ gzip: 0.15 kB
65
65
  dist/detectorLoader.js 0.60 kB │ gzip: 0.39 kB
66
66
  dist/sessionInvalidatedRecovery.js 2.01 kB │ gzip: 0.98 kB
67
67
  dist/detectorPrefetch.js 2.86 kB │ gzip: 1.32 kB
68
- dist/customDetectBot.js 5.33 kB │ gzip: 1.65 kB
68
+ dist/customDetectBot.js 5.37 kB │ gzip: 1.67 kB
69
69
  dist/ProcaptchaFrictionless.js 6.49 kB │ gzip: 1.97 kB
70
70
 
71
- ✓ built in 45ms
71
+ ✓ built in 56ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.13.3
4
+ ### Patch Changes
5
+
6
+ - 3a77cea: Report why the detector was unavailable instead of swallowing it.
7
+
8
+ `customDetectBot` wraps provider selection, the assign request and the blob-URL
9
+ import in one `try`, and the `catch` was empty. Falling back is correct — there
10
+ is no bundled detector, so a failure here means the frictionless POST goes out
11
+ with an empty token and the provider decides what to serve. But the reasons are
12
+ not equal: a slow network is routine, whereas a pool bundle that throws on
13
+ import degrades **every** session on that provider to an image captcha, with
14
+ nothing in the client console or the provider logs to say why.
15
+
16
+ That is not hypothetical. A detector pool built at catcher 3.1.48 emitted
17
+ bundles that died on evaluation with `Class constructor D cannot be invoked
18
+ without 'new'` — an obfuscator seed collision that renamed a class over a live
19
+ binding. Every staging session silently fell back to an image captcha, and the
20
+ only way to find it was to reproduce the blob import by hand in a browser: the
21
+ provider logged a healthy `bundle pool loaded count=20` and served the bundles
22
+ happily, because from its side nothing had failed.
23
+
24
+ The catch stays broad and the fallback is unchanged; it now `console.error`s
25
+ what it caught, matching how the sibling `procaptcha-common` modules report.
26
+
27
+ ## 2.13.2
28
+ ### Patch Changes
29
+
30
+ - 5d60541: Stop dropping detector bundles that arrive slowly, which made the frictionless POST go out with an empty token and no `detectorSessionId` — the provider then scored the session at 0 and served a challenge.
31
+
32
+ `ASSIGN_TIMEOUT_MS` was 2000 ms and covered two legs. The assign POST serves the detector inline (~215 KB gzipped) over a connection that is always cold, because `/healthz` pins a different hostname than the assign target: fresh DNS, TLS and a CORS preflight all had to fit in the budget alongside the download, measured at 6.7s against staging. The cap is now 10 s and applies only to that request; the blob-URL import that parses and evaluates the bundle is untimed, since a timer cannot rescue a stalled main thread and only discards a bundle already in hand.
33
+
34
+ `render()` and the invisible-button path now start the detector prefetch too. Only implicit render did, so pages using the explicit API — including any page that loads the bundle via dynamic import, where implicit render never runs — assigned a detector inline on the widget's critical path with no prefetch to fall back on.
35
+ - 2aabe73: Remove the client-controlled `detectorUnavailable` frictionless bypass. A client could set the flag and be handed a PoW challenge without any detection running. The flag is gone from the wire format, the API client and the widget; the only remaining bypasses are provider-side (maintenance mode, empty detector bundle pool).
36
+
37
+ The frictionless decision machine now gates on payload presence after the access-rule ladder: no token serves a 3-round image captcha, a token without its head hash serves a 2-round one.
38
+ - Updated dependencies [9fec7bd]
39
+ - Updated dependencies [2aabe73]
40
+ - Updated dependencies [bcef918]
41
+ - @prosopo/common@3.1.49
42
+ - @prosopo/types@5.0.1
43
+ - @prosopo/api@4.0.1
44
+ - @prosopo/locale@3.2.9
45
+ - @prosopo/procaptcha-common@2.11.21
46
+ - @prosopo/procaptcha-pow@2.10.28
47
+ - @prosopo/procaptcha-puzzle@2.10.44
48
+ - @prosopo/procaptcha-react@2.9.101
49
+
3
50
  ## 2.13.1
4
51
  ### Patch Changes
5
52
 
@@ -4,7 +4,7 @@ let _prosopo_procaptcha_common = require("@prosopo/procaptcha-common");
4
4
  let _prosopo_api = require("@prosopo/api");
5
5
  let _prosopo_common = require("@prosopo/common");
6
6
  //#region src/customDetectBot.ts
7
- var ASSIGN_TIMEOUT_MS = 2e3;
7
+ var ASSIGN_TIMEOUT_MS = 1e4;
8
8
  var sanitiseHref = (href) => {
9
9
  try {
10
10
  const u = new URL(href);
@@ -82,17 +82,19 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
82
82
  try {
83
83
  const assigned = prefetchedResult?.assigned ?? await withTimeout(providerApi.assignDetectorBundle(config.account.address), ASSIGN_TIMEOUT_MS);
84
84
  if (assigned.useProviderBundle && assigned.detectorScript) {
85
+ providerDetect = await require_detectorLoader.DetectorLoaderFromScript(assigned.detectorScript);
85
86
  detectorSessionId = assigned.detectorSessionId;
86
- providerDetect = await withTimeout(require_detectorLoader.DetectorLoaderFromScript(assigned.detectorScript), ASSIGN_TIMEOUT_MS);
87
87
  }
88
- } catch {}
88
+ } catch (err) {
89
+ console.error("Procaptcha: no detector bundle available, falling back to a server-chosen captcha:", err);
90
+ }
89
91
  const ext = new (await extClassPromise)();
90
92
  if (providerDetect === void 0) {
91
93
  const userAccount = await ext.getAccount(config);
92
94
  const { currentUrl: fallbackUrl, iframeUrl: fallbackIframeUrl } = getCurrentPageUrls();
93
- const powCaptcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, true, fallbackUrl, fallbackIframeUrl), 1e4);
94
- if (powCaptcha.dns_url) try {
95
- fetch(powCaptcha.dns_url, {
95
+ const captcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, fallbackUrl, fallbackIframeUrl), 1e4);
96
+ if (captcha.dns_url) try {
97
+ fetch(captcha.dns_url, {
96
98
  method: "GET",
97
99
  mode: "no-cors",
98
100
  credentials: "omit",
@@ -101,19 +103,19 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
101
103
  }).catch(() => void 0);
102
104
  } catch {}
103
105
  return {
104
- captchaType: powCaptcha.captchaType,
105
- sessionId: powCaptcha.sessionId,
106
+ captchaType: captcha.captchaType,
107
+ sessionId: captcha.sessionId,
106
108
  provider,
107
- status: powCaptcha.status,
109
+ status: captcha.status,
108
110
  userAccount,
109
- error: powCaptcha.error,
110
- hp: powCaptcha.hp
111
+ error: captcha.error,
112
+ hp: captcha.hp
111
113
  };
112
114
  }
113
115
  const detectionResult = await providerDetect(container, restartFn, () => ext.getAccount(config));
114
116
  const userAccount = detectionResult.userAccount;
115
117
  const { currentUrl, iframeUrl } = getCurrentPageUrls();
116
- const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, void 0, currentUrl, iframeUrl);
118
+ const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, currentUrl, iframeUrl);
117
119
  if (detectionResult.getSimdReadings) detectionResult.getSimdReadings(6e4).catch(() => void 0);
118
120
  const captcha = await withTimeout(captchaPromise, 1e4);
119
121
  if (captcha.dns_url) try {
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AAwFxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBA2NtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AAyFxB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAqOtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -4,7 +4,7 @@ import { ExtensionLoader, getProcaptchaRandomActiveProvider, pickIpMode } from "
4
4
  import { ProviderApi } from "@prosopo/api";
5
5
  import { ProsopoEnvError } from "@prosopo/common";
6
6
  //#region src/customDetectBot.ts
7
- var ASSIGN_TIMEOUT_MS = 2e3;
7
+ var ASSIGN_TIMEOUT_MS = 1e4;
8
8
  var sanitiseHref = (href) => {
9
9
  try {
10
10
  const u = new URL(href);
@@ -82,17 +82,19 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
82
82
  try {
83
83
  const assigned = prefetchedResult?.assigned ?? await withTimeout(providerApi.assignDetectorBundle(config.account.address), ASSIGN_TIMEOUT_MS);
84
84
  if (assigned.useProviderBundle && assigned.detectorScript) {
85
+ providerDetect = await DetectorLoaderFromScript(assigned.detectorScript);
85
86
  detectorSessionId = assigned.detectorSessionId;
86
- providerDetect = await withTimeout(DetectorLoaderFromScript(assigned.detectorScript), ASSIGN_TIMEOUT_MS);
87
87
  }
88
- } catch {}
88
+ } catch (err) {
89
+ console.error("Procaptcha: no detector bundle available, falling back to a server-chosen captcha:", err);
90
+ }
89
91
  const ext = new (await extClassPromise)();
90
92
  if (providerDetect === void 0) {
91
93
  const userAccount = await ext.getAccount(config);
92
94
  const { currentUrl: fallbackUrl, iframeUrl: fallbackIframeUrl } = getCurrentPageUrls();
93
- const powCaptcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, true, fallbackUrl, fallbackIframeUrl), 1e4);
94
- if (powCaptcha.dns_url) try {
95
- fetch(powCaptcha.dns_url, {
95
+ const captcha = await withTimeout(providerApi.getFrictionlessCaptcha(void 0, void 0, config.account.address, userAccount.account.address, config.mode, void 0, void 0, fallbackUrl, fallbackIframeUrl), 1e4);
96
+ if (captcha.dns_url) try {
97
+ fetch(captcha.dns_url, {
96
98
  method: "GET",
97
99
  mode: "no-cors",
98
100
  credentials: "omit",
@@ -101,19 +103,19 @@ var customDetectBot = async (config, container, restartFn, retryContext) => {
101
103
  }).catch(() => void 0);
102
104
  } catch {}
103
105
  return {
104
- captchaType: powCaptcha.captchaType,
105
- sessionId: powCaptcha.sessionId,
106
+ captchaType: captcha.captchaType,
107
+ sessionId: captcha.sessionId,
106
108
  provider,
107
- status: powCaptcha.status,
109
+ status: captcha.status,
108
110
  userAccount,
109
- error: powCaptcha.error,
110
- hp: powCaptcha.hp
111
+ error: captcha.error,
112
+ hp: captcha.hp
111
113
  };
112
114
  }
113
115
  const detectionResult = await providerDetect(container, restartFn, () => ext.getAccount(config));
114
116
  const userAccount = detectionResult.userAccount;
115
117
  const { currentUrl, iframeUrl } = getCurrentPageUrls();
116
- const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, void 0, currentUrl, iframeUrl);
118
+ const captchaPromise = providerApi.getFrictionlessCaptcha(detectionResult.token, detectionResult.encryptHeadHash, config.account.address, userAccount.account.address, config.mode, void 0, detectorSessionId, currentUrl, iframeUrl);
117
119
  if (detectionResult.getSimdReadings) detectionResult.getSimdReadings(6e4).catch(() => void 0);
118
120
  const captcha = await withTimeout(captchaPromise, 1e4);
119
121
  if (captcha.dns_url) try {
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,eAAe,EACf,iCAAiC,EACjC,UAAU,GACV,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EACN,wBAAwB,GAExB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,sBAAsB,GACtB,MAAM,uBAAuB,CAAC;AAM/B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAqB/B,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IACzD,IAAI,CAAC;QACJ,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,SAAS,CAAC;QACvD,OAAO,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC,CAAC;AAOF,MAAM,kBAAkB,GAAG,GAAa,E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E,eAAe,CAAC,qBAAqB;QAC5D,kBAAkB,EAAE,eAAe,CAAC,kBAAkB;QACtD,eAAe,EAAE,eAAe,CAAC,eAAe;KAChD,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=customDetectBotAssignTimeout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customDetectBotAssignTimeout.test.d.ts","sourceRoot":"","sources":["../../src/tests/customDetectBotAssignTimeout.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,118 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
+ const mocks = vi.hoisted(() => ({
3
+ getFrictionlessCaptcha: vi.fn(),
4
+ getProcaptchaRandomActiveProvider: vi.fn(),
5
+ assignDetectorBundle: vi.fn(),
6
+ detectorLoaderFromScript: vi.fn(),
7
+ detect: vi.fn(),
8
+ }));
9
+ vi.mock("@prosopo/api", () => ({
10
+ ProviderApi: vi.fn(function () {
11
+ return {
12
+ getFrictionlessCaptcha: mocks.getFrictionlessCaptcha,
13
+ assignDetectorBundle: mocks.assignDetectorBundle,
14
+ };
15
+ }),
16
+ }));
17
+ vi.mock("@prosopo/procaptcha-common", () => ({
18
+ ExtensionLoader: vi.fn(async () => {
19
+ return class FakeExtension {
20
+ getAccount() {
21
+ return Promise.resolve({
22
+ account: { address: "5FakeUserAccountAddress" },
23
+ });
24
+ }
25
+ };
26
+ }),
27
+ getProcaptchaRandomActiveProvider: mocks.getProcaptchaRandomActiveProvider,
28
+ pickIpMode: vi.fn(() => undefined),
29
+ }));
30
+ vi.mock("../detectorLoader.js", () => ({
31
+ DetectorLoaderFromScript: mocks.detectorLoaderFromScript,
32
+ }));
33
+ import customDetectBot from "../customDetectBot.js";
34
+ const baseConfig = {
35
+ account: { address: "5CcNvLUdiXFpzKDMjThGLSK9rhWHA1H4EF3zrgkpkjAdqmuP" },
36
+ defaultEnvironment: "staging",
37
+ web2: true,
38
+ mode: "visible",
39
+ };
40
+ const assignResponse = {
41
+ useProviderBundle: true,
42
+ detectorSessionId: "det-5cad2419-43c0-41b7-a9b8-0117767624bc",
43
+ detectorScript: "SELF_CONTAINED_ESM",
44
+ status: "ok",
45
+ };
46
+ const detectionResult = {
47
+ token: "ENCRYPTED_TOKEN",
48
+ encryptHeadHash: "ENCRYPTED_HEAD_HASH",
49
+ userAccount: { account: { address: "5FakeUserAccountAddress" } },
50
+ shadowDomCleanup: () => undefined,
51
+ };
52
+ const captchaResponse = {
53
+ captchaType: "pow",
54
+ sessionId: "SID",
55
+ status: "ok",
56
+ };
57
+ const SLOW_MS = 6700;
58
+ const resolveAfter = (ms, value) => new Promise((resolve) => {
59
+ setTimeout(() => resolve(value), ms);
60
+ });
61
+ const postedToken = () => {
62
+ const call = mocks.getFrictionlessCaptcha.mock.calls[0];
63
+ return call?.[0];
64
+ };
65
+ const postedDetectorSessionId = () => {
66
+ const call = mocks.getFrictionlessCaptcha.mock.calls[0];
67
+ return call?.[6];
68
+ };
69
+ beforeEach(() => {
70
+ vi.useFakeTimers();
71
+ mocks.getFrictionlessCaptcha.mockReset();
72
+ mocks.getProcaptchaRandomActiveProvider.mockReset();
73
+ mocks.assignDetectorBundle.mockReset();
74
+ mocks.detectorLoaderFromScript.mockReset();
75
+ mocks.detect.mockReset();
76
+ mocks.getProcaptchaRandomActiveProvider.mockResolvedValue({
77
+ providerAccount: "dns-routed",
78
+ provider: { url: "https://staging-pronode3.prosopo.io" },
79
+ });
80
+ mocks.detect.mockResolvedValue(detectionResult);
81
+ mocks.detectorLoaderFromScript.mockResolvedValue(mocks.detect);
82
+ mocks.assignDetectorBundle.mockResolvedValue(assignResponse);
83
+ mocks.getFrictionlessCaptcha.mockResolvedValue(captchaResponse);
84
+ });
85
+ afterEach(() => {
86
+ vi.useRealTimers();
87
+ });
88
+ const runDetection = async () => {
89
+ const pending = customDetectBot(baseConfig, undefined, () => undefined);
90
+ await vi.advanceTimersByTimeAsync(SLOW_MS + 1000);
91
+ await pending;
92
+ };
93
+ describe("customDetectBot detector-assignment deadline", () => {
94
+ it("uses a bundle whose assign POST is slow", async () => {
95
+ mocks.assignDetectorBundle.mockImplementation(() => resolveAfter(SLOW_MS, assignResponse));
96
+ await runDetection();
97
+ expect(mocks.detectorLoaderFromScript).toHaveBeenCalledWith(assignResponse.detectorScript);
98
+ expect(postedToken()).toBe("ENCRYPTED_TOKEN");
99
+ expect(postedDetectorSessionId()).toBe(assignResponse.detectorSessionId);
100
+ });
101
+ it("uses a bundle whose blob import is slow", async () => {
102
+ mocks.detectorLoaderFromScript.mockImplementation(() => resolveAfter(SLOW_MS, mocks.detect));
103
+ await runDetection();
104
+ expect(postedToken()).toBe("ENCRYPTED_TOKEN");
105
+ expect(postedDetectorSessionId()).toBe(assignResponse.detectorSessionId);
106
+ });
107
+ it("still sends an empty token when the provider has no bundle to assign", async () => {
108
+ mocks.assignDetectorBundle.mockResolvedValue({
109
+ useProviderBundle: false,
110
+ status: "ok",
111
+ });
112
+ await runDetection();
113
+ expect(mocks.detectorLoaderFromScript).not.toHaveBeenCalled();
114
+ expect(postedToken()).toBeUndefined();
115
+ expect(postedDetectorSessionId()).toBeUndefined();
116
+ });
117
+ });
118
+ //# sourceMappingURL=customDetectBotAssignTimeout.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customDetectBotAssignTimeout.test.js","sourceRoot":"","sources":["../../src/tests/customDetectBotAssignTimeout.test.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAIzE,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/B,sBAAsB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC/B,iCAAiC,EAAE,EAAE,CAAC,EAAE,EAAE;IAC1C,oBAAoB,EAAE,EAAE,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Ac,CAAC,cAAc,CAC7B,CAAC;QACF,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9C,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACxD,KAAK,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,GAAG,EAAE,CACtD,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CACnC,CAAC;QAEF,MAAM,YAAY,EAAE,CAAC;QAErB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9C,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,KAAK,IAAI,EAAE;QACrF,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;YAC5C,iBAAiB,EAAE,KAAK;YACxB,MAAM,EAAE,IAAI;SAC2B,CAAC,CAAC;QAE1C,MAAM,YAAY,EAAE,CAAC;QAErB,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAC9D,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;QACtC,MAAM,CAAC,uBAAuB,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;IACnD,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.1",
3
+ "version": "2.13.3",
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.0",
34
- "@prosopo/common": "3.1.48",
35
- "@prosopo/locale": "3.2.8",
36
- "@prosopo/procaptcha-common": "2.11.20",
37
- "@prosopo/procaptcha-pow": "2.10.27",
38
- "@prosopo/procaptcha-puzzle": "2.10.43",
39
- "@prosopo/procaptcha-react": "2.9.100",
40
- "@prosopo/types": "5.0.0",
33
+ "@prosopo/api": "4.0.1",
34
+ "@prosopo/common": "3.1.49",
35
+ "@prosopo/locale": "3.2.9",
36
+ "@prosopo/procaptcha-common": "2.11.21",
37
+ "@prosopo/procaptcha-pow": "2.10.28",
38
+ "@prosopo/procaptcha-puzzle": "2.10.44",
39
+ "@prosopo/procaptcha-react": "2.9.101",
40
+ "@prosopo/types": "5.0.1",
41
41
  "@prosopo/widget-skeleton": "2.8.5",
42
42
  "dotenv": "16.4.5",
43
43
  "react": "18.3.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@prosopo/config": "3.3.6",
46
+ "@prosopo/config": "3.3.7",
47
47
  "@types/node": "22.10.2",
48
48
  "@vitest/coverage-v8": "4.1.10",
49
49
  "concurrently": "9.0.1",