@prosopo/provider 4.11.6 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build$colon$cjs.log +44 -41
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +45 -42
- package/CHANGELOG.md +148 -0
- package/dist/api/admin/apiClearAllCountersEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiClearAllCountersEndpoint.js +1 -1
- package/dist/api/admin/apiClearAllCountersEndpoint.js.map +1 -1
- package/dist/api/admin/apiDnsEventEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiDnsEventEndpoint.js +1 -1
- package/dist/api/admin/apiDnsEventEndpoint.js.map +1 -1
- package/dist/api/admin/apiGetAllDecisionMachinesEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiGetAllDecisionMachinesEndpoint.js +1 -1
- package/dist/api/admin/apiGetAllDecisionMachinesEndpoint.js.map +1 -1
- package/dist/api/admin/apiGetDecisionMachineEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiGetDecisionMachineEndpoint.js +1 -1
- package/dist/api/admin/apiGetDecisionMachineEndpoint.js.map +1 -1
- package/dist/api/admin/apiRegisterSiteKeyEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRegisterSiteKeyEndpoint.js +1 -1
- package/dist/api/admin/apiRegisterSiteKeyEndpoint.js.map +1 -1
- package/dist/api/admin/apiRegisterSiteKeysEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRegisterSiteKeysEndpoint.js +1 -1
- package/dist/api/admin/apiRegisterSiteKeysEndpoint.js.map +1 -1
- package/dist/api/admin/apiRemoveAllDecisionMachinesEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveAllDecisionMachinesEndpoint.js +1 -1
- package/dist/api/admin/apiRemoveAllDecisionMachinesEndpoint.js.map +1 -1
- package/dist/api/admin/apiRemoveDecisionMachineEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveDecisionMachineEndpoint.js +1 -1
- package/dist/api/admin/apiRemoveDecisionMachineEndpoint.js.map +1 -1
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.js +1 -2
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.js.map +1 -1
- package/dist/api/admin/apiRemoveSiteKeyEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveSiteKeyEndpoint.js +1 -1
- package/dist/api/admin/apiRemoveSiteKeyEndpoint.js.map +1 -1
- package/dist/api/admin/apiRemoveSiteKeysEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiRemoveSiteKeysEndpoint.js +1 -1
- package/dist/api/admin/apiRemoveSiteKeysEndpoint.js.map +1 -1
- package/dist/api/admin/apiToggleMaintenanceModeEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiToggleMaintenanceModeEndpoint.js +3 -1
- package/dist/api/admin/apiToggleMaintenanceModeEndpoint.js.map +1 -1
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.js +1 -1
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.js.map +1 -1
- package/dist/api/admin/apiUpdateDetectorKeyEndpoint.js +1 -2
- package/dist/api/admin/apiUpdateDetectorKeyEndpoint.js.map +1 -1
- package/dist/api/blacklistRequestInspector.d.ts.map +1 -1
- package/dist/api/blacklistRequestInspector.js +7 -4
- package/dist/api/blacklistRequestInspector.js.map +1 -1
- package/dist/api/captcha/checkSpamEmail.d.ts.map +1 -1
- package/dist/api/captcha/checkSpamEmail.js +19 -4
- package/dist/api/captcha/checkSpamEmail.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.d.ts +0 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.js +25 -6
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.d.ts +0 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js +8 -21
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.d.ts +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js +68 -32
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.d.ts +0 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js +0 -2
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js.map +1 -1
- package/dist/api/captcha/getImageCaptchaChallenge.d.ts.map +1 -1
- package/dist/api/captcha/getImageCaptchaChallenge.js +23 -1
- package/dist/api/captcha/getImageCaptchaChallenge.js.map +1 -1
- package/dist/api/captcha/getPoWCaptchaChallenge.d.ts.map +1 -1
- package/dist/api/captcha/getPoWCaptchaChallenge.js +3 -0
- package/dist/api/captcha/getPoWCaptchaChallenge.js.map +1 -1
- package/dist/api/captcha/getPuzzleCaptchaChallenge.d.ts.map +1 -1
- package/dist/api/captcha/getPuzzleCaptchaChallenge.js +3 -0
- package/dist/api/captcha/getPuzzleCaptchaChallenge.js.map +1 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.js +0 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.js.map +1 -1
- package/dist/api/captcha.d.ts +2 -1
- package/dist/api/captcha.d.ts.map +1 -1
- package/dist/api/captcha.js +12 -15
- package/dist/api/captcha.js.map +1 -1
- package/dist/api/domainMiddleware.d.ts.map +1 -1
- package/dist/api/domainMiddleware.js +4 -0
- package/dist/api/domainMiddleware.js.map +1 -1
- package/dist/api/forwardVerify.d.ts +14 -0
- package/dist/api/forwardVerify.d.ts.map +1 -0
- package/dist/api/forwardVerify.js +54 -0
- package/dist/api/forwardVerify.js.map +1 -0
- package/dist/api/headerCheckMiddleware.d.ts.map +1 -1
- package/dist/api/headerCheckMiddleware.js +7 -4
- package/dist/api/headerCheckMiddleware.js.map +1 -1
- package/dist/api/ja4.d.ts +5 -0
- package/dist/api/ja4.d.ts.map +1 -0
- package/dist/api/ja4.js +203 -0
- package/dist/api/ja4.js.map +1 -0
- package/dist/api/ja4Middleware.d.ts.map +1 -1
- package/dist/api/ja4Middleware.js +9 -18
- package/dist/api/ja4Middleware.js.map +1 -1
- package/dist/api/metrics.d.ts +40 -0
- package/dist/api/metrics.d.ts.map +1 -0
- package/dist/api/metrics.js +260 -0
- package/dist/api/metrics.js.map +1 -0
- package/dist/api/public.d.ts.map +1 -1
- package/dist/api/public.js +6 -1
- package/dist/api/public.js.map +1 -1
- package/dist/api/startProviderApi.d.ts.map +1 -1
- package/dist/api/startProviderApi.js +19 -22
- package/dist/api/startProviderApi.js.map +1 -1
- package/dist/api/verify.d.ts.map +1 -1
- package/dist/api/verify.js +85 -8
- package/dist/api/verify.js.map +1 -1
- package/dist/cjs/api/admin/apiClearAllCountersEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiDnsEventEndpoint.cjs +1 -2
- package/dist/cjs/api/admin/apiGetAllDecisionMachinesEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiGetDecisionMachineEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiRegisterSiteKeyEndpoint.cjs +1 -2
- package/dist/cjs/api/admin/apiRegisterSiteKeysEndpoint.cjs +1 -2
- package/dist/cjs/api/admin/apiRemoveAllDecisionMachinesEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiRemoveDecisionMachineEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiRemoveDetectorKeyEndpoint.cjs +1 -3
- package/dist/cjs/api/admin/apiRemoveSiteKeyEndpoint.cjs +1 -2
- package/dist/cjs/api/admin/apiRemoveSiteKeysEndpoint.cjs +1 -2
- package/dist/cjs/api/admin/apiToggleMaintenanceModeEndpoint.cjs +3 -2
- package/dist/cjs/api/admin/apiUpdateDecisionMachineEndpoint.cjs +1 -1
- package/dist/cjs/api/admin/apiUpdateDetectorKeyEndpoint.cjs +1 -2
- package/dist/cjs/api/blacklistRequestInspector.cjs +7 -4
- package/dist/cjs/api/captcha/checkSpamEmail.cjs +18 -3
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.cjs +25 -6
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.cjs +8 -21
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs +70 -34
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.cjs +0 -2
- package/dist/cjs/api/captcha/getImageCaptchaChallenge.cjs +23 -1
- package/dist/cjs/api/captcha/getPoWCaptchaChallenge.cjs +3 -0
- package/dist/cjs/api/captcha/getPuzzleCaptchaChallenge.cjs +3 -0
- package/dist/cjs/api/captcha/submitPoWCaptchaSolution.cjs +0 -1
- package/dist/cjs/api/captcha.cjs +12 -15
- package/dist/cjs/api/domainMiddleware.cjs +4 -0
- package/dist/cjs/api/forwardVerify.cjs +54 -0
- package/dist/cjs/api/headerCheckMiddleware.cjs +7 -4
- package/dist/cjs/api/ja4.cjs +203 -0
- package/dist/cjs/api/ja4Middleware.cjs +11 -21
- package/dist/cjs/api/metrics.cjs +260 -0
- package/dist/cjs/api/public.cjs +6 -1
- package/dist/cjs/api/startProviderApi.cjs +19 -44
- package/dist/cjs/api/verify.cjs +83 -6
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/tasks/captchaManager.cjs +1 -2
- package/dist/cjs/tasks/detection/getBotScore.cjs +1 -5
- package/dist/cjs/tasks/frictionless/frictionlessTasks.cjs +5 -63
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +20 -23
- package/dist/cjs/tasks/powCaptcha/powTasks.cjs +17 -24
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs +15 -22
- package/dist/index.js +2 -1
- package/dist/tasks/captchaManager.js +1 -1
- package/dist/tasks/captchaManager.js.map +1 -1
- package/dist/tasks/detection/getBotScore.d.ts +0 -2
- package/dist/tasks/detection/getBotScore.d.ts.map +1 -1
- package/dist/tasks/detection/getBotScore.js +1 -5
- package/dist/tasks/detection/getBotScore.js.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.d.ts +1 -11
- package/dist/tasks/frictionless/frictionlessTasks.d.ts.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.js +5 -63
- package/dist/tasks/frictionless/frictionlessTasks.js.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +20 -23
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js.map +1 -1
- package/dist/tasks/powCaptcha/powTasks.d.ts.map +1 -1
- package/dist/tasks/powCaptcha/powTasks.js +17 -24
- package/dist/tasks/powCaptcha/powTasks.js.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.d.ts.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js +15 -22
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js.map +1 -1
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js +2 -2
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js.map +1 -1
- package/dist/tests/integration/clientSettingsPersistence.integration.test.js +1 -1
- package/dist/tests/integration/decisionMachines.integration.test.js +2 -2
- package/dist/tests/integration/decisionMachines.integration.test.js.map +1 -1
- package/dist/tests/integration/imgCaptcha.integration.test.js +2 -2
- package/dist/tests/integration/imgCaptcha.integration.test.js.map +1 -1
- package/dist/tests/integration/powCaptcha.integration.test.js +2 -2
- package/dist/tests/integration/powCaptcha.integration.test.js.map +1 -1
- package/dist/tests/integration/routingDecisionMachines.integration.test.js +0 -1
- package/dist/tests/integration/routingDecisionMachines.integration.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiClearAllCountersEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiClearAllCountersEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiDnsEventEndpoint.unit.test.js +5 -1
- package/dist/tests/unit/api/admin/apiDnsEventEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiRegisterSiteKeyEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiRegisterSiteKeyEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiRegisterSiteKeysEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiRegisterSiteKeysEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiRemoveDetectorKeyEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiRemoveDetectorKeyEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiToggleMaintenanceModeEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiToggleMaintenanceModeEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/admin/apiUpdateDetectorKeyEndpoint.unit.test.js +1 -0
- package/dist/tests/unit/api/admin/apiUpdateDetectorKeyEndpoint.unit.test.js.map +1 -1
- package/dist/tests/unit/api/adminRoutes.unit.test.js +1 -0
- package/dist/tests/unit/api/adminRoutes.unit.test.js.map +1 -1
- package/dist/tests/unit/api/blacklistRequestInspector.unit.test.js +43 -1
- package/dist/tests/unit/api/blacklistRequestInspector.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/checkSpamEmail.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/captcha/checkSpamEmail.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/captcha/checkSpamEmail.unit.test.js +62 -0
- package/dist/tests/unit/api/captcha/checkSpamEmail.unit.test.js.map +1 -0
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.unit.test.js +63 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js +0 -75
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.unit.test.js +0 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha.unit.test.js +31 -1
- package/dist/tests/unit/api/captcha.unit.test.js.map +1 -1
- package/dist/tests/unit/api/forwardVerify.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/forwardVerify.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/forwardVerify.unit.test.js +151 -0
- package/dist/tests/unit/api/forwardVerify.unit.test.js.map +1 -0
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js +68 -20
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js.map +1 -1
- package/dist/tests/unit/api/headerCheckMiddleware.unit.test.js +2 -2
- package/dist/tests/unit/api/headerCheckMiddleware.unit.test.js.map +1 -1
- package/dist/tests/unit/api/ja4.unit.test.d.ts +2 -0
- package/dist/tests/unit/api/ja4.unit.test.d.ts.map +1 -0
- package/dist/tests/unit/api/ja4.unit.test.js +233 -0
- package/dist/tests/unit/api/ja4.unit.test.js.map +1 -0
- package/dist/tests/unit/api/ja4Middleware.unit.test.js +11 -8
- package/dist/tests/unit/api/ja4Middleware.unit.test.js.map +1 -1
- package/dist/tests/unit/api/public.unit.test.js +72 -0
- package/dist/tests/unit/api/public.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/captchaScheduler.unit.test.js +1 -1
- package/dist/tests/unit/schedulers/captchaScheduler.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/getClientList.unit.test.js +1 -1
- package/dist/tests/unit/schedulers/getClientList.unit.test.js.map +1 -1
- package/dist/tests/unit/schedulers/setClientEntropy.unit.test.js +1 -1
- package/dist/tests/unit/schedulers/setClientEntropy.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/captchaManager.unit.test.js +1 -1
- package/dist/tests/unit/tasks/captchaManager.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/client/clientTasks.unit.test.js +1 -1
- package/dist/tests/unit/tasks/client/clientTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/dataset/datasetTasks.unit.test.js +1 -1
- package/dist/tests/unit/tasks/dataset/datasetTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js +0 -3
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js +0 -10
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js +0 -82
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js +1 -13
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js +4 -3
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js +0 -4
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js +0 -2
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/writeQueueIntegration.unit.test.js +0 -3
- package/dist/tests/unit/tasks/writeQueueIntegration.unit.test.js.map +1 -1
- package/package.json +23 -23
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
3
|
const fs = require("node:fs");
|
|
26
4
|
const https = require("node:https");
|
|
27
5
|
const path = require("node:path");
|
|
28
6
|
const node_url = require("node:url");
|
|
29
7
|
const apiExpressRouter = require("@prosopo/api-express-router");
|
|
30
|
-
const loadBalancer = require("@prosopo/load-balancer");
|
|
31
8
|
const locale = require("@prosopo/locale");
|
|
32
9
|
const logger = require("@prosopo/logger");
|
|
33
10
|
const types = require("@prosopo/types");
|
|
34
11
|
const api = require("@prosopo/user-access-policy/api");
|
|
35
|
-
const node = require("@prosopo/util/node");
|
|
36
12
|
const cors = require("cors");
|
|
37
13
|
const express = require("express");
|
|
38
14
|
const rateLimit = require("express-rate-limit");
|
|
@@ -44,6 +20,7 @@ const headerCheckMiddleware = require("./headerCheckMiddleware.cjs");
|
|
|
44
20
|
const ignoreMiddleware = require("./ignoreMiddleware.cjs");
|
|
45
21
|
const ipInfoMiddleware = require("./ipInfoMiddleware.cjs");
|
|
46
22
|
const ja4Middleware = require("./ja4Middleware.cjs");
|
|
23
|
+
const metrics = require("./metrics.cjs");
|
|
47
24
|
const _public = require("./public.cjs");
|
|
48
25
|
const robotsMiddleware = require("./robotsMiddleware.cjs");
|
|
49
26
|
const verify = require("./verify.cjs");
|
|
@@ -85,24 +62,6 @@ const getUserFromJWT = (req) => {
|
|
|
85
62
|
};
|
|
86
63
|
async function startProviderApi(env, admin = false, port) {
|
|
87
64
|
env.logger.info(() => ({ msg: "Starting Prosopo API" }));
|
|
88
|
-
const providerCacheDir = path.resolve("./provider-list-cache");
|
|
89
|
-
loadBalancer.setProviderLoader(async (environment) => {
|
|
90
|
-
if (environment === "development") {
|
|
91
|
-
const { loadBalancer: loadBalancer2 } = await import("@prosopo/load-balancer");
|
|
92
|
-
return loadBalancer2(environment);
|
|
93
|
-
}
|
|
94
|
-
const url = loadBalancer.getLoadBalancerUrl(environment);
|
|
95
|
-
const filePath = await node.cacheFile(
|
|
96
|
-
providerCacheDir,
|
|
97
|
-
url,
|
|
98
|
-
env.logger,
|
|
99
|
-
"provider-list-",
|
|
100
|
-
".json"
|
|
101
|
-
);
|
|
102
|
-
const text = fs.readFileSync(filePath, "utf-8");
|
|
103
|
-
const providers = JSON.parse(text);
|
|
104
|
-
return loadBalancer.convertHostedProvider(providers);
|
|
105
|
-
});
|
|
106
65
|
const apiApp = express();
|
|
107
66
|
const apiPort = port || env.config.server?.port;
|
|
108
67
|
const apiEndpointAdapter = apiExpressRouter.createApiExpressDefaultEndpointAdapter(
|
|
@@ -128,9 +87,25 @@ async function startProviderApi(env, admin = false, port) {
|
|
|
128
87
|
paths: clientPathsExcludingVerify
|
|
129
88
|
}));
|
|
130
89
|
apiApp.set("trust proxy", 1);
|
|
131
|
-
apiApp.use(
|
|
132
|
-
|
|
90
|
+
apiApp.use(
|
|
91
|
+
cors({
|
|
92
|
+
exposedHeaders: ["x-prosopo-meta"],
|
|
93
|
+
allowedHeaders: [
|
|
94
|
+
"Accept",
|
|
95
|
+
"Accept-Language",
|
|
96
|
+
"Authorization",
|
|
97
|
+
"Content-Language",
|
|
98
|
+
"Content-Type",
|
|
99
|
+
"Prosopo-Site-Key",
|
|
100
|
+
"Prosopo-User",
|
|
101
|
+
"x-prosopo-meta"
|
|
102
|
+
],
|
|
103
|
+
maxAge: 86400
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
apiApp.use(express.json({ limit: "1mb" }));
|
|
133
107
|
apiApp.use(_public.publicRouter(env));
|
|
108
|
+
apiApp.use(metrics.metricsMiddleware());
|
|
134
109
|
const isTestOrDevelopmentEnv = process.env.NODE_ENV === "test" || env.config.defaultEnvironment === "development";
|
|
135
110
|
if (!isTestOrDevelopmentEnv) {
|
|
136
111
|
const configRateLimits = env.config.rateLimits;
|
package/dist/cjs/api/verify.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const api = require("@prosopo/api");
|
|
3
4
|
const apiExpressRouter = require("@prosopo/api-express-router");
|
|
4
5
|
const common = require("@prosopo/common");
|
|
5
6
|
const types = require("@prosopo/types");
|
|
@@ -7,7 +8,26 @@ const utilCrypto = require("@prosopo/util-crypto");
|
|
|
7
8
|
const express = require("express");
|
|
8
9
|
const tasks = require("../tasks/tasks.cjs");
|
|
9
10
|
const apiToggleMaintenanceModeEndpoint = require("./admin/apiToggleMaintenanceModeEndpoint.cjs");
|
|
11
|
+
const forwardVerify = require("./forwardVerify.cjs");
|
|
12
|
+
const metrics = require("./metrics.cjs");
|
|
10
13
|
const testSiteKey = require("./testSiteKey.cjs");
|
|
14
|
+
const deriveVerifySource = (body) => {
|
|
15
|
+
if (apiToggleMaintenanceModeEndpoint.getMaintenanceMode()) return "maintenance";
|
|
16
|
+
try {
|
|
17
|
+
const token = body?.token;
|
|
18
|
+
if (token) {
|
|
19
|
+
const { dapp } = types.decodeProcaptchaOutput(token);
|
|
20
|
+
if (testSiteKey.isReservedTestSiteKey(dapp)) return "test_key";
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
return "real";
|
|
25
|
+
};
|
|
26
|
+
const VERIFY_PATH_TYPE = {
|
|
27
|
+
[types.ClientApiPaths.VerifyImageCaptchaSolutionDapp]: types.CaptchaType.image,
|
|
28
|
+
[types.ClientApiPaths.VerifyPowCaptchaSolution]: types.CaptchaType.pow,
|
|
29
|
+
[types.ClientApiPaths.VerifyPuzzleCaptchaSolution]: types.CaptchaType.puzzle
|
|
30
|
+
};
|
|
11
31
|
function prosopoVerifyRouter(env) {
|
|
12
32
|
const router = express.Router();
|
|
13
33
|
let userAccessRulesStorage;
|
|
@@ -20,6 +40,24 @@ function prosopoVerifyRouter(env) {
|
|
|
20
40
|
}));
|
|
21
41
|
userAccessRulesStorage = void 0;
|
|
22
42
|
}
|
|
43
|
+
router.use((req, res, next) => {
|
|
44
|
+
if (!metrics.metricsEnabled()) return next();
|
|
45
|
+
const type = VERIFY_PATH_TYPE[req.path];
|
|
46
|
+
if (!type) return next();
|
|
47
|
+
const originalJson = res.json.bind(res);
|
|
48
|
+
res.json = (body) => {
|
|
49
|
+
if (res.statusCode < 300) {
|
|
50
|
+
const verified = !!(body && typeof body === "object" && body.verified);
|
|
51
|
+
metrics.recordCaptchaVerify({
|
|
52
|
+
type,
|
|
53
|
+
verified,
|
|
54
|
+
source: deriveVerifySource(req.body)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return originalJson(body);
|
|
58
|
+
};
|
|
59
|
+
next();
|
|
60
|
+
});
|
|
23
61
|
router.post(
|
|
24
62
|
types.ClientApiPaths.VerifyImageCaptchaSolutionDapp,
|
|
25
63
|
async (req, res, next) => {
|
|
@@ -33,7 +71,6 @@ function prosopoVerifyRouter(env) {
|
|
|
33
71
|
};
|
|
34
72
|
return res.json(verificationResponse);
|
|
35
73
|
}
|
|
36
|
-
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
37
74
|
let parsed;
|
|
38
75
|
try {
|
|
39
76
|
parsed = types.VerifySolutionBody.parse(req.body);
|
|
@@ -48,7 +85,7 @@ function prosopoVerifyRouter(env) {
|
|
|
48
85
|
}
|
|
49
86
|
const { dappSignature, token, ip, maxVerifiedTime, email } = parsed;
|
|
50
87
|
try {
|
|
51
|
-
const { user, dapp, timestamp, commitmentId } = types.decodeProcaptchaOutput(token);
|
|
88
|
+
const { user, dapp, timestamp, commitmentId, providerUrl } = types.decodeProcaptchaOutput(token);
|
|
52
89
|
const testVerdict = testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
53
90
|
if (testVerdict !== null) {
|
|
54
91
|
const verificationResponse2 = {
|
|
@@ -57,6 +94,20 @@ function prosopoVerifyRouter(env) {
|
|
|
57
94
|
};
|
|
58
95
|
return res.json(verificationResponse2);
|
|
59
96
|
}
|
|
97
|
+
const forwarded = await forwardVerify.forwardVerifyIfNotIssuer({
|
|
98
|
+
env,
|
|
99
|
+
logger: req.logger,
|
|
100
|
+
path: types.ClientApiPaths.VerifyImageCaptchaSolutionDapp,
|
|
101
|
+
providerUrl,
|
|
102
|
+
dapp,
|
|
103
|
+
user,
|
|
104
|
+
body: parsed,
|
|
105
|
+
alreadyForwarded: req.headers[api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
106
|
+
});
|
|
107
|
+
if (forwarded) {
|
|
108
|
+
return res.json(forwarded);
|
|
109
|
+
}
|
|
110
|
+
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
60
111
|
utilCrypto.validateAddress(dapp, false, 42);
|
|
61
112
|
utilCrypto.validateAddress(user, false, 42);
|
|
62
113
|
const clientRecord = await tasks$1.db.getClientRecord(dapp);
|
|
@@ -122,7 +173,6 @@ function prosopoVerifyRouter(env) {
|
|
|
122
173
|
};
|
|
123
174
|
return res.json(verificationResponse);
|
|
124
175
|
}
|
|
125
|
-
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
126
176
|
let parsed;
|
|
127
177
|
try {
|
|
128
178
|
parsed = types.ServerPowCaptchaVerifyRequestBody.parse(req.body);
|
|
@@ -137,7 +187,7 @@ function prosopoVerifyRouter(env) {
|
|
|
137
187
|
}
|
|
138
188
|
try {
|
|
139
189
|
const { token, dappSignature, ip, email } = parsed;
|
|
140
|
-
const { dapp, user, timestamp, challenge } = types.decodeProcaptchaOutput(token);
|
|
190
|
+
const { dapp, user, timestamp, challenge, providerUrl } = types.decodeProcaptchaOutput(token);
|
|
141
191
|
const testVerdict = testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
142
192
|
if (testVerdict !== null) {
|
|
143
193
|
const verificationResponse2 = {
|
|
@@ -146,6 +196,20 @@ function prosopoVerifyRouter(env) {
|
|
|
146
196
|
};
|
|
147
197
|
return res.json(verificationResponse2);
|
|
148
198
|
}
|
|
199
|
+
const forwarded = await forwardVerify.forwardVerifyIfNotIssuer({
|
|
200
|
+
env,
|
|
201
|
+
logger: req.logger,
|
|
202
|
+
path: types.ClientApiPaths.VerifyPowCaptchaSolution,
|
|
203
|
+
providerUrl,
|
|
204
|
+
dapp,
|
|
205
|
+
user,
|
|
206
|
+
body: parsed,
|
|
207
|
+
alreadyForwarded: req.headers[api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
208
|
+
});
|
|
209
|
+
if (forwarded) {
|
|
210
|
+
return res.json(forwarded);
|
|
211
|
+
}
|
|
212
|
+
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
149
213
|
utilCrypto.validateAddress(dapp, false, 42);
|
|
150
214
|
utilCrypto.validateAddress(user, false, 42);
|
|
151
215
|
const clientRecord = await tasks$1.db.getClientRecord(dapp);
|
|
@@ -217,7 +281,6 @@ function prosopoVerifyRouter(env) {
|
|
|
217
281
|
};
|
|
218
282
|
return res.json(verificationResponse);
|
|
219
283
|
}
|
|
220
|
-
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
221
284
|
let parsed;
|
|
222
285
|
try {
|
|
223
286
|
parsed = types.ServerPuzzleCaptchaVerifyRequestBody.parse(req.body);
|
|
@@ -232,7 +295,7 @@ function prosopoVerifyRouter(env) {
|
|
|
232
295
|
}
|
|
233
296
|
try {
|
|
234
297
|
const { token, dappSignature, ip, email } = parsed;
|
|
235
|
-
const { dapp, user, timestamp, challenge } = types.decodeProcaptchaOutput(token);
|
|
298
|
+
const { dapp, user, timestamp, challenge, providerUrl } = types.decodeProcaptchaOutput(token);
|
|
236
299
|
const testVerdict = testSiteKey.resolveTestSiteKeyVerdict(dapp, req.logger);
|
|
237
300
|
if (testVerdict !== null) {
|
|
238
301
|
const verificationResponse2 = {
|
|
@@ -241,6 +304,20 @@ function prosopoVerifyRouter(env) {
|
|
|
241
304
|
};
|
|
242
305
|
return res.json(verificationResponse2);
|
|
243
306
|
}
|
|
307
|
+
const forwarded = await forwardVerify.forwardVerifyIfNotIssuer({
|
|
308
|
+
env,
|
|
309
|
+
logger: req.logger,
|
|
310
|
+
path: types.ClientApiPaths.VerifyPuzzleCaptchaSolution,
|
|
311
|
+
providerUrl,
|
|
312
|
+
dapp,
|
|
313
|
+
user,
|
|
314
|
+
body: parsed,
|
|
315
|
+
alreadyForwarded: req.headers[api.VERIFY_FORWARDED_HEADER] !== void 0
|
|
316
|
+
});
|
|
317
|
+
if (forwarded) {
|
|
318
|
+
return res.json(forwarded);
|
|
319
|
+
}
|
|
320
|
+
const tasks$1 = new tasks.Tasks(env, req.logger);
|
|
244
321
|
utilCrypto.validateAddress(dapp, false, 42);
|
|
245
322
|
utilCrypto.validateAddress(user, false, 42);
|
|
246
323
|
const clientRecord = await tasks$1.db.getClientRecord(dapp);
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ exports.getIPAddressFromBigInt = util.getIPAddressFromBigInt;
|
|
|
34
34
|
exports.shuffleArray = util.shuffleArray;
|
|
35
35
|
exports.validateIpAddress = util.validateIpAddress;
|
|
36
36
|
exports.blockMiddleware = block.blockMiddleware;
|
|
37
|
+
exports.asyncHandler = captcha.asyncHandler;
|
|
37
38
|
exports.prosopoRouter = captcha.prosopoRouter;
|
|
38
39
|
exports.prosopoVerifyRouter = verify.prosopoVerifyRouter;
|
|
39
40
|
exports.DEFAULT_JA4 = ja4Middleware.DEFAULT_JA4;
|
|
@@ -8,7 +8,6 @@ const compositeIpAddress = require("../compositeIpAddress.cjs");
|
|
|
8
8
|
const enrichDnsEvent = require("./dnsEvent/enrichDnsEvent.cjs");
|
|
9
9
|
const checkSpamEmail = require("./spam/checkSpamEmail.cjs");
|
|
10
10
|
const checkTrafficFilter = require("./spam/checkTrafficFilter.cjs");
|
|
11
|
-
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
12
11
|
const findHardBlockPolicy = (accessPolicies) => {
|
|
13
12
|
return accessPolicies.find(
|
|
14
13
|
(policy) => policy.type === userAccessPolicy.AccessPolicyType.Block && (policy.deferToVerify || !policy.captchaType)
|
|
@@ -19,7 +18,7 @@ class CaptchaManager {
|
|
|
19
18
|
this.pair = pair;
|
|
20
19
|
this.db = db;
|
|
21
20
|
this.config = config;
|
|
22
|
-
this.logger = logger$1 || logger.getLogger("info",
|
|
21
|
+
this.logger = logger$1 || logger.getLogger("info", "provider:captcha-manager");
|
|
23
22
|
this.writeQueue = writeQueue ?? null;
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const decodePayload = require("./decodePayload.cjs");
|
|
4
|
-
const DEFAULT_ENTROPY = 13837;
|
|
5
4
|
const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
6
5
|
const result = await decodePayload(
|
|
7
6
|
payload,
|
|
@@ -10,7 +9,6 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
10
9
|
);
|
|
11
10
|
const baseBotScore = result.score;
|
|
12
11
|
const timestamp = result.timestamp;
|
|
13
|
-
const providerSelectEntropy = result.providerSelectEntropy;
|
|
14
12
|
const userId = result.userId;
|
|
15
13
|
const userAgent = result.userAgent;
|
|
16
14
|
const isWebView = result.isWebView ?? false;
|
|
@@ -25,14 +23,12 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
25
23
|
if (baseBotScore === void 0 || Number.isNaN(baseBotScore)) {
|
|
26
24
|
return {
|
|
27
25
|
baseBotScore: 1,
|
|
28
|
-
timestamp: 0
|
|
29
|
-
providerSelectEntropy: DEFAULT_ENTROPY
|
|
26
|
+
timestamp: 0
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
return {
|
|
33
30
|
baseBotScore,
|
|
34
31
|
timestamp,
|
|
35
|
-
providerSelectEntropy,
|
|
36
32
|
userId,
|
|
37
33
|
userAgent,
|
|
38
34
|
isWebView,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const loadBalancer = require("@prosopo/load-balancer");
|
|
4
3
|
const types = require("@prosopo/types");
|
|
5
4
|
const uuid = require("uuid");
|
|
6
5
|
const dnsEventUrl = require("../../api/dnsEventUrl.cjs");
|
|
@@ -10,17 +9,7 @@ const captchaManager = require("../captchaManager.cjs");
|
|
|
10
9
|
const decisionMachineRunner = require("../decisionMachine/decisionMachineRunner.cjs");
|
|
11
10
|
const getBotScore = require("../detection/getBotScore.cjs");
|
|
12
11
|
const routingMachine = require("./routingMachine.cjs");
|
|
13
|
-
const getDefaultEntropy = () => {
|
|
14
|
-
if (process.env.PROSOPO_ENTROPY) {
|
|
15
|
-
const parsed = Number.parseInt(process.env.PROSOPO_ENTROPY);
|
|
16
|
-
if (!Number.isNaN(parsed)) {
|
|
17
|
-
return parsed;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return 13337;
|
|
21
|
-
};
|
|
22
12
|
const DEFAULT_MAX_TIMESTAMP_AGE = 60 * 10 * 1e3;
|
|
23
|
-
const DEFAULT_ENTROPY = getDefaultEntropy();
|
|
24
13
|
const getSessionIDPrefix = (host) => {
|
|
25
14
|
return host ? host.replace(".prosopo.io", "") : "local";
|
|
26
15
|
};
|
|
@@ -49,7 +38,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
49
38
|
score: params.score,
|
|
50
39
|
threshold: params.threshold,
|
|
51
40
|
scoreComponents: params.scoreComponents,
|
|
52
|
-
providerSelectEntropy: params.providerSelectEntropy,
|
|
53
41
|
ipAddress: params.ipAddress,
|
|
54
42
|
webView: params.webView ?? false,
|
|
55
43
|
iFrame: params.iFrame ?? false,
|
|
@@ -74,7 +62,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
74
62
|
checkLangRules(acceptLanguage) {
|
|
75
63
|
return lang.checkLangRules(this.config, acceptLanguage);
|
|
76
64
|
}
|
|
77
|
-
async createSession(token, score, threshold, scoreComponents,
|
|
65
|
+
async createSession(token, score, threshold, scoreComponents, ipAddress, captchaType, siteKey, solvedImagesCount, powDifficulty, userSitekeyIpHash, webView = false, iFrame = false, decryptedHeadHash = "", reason, blocked, deleted, ipInfo, headers, mode, simdReadings, entropyMathRandomFingerprint, entropyCryptoFingerprint, entropyWallClockOffsetMs, entropyMathRandomFirst) {
|
|
78
66
|
const sessionRecord = {
|
|
79
67
|
sessionId: `${getSessionIDPrefix(this.config.host)}-${uuid.v4()}`,
|
|
80
68
|
createdAt: /* @__PURE__ */ new Date(),
|
|
@@ -82,7 +70,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
82
70
|
score,
|
|
83
71
|
threshold,
|
|
84
72
|
scoreComponents,
|
|
85
|
-
providerSelectEntropy,
|
|
86
73
|
ipAddress,
|
|
87
74
|
captchaType,
|
|
88
75
|
mode,
|
|
@@ -128,25 +115,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
128
115
|
}
|
|
129
116
|
return sessionRecord;
|
|
130
117
|
}
|
|
131
|
-
async hostVerified(entropy) {
|
|
132
|
-
const chosen = await loadBalancer.getRandomActiveProvider(
|
|
133
|
-
this.config.defaultEnvironment,
|
|
134
|
-
entropy
|
|
135
|
-
);
|
|
136
|
-
const domain = new URL(chosen.provider.url).hostname;
|
|
137
|
-
const configDomain = this.config.host.indexOf("http") > -1 ? new URL(this.config.host).hostname : this.config.host;
|
|
138
|
-
this.logger.info(() => ({
|
|
139
|
-
data: { entropy, host: this.config.host, domain }
|
|
140
|
-
}));
|
|
141
|
-
if (domain !== configDomain) {
|
|
142
|
-
this.logger.info(() => ({
|
|
143
|
-
msg: "Host mismatch",
|
|
144
|
-
data: { expected: configDomain, got: domain, entropy }
|
|
145
|
-
}));
|
|
146
|
-
return { verified: false, domain };
|
|
147
|
-
}
|
|
148
|
-
return { verified: true, domain };
|
|
149
|
-
}
|
|
150
118
|
async sendImageCaptcha(params) {
|
|
151
119
|
return this.sendCaptcha(types.CaptchaType.image, params);
|
|
152
120
|
}
|
|
@@ -161,7 +129,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
161
129
|
// validation and the createSession invocation only live in one place.
|
|
162
130
|
async sendCaptcha(captchaType, params) {
|
|
163
131
|
const effectiveParams = { ...this.sessionParams, ...params };
|
|
164
|
-
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents ||
|
|
132
|
+
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents || !effectiveParams.ipAddress || effectiveParams.siteKey === void 0) {
|
|
165
133
|
throw new Error(
|
|
166
134
|
`Session parameters must be set before sending a ${captchaType} captcha`
|
|
167
135
|
);
|
|
@@ -187,7 +155,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
187
155
|
effectiveParams.score,
|
|
188
156
|
effectiveParams.threshold,
|
|
189
157
|
effectiveParams.scoreComponents,
|
|
190
|
-
effectiveParams.providerSelectEntropy,
|
|
191
158
|
effectiveParams.ipAddress,
|
|
192
159
|
finalCaptchaType,
|
|
193
160
|
effectiveParams.siteKey,
|
|
@@ -229,7 +196,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
229
196
|
}
|
|
230
197
|
async registerBlockedSession(params) {
|
|
231
198
|
const effectiveParams = { ...this.sessionParams, ...params };
|
|
232
|
-
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents ||
|
|
199
|
+
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents || !effectiveParams.ipAddress || effectiveParams.siteKey === void 0) {
|
|
233
200
|
throw new Error(
|
|
234
201
|
"Session parameters must be set before calling registerBlockedSession"
|
|
235
202
|
);
|
|
@@ -239,7 +206,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
239
206
|
effectiveParams.score,
|
|
240
207
|
effectiveParams.threshold,
|
|
241
208
|
effectiveParams.scoreComponents,
|
|
242
|
-
effectiveParams.providerSelectEntropy,
|
|
243
209
|
effectiveParams.ipAddress,
|
|
244
210
|
types.CaptchaType.image,
|
|
245
211
|
effectiveParams.siteKey,
|
|
@@ -269,20 +235,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
269
235
|
}
|
|
270
236
|
};
|
|
271
237
|
}
|
|
272
|
-
scoreIncreaseUnverifiedHost(host, baseBotScore, botScore, scoreComponents) {
|
|
273
|
-
this.logger.info(() => ({
|
|
274
|
-
msg: "Host not verified",
|
|
275
|
-
data: { requested: this.config.host, selected: host }
|
|
276
|
-
}));
|
|
277
|
-
botScore += this.config.penalties.PENALTY_UNVERIFIED_HOST;
|
|
278
|
-
return {
|
|
279
|
-
score: botScore,
|
|
280
|
-
scoreComponents: {
|
|
281
|
-
...scoreComponents,
|
|
282
|
-
unverifiedHost: this.config.penalties.PENALTY_UNVERIFIED_HOST
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
238
|
scoreIncreaseWebView(baseBotScore, botScore, scoreComponents) {
|
|
287
239
|
this.logger.debug(() => ({
|
|
288
240
|
msg: "WebView detected"
|
|
@@ -350,7 +302,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
350
302
|
});
|
|
351
303
|
let baseBotScore;
|
|
352
304
|
let timestamp;
|
|
353
|
-
let providerSelectEntropy;
|
|
354
305
|
let userId;
|
|
355
306
|
let userAgent;
|
|
356
307
|
let webView;
|
|
@@ -375,7 +326,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
375
326
|
decryptedHeadHash = decrypted.decryptedHeadHash || "";
|
|
376
327
|
const s = decrypted.baseBotScore;
|
|
377
328
|
const t = decrypted.timestamp;
|
|
378
|
-
const p = decrypted.providerSelectEntropy;
|
|
379
329
|
const a = decrypted.userId;
|
|
380
330
|
const u = decrypted.userAgent;
|
|
381
331
|
const w = decrypted.isWebView;
|
|
@@ -392,7 +342,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
392
342
|
key: this.redactKeyForLogging(key),
|
|
393
343
|
baseBotScore: s,
|
|
394
344
|
timestamp: t,
|
|
395
|
-
entropy: p,
|
|
396
345
|
userId: a,
|
|
397
346
|
userAgent: u,
|
|
398
347
|
webView: w,
|
|
@@ -407,7 +356,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
407
356
|
}));
|
|
408
357
|
baseBotScore = s;
|
|
409
358
|
timestamp = t;
|
|
410
|
-
providerSelectEntropy = p;
|
|
411
359
|
userId = a;
|
|
412
360
|
userAgent = u;
|
|
413
361
|
webView = w;
|
|
@@ -426,7 +374,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
426
374
|
}));
|
|
427
375
|
baseBotScore = 1;
|
|
428
376
|
timestamp = 0;
|
|
429
|
-
providerSelectEntropy = DEFAULT_ENTROPY + 1;
|
|
430
377
|
decryptedHeadHash = "";
|
|
431
378
|
decryptionFailed = true;
|
|
432
379
|
}
|
|
@@ -434,15 +381,13 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
434
381
|
}
|
|
435
382
|
const baseBotScoreUndefined = baseBotScore === void 0 || Number.isNaN(baseBotScore);
|
|
436
383
|
const timestampUndefined = timestamp === void 0 || Number.isNaN(timestamp);
|
|
437
|
-
const
|
|
438
|
-
const undefinedCount = Number(baseBotScoreUndefined) + Number(timestampUndefined) + Number(providerSelectEntropyUndefined);
|
|
384
|
+
const undefinedCount = Number(baseBotScoreUndefined) + Number(timestampUndefined);
|
|
439
385
|
if (undefinedCount > 0) {
|
|
440
386
|
this.logger.error(() => ({
|
|
441
|
-
msg: "Error decrypting score: baseBotScore or timestamp
|
|
387
|
+
msg: "Error decrypting score: baseBotScore or timestamp is undefined"
|
|
442
388
|
}));
|
|
443
389
|
baseBotScore = 1;
|
|
444
390
|
timestamp = 0;
|
|
445
|
-
providerSelectEntropy = DEFAULT_ENTROPY - undefinedCount;
|
|
446
391
|
decryptedHeadHash = "";
|
|
447
392
|
decryptionFailed = true;
|
|
448
393
|
}
|
|
@@ -451,7 +396,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
451
396
|
data: {
|
|
452
397
|
baseBotScore,
|
|
453
398
|
timestamp,
|
|
454
|
-
entropy: providerSelectEntropy,
|
|
455
399
|
userId,
|
|
456
400
|
userAgent,
|
|
457
401
|
webView,
|
|
@@ -464,7 +408,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
464
408
|
return {
|
|
465
409
|
baseBotScore: Number(baseBotScore),
|
|
466
410
|
timestamp: Number(timestamp),
|
|
467
|
-
providerSelectEntropy: Number(providerSelectEntropy),
|
|
468
411
|
userId,
|
|
469
412
|
userAgent,
|
|
470
413
|
webView: webView || false,
|
|
@@ -487,5 +430,4 @@ Object.defineProperty(exports, "FrictionlessReason", {
|
|
|
487
430
|
enumerable: true,
|
|
488
431
|
get: () => types.FrictionlessReason
|
|
489
432
|
});
|
|
490
|
-
exports.DEFAULT_ENTROPY = DEFAULT_ENTROPY;
|
|
491
433
|
exports.FrictionlessManager = FrictionlessManager;
|