@prosopo/provider 5.10.4 → 5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build$colon$cjs.log +13 -13
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +75 -0
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js +5 -17
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js.map +1 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.d.ts.map +1 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.js +3 -14
- package/dist/api/captcha/submitPoWCaptchaSolution.js.map +1 -1
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs +5 -17
- package/dist/cjs/api/captcha/submitPoWCaptchaSolution.cjs +3 -14
- package/dist/cjs/tasks/captchaManager.cjs +11 -23
- package/dist/cjs/tasks/detection/bundlePool.cjs +3 -1
- package/dist/cjs/tasks/detection/decodePayload.cjs +1140 -1137
- package/dist/cjs/tasks/detection/decodePayload.js +1 -1
- package/dist/cjs/tasks/detection/getBotScore.cjs +70 -65
- package/dist/cjs/tasks/frictionless/frictionlessTasks.cjs +39 -168
- package/dist/cjs/tasks/frictionless/routingMachine.cjs +2 -1
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +1 -0
- package/dist/cjs/tasks/powCaptcha/powTasks.cjs +2 -0
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs +1 -0
- package/dist/tasks/captchaManager.d.ts +1 -0
- package/dist/tasks/captchaManager.d.ts.map +1 -1
- package/dist/tasks/captchaManager.js +11 -23
- package/dist/tasks/captchaManager.js.map +1 -1
- package/dist/tasks/detection/bundlePool.d.ts +1 -0
- package/dist/tasks/detection/bundlePool.d.ts.map +1 -1
- package/dist/tasks/detection/bundlePool.js +3 -1
- package/dist/tasks/detection/bundlePool.js.map +1 -1
- package/dist/tasks/detection/decodePayload.d.ts +2 -2
- package/dist/tasks/detection/decodePayload.js +1 -1
- package/dist/tasks/detection/decodePayload.js.map +1 -1
- package/dist/tasks/detection/getBotScore.d.ts +10 -49
- package/dist/tasks/detection/getBotScore.d.ts.map +1 -1
- package/dist/tasks/detection/getBotScore.js +71 -66
- package/dist/tasks/detection/getBotScore.js.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.d.ts +2 -16
- package/dist/tasks/frictionless/frictionlessTasks.d.ts.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.js +39 -168
- package/dist/tasks/frictionless/frictionlessTasks.js.map +1 -1
- package/dist/tasks/frictionless/routingMachine.d.ts +2 -1
- package/dist/tasks/frictionless/routingMachine.d.ts.map +1 -1
- package/dist/tasks/frictionless/routingMachine.js +2 -1
- package/dist/tasks/frictionless/routingMachine.js.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.d.ts.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +1 -0
- 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 +2 -0
- 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 +1 -0
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js.map +1 -1
- package/dist/tests/integration/routingDecisionMachines.integration.test.js +15 -21
- package/dist/tests/integration/routingDecisionMachines.integration.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/submitPoWCaptchaSolution.escalation.unit.test.js +9 -19
- package/dist/tests/unit/api/captcha/submitPoWCaptchaSolution.escalation.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/captchaManager.unit.test.js +21 -117
- package/dist/tests/unit/tasks/captchaManager.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js +105 -66
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js +8 -24
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js +30 -12
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js.map +1 -1
- package/package.json +13 -13
|
@@ -130,6 +130,7 @@ var handler_default = (env, userAccessRulesStorage) => async (req, res, next) =>
|
|
|
130
130
|
...dedupCountryCode && { countryCode: dedupCountryCode },
|
|
131
131
|
score: dedup.session.score,
|
|
132
132
|
platform: require_devicePlatform.derivePlatform(dedupUserAgent, dedup.session.webView, { ...typeof dedupIsMobile === "boolean" && { isMobile: dedupIsMobile } }),
|
|
133
|
+
...dedup.session.d !== void 0 && { d: dedup.session.d },
|
|
133
134
|
raw: {
|
|
134
135
|
headers: dedupFlatHeaders,
|
|
135
136
|
userAgent: dedupUserAgent,
|
|
@@ -267,7 +268,7 @@ var handler_default = (env, userAccessRulesStorage) => async (req, res, next) =>
|
|
|
267
268
|
...verifiedSignerUrl && { agent: verifiedSignerUrl }
|
|
268
269
|
});
|
|
269
270
|
}
|
|
270
|
-
const { baseBotScore: rawBaseBotScore, timestamp: rawTimestamp, userId: rawUserId, userAgent: rawUserAgent, webView, iFrame, decryptedHeadHash, decryptionFailed: rawDecryptionFailed, triggeredDetectors, shadowDomPenalty,
|
|
271
|
+
const { baseBotScore: rawBaseBotScore, timestamp: rawTimestamp, userId: rawUserId, userAgent: rawUserAgent, webView, iFrame, decryptedHeadHash, decryptionFailed: rawDecryptionFailed, triggeredDetectors, shadowDomPenalty, d, bundleId } = decryptedPayload;
|
|
271
272
|
const detectorOverride = process.env.PROSOPO_TEST_FRICTIONLESS_DETECTOR_OVERRIDE === "1";
|
|
272
273
|
const baseBotScore = detectorOverride ? 0 : rawBaseBotScore;
|
|
273
274
|
const timestamp = detectorOverride ? Date.now() : rawTimestamp;
|
|
@@ -323,22 +324,8 @@ var handler_default = (env, userAccessRulesStorage) => async (req, res, next) =>
|
|
|
323
324
|
mode: sessionMode,
|
|
324
325
|
...bundleId && { bundleId },
|
|
325
326
|
...decodedSimdReadings && { simdReadings: decodedSimdReadings },
|
|
326
|
-
...
|
|
327
|
-
...
|
|
328
|
-
...entropyWallClockOffsetMs !== void 0 && { entropyWallClockOffsetMs },
|
|
329
|
-
...entropyMathRandomFirst !== void 0 && { entropyMathRandomFirst },
|
|
330
|
-
...g !== void 0 && { g },
|
|
331
|
-
...i !== void 0 && { i },
|
|
332
|
-
...cv !== void 0 && { cv },
|
|
333
|
-
...sq !== void 0 && { sq },
|
|
334
|
-
...cg !== void 0 && { cg },
|
|
335
|
-
...sm !== void 0 && { sm },
|
|
336
|
-
...dz !== void 0 && { dz },
|
|
337
|
-
...b !== void 0 && { b },
|
|
338
|
-
...sw !== void 0 && { sw },
|
|
339
|
-
...md !== void 0 && { md },
|
|
340
|
-
...bn !== void 0 && { bn },
|
|
341
|
-
...fs !== void 0 && { fs },
|
|
327
|
+
...d !== void 0 && { d },
|
|
328
|
+
...clientSessionId && { clientMetaData: { clientSessionId } },
|
|
342
329
|
...req.tcpToChelloUs !== void 0 && { tcpToChelloUs: req.tcpToChelloUs },
|
|
343
330
|
...req.chelloToHandshakeUs !== void 0 && { chelloToHandshakeUs: req.chelloToHandshakeUs },
|
|
344
331
|
...require_rawTlsSignalsMiddleware.rawTlsSignalsForSession(req)
|
|
@@ -358,6 +345,7 @@ var handler_default = (env, userAccessRulesStorage) => async (req, res, next) =>
|
|
|
358
345
|
baseImageRounds: env.config.captchas.solved.count,
|
|
359
346
|
puzzleMaxDifficulty: clientRecord.settings.puzzleMaxDifficulty,
|
|
360
347
|
platform: require_devicePlatform.derivePlatform(requestUserAgent, webView, { ...typeof ipInfoMobile === "boolean" && { isMobile: ipInfoMobile } }),
|
|
348
|
+
...d !== void 0 && { d },
|
|
361
349
|
raw: {
|
|
362
350
|
headers: flatHeaders,
|
|
363
351
|
userAgent: requestUserAgent,
|
|
@@ -175,25 +175,13 @@ var buildEscalation = async (tasks, result, challenge, perConnectionSignals, sit
|
|
|
175
175
|
headers: originSession.headers,
|
|
176
176
|
mode: originSession.mode,
|
|
177
177
|
simdReadings: originSession.simdReadings,
|
|
178
|
-
|
|
179
|
-
entropyCryptoFingerprint: originSession.entropyCryptoFingerprint,
|
|
180
|
-
entropyWallClockOffsetMs: originSession.entropyWallClockOffsetMs,
|
|
181
|
-
entropyMathRandomFirst: originSession.entropyMathRandomFirst,
|
|
178
|
+
d: originSession.d,
|
|
182
179
|
bundleId: originSession.bundleId,
|
|
183
180
|
currentUrl: originSession.currentUrl,
|
|
184
181
|
iframeUrl: originSession.iframeUrl,
|
|
185
182
|
isProtect: originSession.isProtect,
|
|
186
183
|
isEscalation: true,
|
|
187
184
|
originSessionId: originSession.sessionId,
|
|
188
|
-
g: originSession.g,
|
|
189
|
-
i: originSession.i,
|
|
190
|
-
cv: originSession.cv,
|
|
191
|
-
sq: originSession.sq,
|
|
192
|
-
b: originSession.b,
|
|
193
|
-
sw: originSession.sw,
|
|
194
|
-
md: originSession.md,
|
|
195
|
-
bn: originSession.bn,
|
|
196
|
-
fs: originSession.fs,
|
|
197
185
|
tcpToChelloUs: perConnectionSignals?.tcpToChelloUs,
|
|
198
186
|
chelloToHandshakeUs: perConnectionSignals?.chelloToHandshakeUs,
|
|
199
187
|
synNs: perConnectionSignals?.synNs,
|
|
@@ -206,7 +194,8 @@ var buildEscalation = async (tasks, result, challenge, perConnectionSignals, sit
|
|
|
206
194
|
tcpOptsOrder: perConnectionSignals?.tcpOptsOrder,
|
|
207
195
|
tcpWindow: perConnectionSignals?.tcpWindow,
|
|
208
196
|
puzzleTolerance: escalationPuzzleOverrides?.puzzleTolerance,
|
|
209
|
-
puzzle: escalationPuzzleOverrides?.puzzle
|
|
197
|
+
puzzle: escalationPuzzleOverrides?.puzzle,
|
|
198
|
+
clientMetaData: originSession.clientMetaData
|
|
210
199
|
});
|
|
211
200
|
if (tasks.writeQueue) await tasks.writeQueue.cacheSessionEscalation(powRecord.sessionId, newSession.sessionId);
|
|
212
201
|
return {
|
|
@@ -74,7 +74,7 @@ var CaptchaManager = class CaptchaManager {
|
|
|
74
74
|
* Read a session and, if it's an escalation missing one of the
|
|
75
75
|
* inherently-origin-populated fields, walk to `originSessionId` and fill
|
|
76
76
|
* the gap. Intended for the decision-machine input read path only —
|
|
77
|
-
* `simdReadings`, `dnsEvent
|
|
77
|
+
* `simdReadings`, `dnsEvent` and the detector bag are
|
|
78
78
|
* populated on the origin session (SIMD via pow-submit's fire-and-forget
|
|
79
79
|
* attach; DNS via the sidecar's origin-TLS-scoped patch) and don't
|
|
80
80
|
* automatically end up on the escalation record because
|
|
@@ -98,33 +98,20 @@ var CaptchaManager = class CaptchaManager {
|
|
|
98
98
|
if (!session.originSessionId) return session;
|
|
99
99
|
const needsSimd = session.simdReadings === void 0 || session.simdReadings === null;
|
|
100
100
|
const needsDns = session.dnsEvent === void 0 || session.dnsEvent === null;
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
const needsEntropyFirst = session.entropyMathRandomFirst === void 0;
|
|
105
|
-
const needsG = session.g === void 0;
|
|
106
|
-
const needsI = session.i === void 0;
|
|
107
|
-
const needsSw = session.sw === void 0;
|
|
108
|
-
const needsMd = session.md === void 0;
|
|
109
|
-
const needsBn = session.bn === void 0;
|
|
110
|
-
const needsFs = session.fs === void 0;
|
|
111
|
-
if (!needsSimd && !needsDns && !needsEntropyMath && !needsEntropyCrypto && !needsEntropyWall && !needsEntropyFirst && !needsG && !needsI && !needsSw && !needsMd && !needsBn && !needsFs) return session;
|
|
101
|
+
const escalationData = session.d ?? {};
|
|
102
|
+
const needsData = session.d === void 0;
|
|
103
|
+
if (!needsSimd && !needsDns && !needsData) return session;
|
|
112
104
|
const origin = await this.db.getSessionRecordBySessionId(session.originSessionId);
|
|
113
105
|
if (!origin) return session;
|
|
106
|
+
const mergedData = origin.d === void 0 ? session.d : {
|
|
107
|
+
...origin.d,
|
|
108
|
+
...escalationData
|
|
109
|
+
};
|
|
114
110
|
return {
|
|
115
111
|
...session,
|
|
116
112
|
...needsSimd && origin.simdReadings && { simdReadings: origin.simdReadings },
|
|
117
113
|
...needsDns && origin.dnsEvent && { dnsEvent: origin.dnsEvent },
|
|
118
|
-
...
|
|
119
|
-
...needsEntropyCrypto && origin.entropyCryptoFingerprint !== void 0 && { entropyCryptoFingerprint: origin.entropyCryptoFingerprint },
|
|
120
|
-
...needsEntropyWall && origin.entropyWallClockOffsetMs !== void 0 && { entropyWallClockOffsetMs: origin.entropyWallClockOffsetMs },
|
|
121
|
-
...needsEntropyFirst && origin.entropyMathRandomFirst !== void 0 && { entropyMathRandomFirst: origin.entropyMathRandomFirst },
|
|
122
|
-
...needsG && origin.g !== void 0 && { g: origin.g },
|
|
123
|
-
...needsI && origin.i !== void 0 && { i: origin.i },
|
|
124
|
-
...needsSw && origin.sw !== void 0 && { sw: origin.sw },
|
|
125
|
-
...needsMd && origin.md !== void 0 && { md: origin.md },
|
|
126
|
-
...needsBn && origin.bn !== void 0 && { bn: origin.bn },
|
|
127
|
-
...needsFs && origin.fs !== void 0 && { fs: origin.fs }
|
|
114
|
+
...mergedData !== void 0 && { d: mergedData }
|
|
128
115
|
};
|
|
129
116
|
}
|
|
130
117
|
/**
|
|
@@ -346,7 +333,8 @@ var CaptchaManager = class CaptchaManager {
|
|
|
346
333
|
return bundle ? {
|
|
347
334
|
key: bundle.privateKey,
|
|
348
335
|
innerConfig: bundle.innerConfig,
|
|
349
|
-
...bundle.payloadLayout && { payloadLayout: bundle.payloadLayout }
|
|
336
|
+
...bundle.payloadLayout && { payloadLayout: bundle.payloadLayout },
|
|
337
|
+
...bundle.keyMap && { keyMap: bundle.keyMap }
|
|
350
338
|
} : void 0;
|
|
351
339
|
}
|
|
352
340
|
/**
|
|
@@ -68,12 +68,14 @@ var DetectorBundlePool = class {
|
|
|
68
68
|
}
|
|
69
69
|
if (expectedRelease && !release) unstamped++;
|
|
70
70
|
const payloadLayout = typeof secrets.payloadLayout === "string" ? secrets.payloadLayout : void 0;
|
|
71
|
+
const keyMap = typeof secrets.keyMap === "string" ? secrets.keyMap : void 0;
|
|
71
72
|
next.set(bundleId, {
|
|
72
73
|
js,
|
|
73
74
|
privateKey: secrets.privateKey,
|
|
74
75
|
innerConfig: secrets.innerConfig,
|
|
75
76
|
...release && { release },
|
|
76
|
-
...payloadLayout && { payloadLayout }
|
|
77
|
+
...payloadLayout && { payloadLayout },
|
|
78
|
+
...keyMap && { keyMap }
|
|
77
79
|
});
|
|
78
80
|
} catch (error) {
|
|
79
81
|
logger.warn?.("failed to load bundle pool entry", {
|