@prosopo/provider 4.11.3 → 4.11.5
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 +12 -12
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +13 -13
- package/CHANGELOG.md +55 -2
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.d.ts.map +1 -1
- package/dist/api/blacklistRequestInspector.d.ts +3 -1
- package/dist/api/blacklistRequestInspector.d.ts.map +1 -1
- package/dist/api/blacklistRequestInspector.js +11 -3
- package/dist/api/blacklistRequestInspector.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js +47 -41
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js +18 -2
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js.map +1 -1
- package/dist/cjs/api/blacklistRequestInspector.cjs +11 -3
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.cjs +47 -41
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs +18 -2
- package/dist/cjs/tasks/captchaManager.cjs +11 -4
- package/dist/cjs/tasks/detection/getBotScore.cjs +9 -1
- package/dist/cjs/tasks/frictionless/frictionlessTasks.cjs +38 -6
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +12 -1
- package/dist/cjs/tasks/powCaptcha/powTasks.cjs +48 -2
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs +43 -2
- package/dist/cjs/tasks/spam/checkTrafficFilter.cjs +22 -10
- package/dist/tasks/captchaManager.d.ts +3 -1
- package/dist/tasks/captchaManager.d.ts.map +1 -1
- package/dist/tasks/captchaManager.js +11 -4
- package/dist/tasks/captchaManager.js.map +1 -1
- package/dist/tasks/detection/getBotScore.d.ts +8 -0
- package/dist/tasks/detection/getBotScore.d.ts.map +1 -1
- package/dist/tasks/detection/getBotScore.js +9 -1
- package/dist/tasks/detection/getBotScore.js.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.d.ts +5 -1
- package/dist/tasks/frictionless/frictionlessTasks.d.ts.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.js +38 -6
- package/dist/tasks/frictionless/frictionlessTasks.js.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.d.ts.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +12 -1
- 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 +49 -3
- 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 +44 -3
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js.map +1 -1
- package/dist/tasks/spam/checkTrafficFilter.d.ts +1 -1
- package/dist/tasks/spam/checkTrafficFilter.d.ts.map +1 -1
- package/dist/tasks/spam/checkTrafficFilter.js +22 -10
- package/dist/tasks/spam/checkTrafficFilter.js.map +1 -1
- package/dist/tests/integration/clientSettingsPersistence.integration.test.js +16 -1
- package/dist/tests/integration/clientSettingsPersistence.integration.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js +137 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js +89 -1
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js +96 -1
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js +133 -1
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js +90 -1
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js +86 -0
- package/dist/tests/unit/tasks/spam/checkTrafficFilter.unit.test.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/api/captcha/getFrictionlessCaptchaChallenge/handler.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;8BAmBtD,mBAAmB,0BACA,kBAAkB,WAGpC,OAAO,GAAG,gBAAgB,OAC1B,QAAQ,QACP,YAAY;AAPpB,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/api/captcha/getFrictionlessCaptchaChallenge/handler.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;8BAmBtD,mBAAmB,0BACA,kBAAkB,WAGpC,OAAO,GAAG,gBAAgB,OAC1B,QAAQ,QACP,YAAY;AAPpB,wBAgYG"}
|
|
@@ -187,7 +187,11 @@ const getFrictionlessCaptchaChallenge = (env, userAccessRulesStorage) => async (
|
|
|
187
187
|
decryptedHeadHash,
|
|
188
188
|
decryptionFailed,
|
|
189
189
|
triggeredDetectors,
|
|
190
|
-
shadowDomPenalty
|
|
190
|
+
shadowDomPenalty,
|
|
191
|
+
entropyMathRandomFingerprint,
|
|
192
|
+
entropyCryptoFingerprint,
|
|
193
|
+
entropyWallClockOffsetMs,
|
|
194
|
+
entropyMathRandomFirst
|
|
191
195
|
} = decryptedPayload;
|
|
192
196
|
req.logger.debug(() => ({
|
|
193
197
|
msg: "Decrypted payload",
|
|
@@ -232,7 +236,19 @@ const getFrictionlessCaptchaChallenge = (env, userAccessRulesStorage) => async (
|
|
|
232
236
|
ipInfo: req.ipInfo,
|
|
233
237
|
headers: flatHeaders,
|
|
234
238
|
mode: sessionMode,
|
|
235
|
-
...decodedSimdReadings && { simdReadings: decodedSimdReadings }
|
|
239
|
+
...decodedSimdReadings && { simdReadings: decodedSimdReadings },
|
|
240
|
+
...entropyMathRandomFingerprint !== void 0 && {
|
|
241
|
+
entropyMathRandomFingerprint
|
|
242
|
+
},
|
|
243
|
+
...entropyCryptoFingerprint !== void 0 && {
|
|
244
|
+
entropyCryptoFingerprint
|
|
245
|
+
},
|
|
246
|
+
...entropyWallClockOffsetMs !== void 0 && {
|
|
247
|
+
entropyWallClockOffsetMs
|
|
248
|
+
},
|
|
249
|
+
...entropyMathRandomFirst !== void 0 && {
|
|
250
|
+
entropyMathRandomFirst
|
|
251
|
+
}
|
|
236
252
|
});
|
|
237
253
|
const ipInfoMobile = req.ipInfo && "isValid" in req.ipInfo && req.ipInfo.isValid ? req.ipInfo.isMobile : void 0;
|
|
238
254
|
const safeUserAgent = userAgent ?? "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../src/api/captcha/getFrictionlessCaptchaChallenge/handler.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,SAAS,EACT,WAAW,EACX,0CAA0C,EAC1C,QAAQ,GAER,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oCAAoC,EAAE,MAAM,mBAAmB,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AmB,CAAC,cAAc,CACtD,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CACpC,CAAC;QAEF,MAAM,SAAS,GAAG,mBAAmB,CACpC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EACpB,GAAG,CAAC,GAAG,EACP,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,SAAS,EACT,WAAW,EACX,GAAG,CACH,CAAC;QAOF,MAAM,CAAC,gBAAgB,EAAE,UAAU,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACxE,KAAK,CAAC,mBAAmB,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC;YACzD,KAAK,CAAC,mBAAmB,CAAC,cAAc,CACvC,YAAY,EACZ,WAAW,CAAC,YAAY,EACxB,GAAG,CACH;YACD,KAAK,CAAC,mBAAmB,CAAC,4BAA4B,CACrD,sBAAsB,EACtB,IAAI,EACJ,SAAS,CACT;SACD,CAAC,CAAC;QAEH,MAAM,EACL,YAAY,EACZ,SAAS,EACT,qBAAqB,EACrB,MAAM,EACN,SAAS,EACT,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../src/api/captcha/getFrictionlessCaptchaChallenge/handler.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,SAAS,EACT,WAAW,EACX,0CAA0C,EAC1C,QAAQ,GAER,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAA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CAAC,CAAC;YACvB,GAAG;YACH,GAAG,EAAE,yCAAyC;SAC9C,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CACV,IAAI,eAAe,CAAC,iBAAiB,EAAE;YACtC,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;YAClC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,GAAG,CAAC,MAAM;SAClB,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -103,7 +103,7 @@ const rankCandidateRules = (rules, request, requestClientId) => rules.filter((ru
|
|
|
103
103
|
}
|
|
104
104
|
return policySeverity(b) - policySeverity(a);
|
|
105
105
|
});
|
|
106
|
-
const getPrioritisedAccessRule = async (userAccessRulesStorage, userScope, clientId) => {
|
|
106
|
+
const getPrioritisedAccessRule = async (userAccessRulesStorage, userScope, clientId, options) => {
|
|
107
107
|
const parsedUserScope = userAccessPolicy.userScopeInput.parse(userScope);
|
|
108
108
|
const filter = {
|
|
109
109
|
...clientId && {
|
|
@@ -113,7 +113,8 @@ const getPrioritisedAccessRule = async (userAccessRulesStorage, userScope, clien
|
|
|
113
113
|
},
|
|
114
114
|
policyScopeMatch: userAccessPolicy.FilterScopeMatch.Greedy,
|
|
115
115
|
userScope: parsedUserScope,
|
|
116
|
-
userScopeMatch: userAccessPolicy.FilterScopeMatch.Greedy
|
|
116
|
+
userScopeMatch: userAccessPolicy.FilterScopeMatch.Greedy,
|
|
117
|
+
...options?.blockOnly && { blockOnly: true }
|
|
117
118
|
};
|
|
118
119
|
const candidates = await userAccessRulesStorage.findRules(
|
|
119
120
|
filter,
|
|
@@ -186,7 +187,14 @@ class BlacklistRequestInspector {
|
|
|
186
187
|
countryCode,
|
|
187
188
|
asn
|
|
188
189
|
),
|
|
189
|
-
clientId
|
|
190
|
+
clientId,
|
|
191
|
+
// Request-time middleware only ever fires on Block policies
|
|
192
|
+
// (Restrict rules flow through and let the captcha-creation
|
|
193
|
+
// path decorate the response). Restrict the Redis-side
|
|
194
|
+
// candidate pool so the SERVER_SIDE_RANK_TOP_N cap can't
|
|
195
|
+
// crowd out hard-block rules in clients with dense Restrict
|
|
196
|
+
// rule populations.
|
|
197
|
+
{ blockOnly: true }
|
|
190
198
|
);
|
|
191
199
|
const enforceable = (accessPolicies ?? []).filter(
|
|
192
200
|
(p) => !p.deferToVerify
|
|
@@ -21,6 +21,51 @@ const runDecisionMachine = async (input, handle) => {
|
|
|
21
21
|
} = input;
|
|
22
22
|
const { req, res } = handle;
|
|
23
23
|
let { botScore, scoreComponents } = input;
|
|
24
|
+
const userAgentMismatchResponse = await runUserAgentMismatchCheck(
|
|
25
|
+
input,
|
|
26
|
+
handle
|
|
27
|
+
);
|
|
28
|
+
if (userAgentMismatchResponse) return userAgentMismatchResponse;
|
|
29
|
+
const contextResponse = await runContextAwareValidation(input, handle);
|
|
30
|
+
if (contextResponse) return contextResponse;
|
|
31
|
+
const webViewTripped = clientRecord.settings.disallowWebView === true && input.webView === true;
|
|
32
|
+
if (webViewTripped) {
|
|
33
|
+
tasks.logger.info(() => ({ msg: "WebView detected" }));
|
|
34
|
+
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseWebView(
|
|
35
|
+
input.baseBotScore,
|
|
36
|
+
botScore,
|
|
37
|
+
scoreComponents
|
|
38
|
+
);
|
|
39
|
+
botScore = scoreUpdate.score;
|
|
40
|
+
scoreComponents = scoreUpdate.scoreComponents;
|
|
41
|
+
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
42
|
+
}
|
|
43
|
+
const timestampTripped = frictionlessTasks.FrictionlessManager.timestampTooOld(input.timestamp);
|
|
44
|
+
if (timestampTripped) {
|
|
45
|
+
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseTimestamp(
|
|
46
|
+
input.timestamp,
|
|
47
|
+
input.baseBotScore,
|
|
48
|
+
botScore,
|
|
49
|
+
scoreComponents
|
|
50
|
+
);
|
|
51
|
+
botScore = scoreUpdate.score;
|
|
52
|
+
scoreComponents = scoreUpdate.scoreComponents;
|
|
53
|
+
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
54
|
+
}
|
|
55
|
+
const hostVerified = await tasks.frictionlessManager.hostVerified(
|
|
56
|
+
input.providerSelectEntropy
|
|
57
|
+
);
|
|
58
|
+
if (!hostVerified.verified) {
|
|
59
|
+
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseUnverifiedHost(
|
|
60
|
+
hostVerified.domain,
|
|
61
|
+
input.baseBotScore,
|
|
62
|
+
botScore,
|
|
63
|
+
scoreComponents
|
|
64
|
+
);
|
|
65
|
+
botScore = scoreUpdate.score;
|
|
66
|
+
scoreComponents = scoreUpdate.scoreComponents;
|
|
67
|
+
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
68
|
+
}
|
|
24
69
|
const autoBanThreshold = clientRecord.settings.autoBanScoreThreshold;
|
|
25
70
|
if (autoBanThreshold !== void 0 && Number(botScore) >= autoBanThreshold) {
|
|
26
71
|
req.logger.info(() => ({
|
|
@@ -43,23 +88,7 @@ const runDecisionMachine = async (input, handle) => {
|
|
|
43
88
|
});
|
|
44
89
|
return res.status(401).json({ error: "Unauthorized" });
|
|
45
90
|
}
|
|
46
|
-
|
|
47
|
-
input,
|
|
48
|
-
handle
|
|
49
|
-
);
|
|
50
|
-
if (userAgentMismatchResponse) return userAgentMismatchResponse;
|
|
51
|
-
const contextResponse = await runContextAwareValidation(input, handle);
|
|
52
|
-
if (contextResponse) return contextResponse;
|
|
53
|
-
if (clientRecord.settings.disallowWebView && input.webView) {
|
|
54
|
-
tasks.logger.info(() => ({ msg: "WebView detected" }));
|
|
55
|
-
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseWebView(
|
|
56
|
-
input.baseBotScore,
|
|
57
|
-
botScore,
|
|
58
|
-
scoreComponents
|
|
59
|
-
);
|
|
60
|
-
botScore = scoreUpdate.score;
|
|
61
|
-
scoreComponents = scoreUpdate.scoreComponents;
|
|
62
|
-
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
91
|
+
if (webViewTripped) {
|
|
63
92
|
req.logger.info(() => ({
|
|
64
93
|
msg: "Frictionless decision",
|
|
65
94
|
data: {
|
|
@@ -83,16 +112,7 @@ const runDecisionMachine = async (input, handle) => {
|
|
|
83
112
|
})
|
|
84
113
|
);
|
|
85
114
|
}
|
|
86
|
-
if (
|
|
87
|
-
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseTimestamp(
|
|
88
|
-
input.timestamp,
|
|
89
|
-
input.baseBotScore,
|
|
90
|
-
botScore,
|
|
91
|
-
scoreComponents
|
|
92
|
-
);
|
|
93
|
-
botScore = scoreUpdate.score;
|
|
94
|
-
scoreComponents = scoreUpdate.scoreComponents;
|
|
95
|
-
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
115
|
+
if (timestampTripped) {
|
|
96
116
|
req.logger.info(() => ({
|
|
97
117
|
msg: "Frictionless decision",
|
|
98
118
|
data: {
|
|
@@ -117,20 +137,6 @@ const runDecisionMachine = async (input, handle) => {
|
|
|
117
137
|
})
|
|
118
138
|
);
|
|
119
139
|
}
|
|
120
|
-
const hostVerified = await tasks.frictionlessManager.hostVerified(
|
|
121
|
-
input.providerSelectEntropy
|
|
122
|
-
);
|
|
123
|
-
if (!hostVerified.verified) {
|
|
124
|
-
const scoreUpdate = tasks.frictionlessManager.scoreIncreaseUnverifiedHost(
|
|
125
|
-
hostVerified.domain,
|
|
126
|
-
input.baseBotScore,
|
|
127
|
-
botScore,
|
|
128
|
-
scoreComponents
|
|
129
|
-
);
|
|
130
|
-
botScore = scoreUpdate.score;
|
|
131
|
-
scoreComponents = scoreUpdate.scoreComponents;
|
|
132
|
-
tasks.frictionlessManager.updateScore(botScore, scoreComponents);
|
|
133
|
-
}
|
|
134
140
|
if (Number(botScore) > input.botThreshold) {
|
|
135
141
|
req.logger.info(() => ({
|
|
136
142
|
msg: "Bot score is greater than threshold",
|
|
@@ -188,7 +188,11 @@ const getFrictionlessCaptchaChallenge = (env, userAccessRulesStorage) => async (
|
|
|
188
188
|
decryptedHeadHash,
|
|
189
189
|
decryptionFailed,
|
|
190
190
|
triggeredDetectors,
|
|
191
|
-
shadowDomPenalty
|
|
191
|
+
shadowDomPenalty,
|
|
192
|
+
entropyMathRandomFingerprint,
|
|
193
|
+
entropyCryptoFingerprint,
|
|
194
|
+
entropyWallClockOffsetMs,
|
|
195
|
+
entropyMathRandomFirst
|
|
192
196
|
} = decryptedPayload;
|
|
193
197
|
req.logger.debug(() => ({
|
|
194
198
|
msg: "Decrypted payload",
|
|
@@ -233,7 +237,19 @@ const getFrictionlessCaptchaChallenge = (env, userAccessRulesStorage) => async (
|
|
|
233
237
|
ipInfo: req.ipInfo,
|
|
234
238
|
headers: flatHeaders,
|
|
235
239
|
mode: sessionMode,
|
|
236
|
-
...decodedSimdReadings && { simdReadings: decodedSimdReadings }
|
|
240
|
+
...decodedSimdReadings && { simdReadings: decodedSimdReadings },
|
|
241
|
+
...entropyMathRandomFingerprint !== void 0 && {
|
|
242
|
+
entropyMathRandomFingerprint
|
|
243
|
+
},
|
|
244
|
+
...entropyCryptoFingerprint !== void 0 && {
|
|
245
|
+
entropyCryptoFingerprint
|
|
246
|
+
},
|
|
247
|
+
...entropyWallClockOffsetMs !== void 0 && {
|
|
248
|
+
entropyWallClockOffsetMs
|
|
249
|
+
},
|
|
250
|
+
...entropyMathRandomFirst !== void 0 && {
|
|
251
|
+
entropyMathRandomFirst
|
|
252
|
+
}
|
|
237
253
|
});
|
|
238
254
|
const ipInfoMobile = req.ipInfo && "isValid" in req.ipInfo && req.ipInfo.isValid ? req.ipInfo.isMobile : void 0;
|
|
239
255
|
const safeUserAgent = userAgent ?? "";
|
|
@@ -253,11 +253,12 @@ class CaptchaManager {
|
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
async getPrioritisedAccessPolicies(userAccessRulesStorage, clientId, userScope) {
|
|
256
|
+
async getPrioritisedAccessPolicies(userAccessRulesStorage, clientId, userScope, options) {
|
|
257
257
|
return blacklistRequestInspector.getPrioritisedAccessRule(
|
|
258
258
|
userAccessRulesStorage,
|
|
259
259
|
userScope,
|
|
260
|
-
clientId
|
|
260
|
+
clientId,
|
|
261
|
+
options
|
|
261
262
|
);
|
|
262
263
|
}
|
|
263
264
|
async getDetectorKeys() {
|
|
@@ -380,7 +381,12 @@ class CaptchaManager {
|
|
|
380
381
|
const accessPolicies = await this.getPrioritisedAccessPolicies(
|
|
381
382
|
userAccessRulesStorage,
|
|
382
383
|
challengeRecord.dappAccount,
|
|
383
|
-
userScope
|
|
384
|
+
userScope,
|
|
385
|
+
// Hard-block lookup only — restrict the Redis-side candidate
|
|
386
|
+
// pool to Block rules so the SERVER_SIDE_RANK_TOP_N cap can't
|
|
387
|
+
// crowd a hard-block out of the top-N with Restrict or
|
|
388
|
+
// routing-Block (captchaType-scoped) entries.
|
|
389
|
+
{ blockOnly: true }
|
|
384
390
|
);
|
|
385
391
|
return findHardBlockPolicy(accessPolicies);
|
|
386
392
|
}
|
|
@@ -422,7 +428,8 @@ class CaptchaManager {
|
|
|
422
428
|
return checkTrafficFilter.checkTrafficFilter(
|
|
423
429
|
ipInfo,
|
|
424
430
|
effective,
|
|
425
|
-
enrichDnsEvent.extraIpInfosFromEnrichedDnsEvent(enrichedDnsEvent)
|
|
431
|
+
enrichDnsEvent.extraIpInfosFromEnrichedDnsEvent(enrichedDnsEvent),
|
|
432
|
+
enrichedDnsEvent?.pathValid
|
|
426
433
|
);
|
|
427
434
|
}
|
|
428
435
|
static canClientSeeScore(tier, score) {
|
|
@@ -18,6 +18,10 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
18
18
|
const decryptedHeadHash = result.decryptedHeadHash;
|
|
19
19
|
const triggeredDetectors = result.triggeredDetectors;
|
|
20
20
|
const shadowDomPenalty = result.shadowDomPenalty;
|
|
21
|
+
const entropyMathRandomFingerprint = result.entropyMathRandomFingerprint;
|
|
22
|
+
const entropyCryptoFingerprint = result.entropyCryptoFingerprint;
|
|
23
|
+
const entropyWallClockOffsetMs = result.entropyWallClockOffsetMs;
|
|
24
|
+
const entropyMathRandomFirst = result.entropyMathRandomFirst;
|
|
21
25
|
if (baseBotScore === void 0 || Number.isNaN(baseBotScore)) {
|
|
22
26
|
return {
|
|
23
27
|
baseBotScore: 1,
|
|
@@ -35,7 +39,11 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
35
39
|
isIframe,
|
|
36
40
|
decryptedHeadHash,
|
|
37
41
|
triggeredDetectors,
|
|
38
|
-
shadowDomPenalty
|
|
42
|
+
shadowDomPenalty,
|
|
43
|
+
entropyMathRandomFingerprint,
|
|
44
|
+
entropyCryptoFingerprint,
|
|
45
|
+
entropyWallClockOffsetMs,
|
|
46
|
+
entropyMathRandomFirst
|
|
39
47
|
};
|
|
40
48
|
};
|
|
41
49
|
exports.getBotScore = getBotScore;
|
|
@@ -58,7 +58,11 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
58
58
|
ipInfo: params.ipInfo,
|
|
59
59
|
headers: params.headers,
|
|
60
60
|
mode: params.mode,
|
|
61
|
-
simdReadings: params.simdReadings
|
|
61
|
+
simdReadings: params.simdReadings,
|
|
62
|
+
entropyMathRandomFingerprint: params.entropyMathRandomFingerprint,
|
|
63
|
+
entropyCryptoFingerprint: params.entropyCryptoFingerprint,
|
|
64
|
+
entropyWallClockOffsetMs: params.entropyWallClockOffsetMs,
|
|
65
|
+
entropyMathRandomFirst: params.entropyMathRandomFirst
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
updateScore(score, scoreComponents) {
|
|
@@ -70,7 +74,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
70
74
|
checkLangRules(acceptLanguage) {
|
|
71
75
|
return lang.checkLangRules(this.config, acceptLanguage);
|
|
72
76
|
}
|
|
73
|
-
async createSession(token, score, threshold, scoreComponents, providerSelectEntropy, ipAddress, captchaType, siteKey, solvedImagesCount, powDifficulty, userSitekeyIpHash, webView = false, iFrame = false, decryptedHeadHash = "", reason, blocked, deleted, ipInfo, headers, mode, simdReadings) {
|
|
77
|
+
async createSession(token, score, threshold, scoreComponents, providerSelectEntropy, ipAddress, captchaType, siteKey, solvedImagesCount, powDifficulty, userSitekeyIpHash, webView = false, iFrame = false, decryptedHeadHash = "", reason, blocked, deleted, ipInfo, headers, mode, simdReadings, entropyMathRandomFingerprint, entropyCryptoFingerprint, entropyWallClockOffsetMs, entropyMathRandomFirst) {
|
|
74
78
|
const sessionRecord = {
|
|
75
79
|
sessionId: `${getSessionIDPrefix(this.config.host)}-${uuid.v4()}`,
|
|
76
80
|
createdAt: /* @__PURE__ */ new Date(),
|
|
@@ -99,7 +103,11 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
99
103
|
// this hop. Absence of readings → absence of stage.
|
|
100
104
|
...simdReadings && {
|
|
101
105
|
simdReadingsStage: types.SimdReadingsStage.frictionless
|
|
102
|
-
}
|
|
106
|
+
},
|
|
107
|
+
entropyMathRandomFingerprint,
|
|
108
|
+
entropyCryptoFingerprint,
|
|
109
|
+
entropyWallClockOffsetMs,
|
|
110
|
+
entropyMathRandomFirst
|
|
103
111
|
};
|
|
104
112
|
await this.db.storeSessionRecord(sessionRecord);
|
|
105
113
|
if (this.writeQueue) {
|
|
@@ -195,7 +203,11 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
195
203
|
effectiveParams.ipInfo,
|
|
196
204
|
effectiveParams.headers,
|
|
197
205
|
effectiveParams.mode,
|
|
198
|
-
effectiveParams.simdReadings
|
|
206
|
+
effectiveParams.simdReadings,
|
|
207
|
+
effectiveParams.entropyMathRandomFingerprint,
|
|
208
|
+
effectiveParams.entropyCryptoFingerprint,
|
|
209
|
+
effectiveParams.entropyWallClockOffsetMs,
|
|
210
|
+
effectiveParams.entropyMathRandomFirst
|
|
199
211
|
);
|
|
200
212
|
if (this.routingContext && this.usageCounters) {
|
|
201
213
|
this.usageCounters.incrManyAsync(
|
|
@@ -347,6 +359,10 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
347
359
|
let decryptionFailed = false;
|
|
348
360
|
let triggeredDetectors;
|
|
349
361
|
let shadowDomPenalty;
|
|
362
|
+
let entropyMathRandomFingerprint;
|
|
363
|
+
let entropyCryptoFingerprint;
|
|
364
|
+
let entropyWallClockOffsetMs;
|
|
365
|
+
let entropyMathRandomFirst;
|
|
350
366
|
for (const [keyIndex, key] of decryptKeys.entries()) {
|
|
351
367
|
try {
|
|
352
368
|
this.logger.info(() => ({
|
|
@@ -366,6 +382,10 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
366
382
|
const i = decrypted.isIframe;
|
|
367
383
|
const td = decrypted.triggeredDetectors;
|
|
368
384
|
const sd = decrypted.shadowDomPenalty;
|
|
385
|
+
const ef = decrypted.entropyMathRandomFingerprint;
|
|
386
|
+
const ec = decrypted.entropyCryptoFingerprint;
|
|
387
|
+
const eo = decrypted.entropyWallClockOffsetMs;
|
|
388
|
+
const em = decrypted.entropyMathRandomFirst;
|
|
369
389
|
this.logger.debug(() => ({
|
|
370
390
|
msg: "Successfully decrypted score",
|
|
371
391
|
data: {
|
|
@@ -378,7 +398,11 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
378
398
|
webView: w,
|
|
379
399
|
iFrame: i,
|
|
380
400
|
triggeredDetectors: td,
|
|
381
|
-
shadowDomPenalty: sd
|
|
401
|
+
shadowDomPenalty: sd,
|
|
402
|
+
entropyMathRandomFingerprint: ef,
|
|
403
|
+
entropyCryptoFingerprint: ec,
|
|
404
|
+
entropyWallClockOffsetMs: eo,
|
|
405
|
+
entropyMathRandomFirst: em
|
|
382
406
|
}
|
|
383
407
|
}));
|
|
384
408
|
baseBotScore = s;
|
|
@@ -390,6 +414,10 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
390
414
|
iFrame = i;
|
|
391
415
|
triggeredDetectors = td;
|
|
392
416
|
shadowDomPenalty = sd;
|
|
417
|
+
entropyMathRandomFingerprint = ef;
|
|
418
|
+
entropyCryptoFingerprint = ec;
|
|
419
|
+
entropyWallClockOffsetMs = eo;
|
|
420
|
+
entropyMathRandomFirst = em;
|
|
393
421
|
break;
|
|
394
422
|
} catch (err) {
|
|
395
423
|
if (keyIndex === decryptKeys.length - 1) {
|
|
@@ -444,7 +472,11 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
444
472
|
decryptedHeadHash,
|
|
445
473
|
decryptionFailed,
|
|
446
474
|
triggeredDetectors,
|
|
447
|
-
shadowDomPenalty
|
|
475
|
+
shadowDomPenalty,
|
|
476
|
+
entropyMathRandomFingerprint,
|
|
477
|
+
entropyCryptoFingerprint,
|
|
478
|
+
entropyWallClockOffsetMs,
|
|
479
|
+
entropyMathRandomFirst
|
|
448
480
|
};
|
|
449
481
|
}
|
|
450
482
|
async getClientContextEntropy(siteKey, contextType) {
|
|
@@ -693,7 +693,18 @@ class ImgCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
693
693
|
captchaType: types.CaptchaType.image,
|
|
694
694
|
countryCode: solution.ipInfo?.isValid ? solution.ipInfo.countryCode : void 0,
|
|
695
695
|
ipInfo: solution.ipInfo,
|
|
696
|
-
dnsEvent: enrichedDnsEvent
|
|
696
|
+
dnsEvent: enrichedDnsEvent,
|
|
697
|
+
score,
|
|
698
|
+
threshold: sessionRecord?.threshold,
|
|
699
|
+
scoreComponents: sessionRecord?.scoreComponents,
|
|
700
|
+
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
701
|
+
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
702
|
+
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
703
|
+
simdReadings: sessionRecord?.simdReadings,
|
|
704
|
+
frictionlessReason: sessionRecord?.reason,
|
|
705
|
+
ruleType: sessionRecord?.ruleType,
|
|
706
|
+
webView: sessionRecord?.webView,
|
|
707
|
+
iFrame: sessionRecord?.iFrame
|
|
697
708
|
};
|
|
698
709
|
try {
|
|
699
710
|
const decision = await this.decisionMachineRunner.decide(
|
|
@@ -89,13 +89,19 @@ class PowCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
89
89
|
}
|
|
90
90
|
const difficulty = challengeRecord.difficulty;
|
|
91
91
|
let coords;
|
|
92
|
+
let saltDecodeError;
|
|
92
93
|
if (salt) {
|
|
93
94
|
try {
|
|
94
95
|
const extractedData = util$1.extractData(salt);
|
|
95
96
|
if (extractedData.length >= 2) {
|
|
96
|
-
|
|
97
|
+
const built = [
|
|
98
|
+
[[extractedData[0], extractedData[1]]]
|
|
99
|
+
];
|
|
100
|
+
util$1.assertCoordsSafe(built, "coords");
|
|
101
|
+
coords = built;
|
|
97
102
|
}
|
|
98
103
|
} catch (error) {
|
|
104
|
+
saltDecodeError = error;
|
|
99
105
|
this.logger.warn(() => ({
|
|
100
106
|
msg: "Failed to extract coordinates from salt",
|
|
101
107
|
error,
|
|
@@ -103,6 +109,35 @@ class PowCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
103
109
|
}));
|
|
104
110
|
}
|
|
105
111
|
}
|
|
112
|
+
if (saltDecodeError) {
|
|
113
|
+
const badSaltResult = {
|
|
114
|
+
status: types.CaptchaStatus.disapproved,
|
|
115
|
+
reason: types.ResultReason.CAPTCHA_INVALID_SALT
|
|
116
|
+
};
|
|
117
|
+
const writePromises2 = [
|
|
118
|
+
this.db.updatePowCaptchaRecordResult(
|
|
119
|
+
challenge,
|
|
120
|
+
badSaltResult,
|
|
121
|
+
false,
|
|
122
|
+
// serverChecked
|
|
123
|
+
true,
|
|
124
|
+
// userSubmitted
|
|
125
|
+
userTimestampSignature,
|
|
126
|
+
void 0
|
|
127
|
+
// never persist the bad coords
|
|
128
|
+
)
|
|
129
|
+
];
|
|
130
|
+
if (challengeRecord.sessionId) {
|
|
131
|
+
writePromises2.push(
|
|
132
|
+
this.updateSessionRecordWithCache(challengeRecord.sessionId, {
|
|
133
|
+
userSubmitted: true,
|
|
134
|
+
result: badSaltResult
|
|
135
|
+
})
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
await Promise.all(writePromises2);
|
|
139
|
+
return { verified: false };
|
|
140
|
+
}
|
|
106
141
|
if (!util$1.verifyRecency(challenge, timeout)) {
|
|
107
142
|
const timeoutResult = {
|
|
108
143
|
status: types.CaptchaStatus.disapproved,
|
|
@@ -547,7 +582,18 @@ class PowCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
547
582
|
deviceCapability: challengeRecord.deviceCapability,
|
|
548
583
|
countryCode: challengeRecord.ipInfo?.isValid ? challengeRecord.ipInfo.countryCode : void 0,
|
|
549
584
|
ipInfo: challengeRecord.ipInfo,
|
|
550
|
-
dnsEvent: enrichedDnsEvent
|
|
585
|
+
dnsEvent: enrichedDnsEvent,
|
|
586
|
+
score,
|
|
587
|
+
threshold: sessionRecord?.threshold,
|
|
588
|
+
scoreComponents: sessionRecord?.scoreComponents,
|
|
589
|
+
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
590
|
+
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
591
|
+
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
592
|
+
simdReadings: sessionRecord?.simdReadings,
|
|
593
|
+
frictionlessReason: sessionRecord?.reason,
|
|
594
|
+
ruleType: sessionRecord?.ruleType,
|
|
595
|
+
webView: sessionRecord?.webView,
|
|
596
|
+
iFrame: sessionRecord?.iFrame
|
|
551
597
|
};
|
|
552
598
|
const decision = await this.decisionMachineRunner.decide(
|
|
553
599
|
decisionInput,
|
|
@@ -87,13 +87,19 @@ class PuzzleCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
let coords;
|
|
90
|
+
let saltDecodeError;
|
|
90
91
|
if (salt) {
|
|
91
92
|
try {
|
|
92
93
|
const extractedData = util$1.extractData(salt);
|
|
93
94
|
if (extractedData.length >= 2) {
|
|
94
|
-
|
|
95
|
+
const built = [
|
|
96
|
+
[[extractedData[0], extractedData[1]]]
|
|
97
|
+
];
|
|
98
|
+
util$1.assertCoordsSafe(built, "coords");
|
|
99
|
+
coords = built;
|
|
95
100
|
}
|
|
96
101
|
} catch (error) {
|
|
102
|
+
saltDecodeError = error;
|
|
97
103
|
this.logger.warn(() => ({
|
|
98
104
|
msg: "Failed to extract coordinates from salt",
|
|
99
105
|
error,
|
|
@@ -107,6 +113,30 @@ class PuzzleCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
107
113
|
}));
|
|
108
114
|
return false;
|
|
109
115
|
}
|
|
116
|
+
if (saltDecodeError) {
|
|
117
|
+
const badSaltResult = {
|
|
118
|
+
status: types.CaptchaStatus.disapproved,
|
|
119
|
+
reason: types.ResultReason.CAPTCHA_INVALID_SALT
|
|
120
|
+
};
|
|
121
|
+
await this.db.updatePuzzleCaptchaRecordResult(
|
|
122
|
+
challenge,
|
|
123
|
+
badSaltResult,
|
|
124
|
+
false,
|
|
125
|
+
// serverChecked
|
|
126
|
+
true,
|
|
127
|
+
// userSubmitted
|
|
128
|
+
userTimestampSignature,
|
|
129
|
+
void 0
|
|
130
|
+
// never persist the bad coords
|
|
131
|
+
);
|
|
132
|
+
if (challengeRecord.sessionId) {
|
|
133
|
+
await this.updateSessionRecordWithCache(challengeRecord.sessionId, {
|
|
134
|
+
userSubmitted: true,
|
|
135
|
+
result: badSaltResult
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
110
140
|
if (!util$1.verifyRecency(challenge, timeout)) {
|
|
111
141
|
const timeoutResult = {
|
|
112
142
|
status: types.CaptchaStatus.disapproved,
|
|
@@ -495,7 +525,18 @@ class PuzzleCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
495
525
|
deviceCapability: challengeRecord.deviceCapability,
|
|
496
526
|
countryCode: challengeRecord.ipInfo?.isValid ? challengeRecord.ipInfo.countryCode : void 0,
|
|
497
527
|
ipInfo: challengeRecord.ipInfo,
|
|
498
|
-
dnsEvent: enrichedDnsEvent
|
|
528
|
+
dnsEvent: enrichedDnsEvent,
|
|
529
|
+
score,
|
|
530
|
+
threshold: sessionRecord?.threshold,
|
|
531
|
+
scoreComponents: sessionRecord?.scoreComponents,
|
|
532
|
+
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
533
|
+
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
534
|
+
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
535
|
+
simdReadings: sessionRecord?.simdReadings,
|
|
536
|
+
frictionlessReason: sessionRecord?.reason,
|
|
537
|
+
ruleType: sessionRecord?.ruleType,
|
|
538
|
+
webView: sessionRecord?.webView,
|
|
539
|
+
iFrame: sessionRecord?.iFrame
|
|
499
540
|
};
|
|
500
541
|
const decision = await this.decisionMachineRunner.decide(
|
|
501
542
|
decisionInput,
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const types = require("@prosopo/types");
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
4
|
+
const isDatacenterAllowlisted = (ipInfo, allowlist) => {
|
|
5
|
+
if (!allowlist || allowlist.length === 0) {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const candidates = [];
|
|
9
|
+
for (const value of [
|
|
10
|
+
ipInfo.datacenterName,
|
|
11
|
+
ipInfo.providerName,
|
|
12
|
+
ipInfo.asnOrganization
|
|
13
|
+
]) {
|
|
14
|
+
if (typeof value !== "string") continue;
|
|
15
|
+
const trimmed = value.trim().toLowerCase();
|
|
16
|
+
if (trimmed) candidates.push(trimmed);
|
|
17
|
+
}
|
|
18
|
+
if (candidates.length === 0) {
|
|
10
19
|
return false;
|
|
11
20
|
}
|
|
12
|
-
|
|
21
|
+
const normalisedAllowlist = allowlist.map(
|
|
22
|
+
(entry) => entry.trim().toLowerCase()
|
|
23
|
+
);
|
|
24
|
+
return candidates.some((c) => normalisedAllowlist.includes(c));
|
|
13
25
|
};
|
|
14
26
|
const evaluateIpInfo = (ipInfo, trafficFilter, options) => {
|
|
15
27
|
if (!ipInfo || !ipInfo.isValid) {
|
|
@@ -34,10 +46,7 @@ const evaluateIpInfo = (ipInfo, trafficFilter, options) => {
|
|
|
34
46
|
return { isBlocked: true, reason: types.ResultReason.ABUSER_BLOCKED };
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
|
-
if (trafficFilter.blockDatacenter && ipInfo.isDatacenter && !(options.suppressVpnDatacenterInteraction && ipInfo.isVPN && !trafficFilter.blockVpn) && !
|
|
38
|
-
ipInfo.datacenterName,
|
|
39
|
-
trafficFilter.datacenterNameAllowlist
|
|
40
|
-
)) {
|
|
49
|
+
if (trafficFilter.blockDatacenter && ipInfo.isDatacenter && !(options.suppressVpnDatacenterInteraction && ipInfo.isVPN && !trafficFilter.blockVpn) && !isDatacenterAllowlisted(ipInfo, trafficFilter.datacenterNameAllowlist)) {
|
|
41
50
|
return { isBlocked: true, reason: types.ResultReason.DATACENTER_BLOCKED };
|
|
42
51
|
}
|
|
43
52
|
if (trafficFilter.blockMobile && ipInfo.isMobile) {
|
|
@@ -51,13 +60,16 @@ const evaluateIpInfo = (ipInfo, trafficFilter, options) => {
|
|
|
51
60
|
}
|
|
52
61
|
return { isBlocked: false };
|
|
53
62
|
};
|
|
54
|
-
const checkTrafficFilter = (ipInfo, trafficFilter, extraIpInfos) => {
|
|
63
|
+
const checkTrafficFilter = (ipInfo, trafficFilter, extraIpInfos, dnsPathValid) => {
|
|
55
64
|
const primary = evaluateIpInfo(ipInfo, trafficFilter, {
|
|
56
65
|
suppressVpnDatacenterInteraction: true
|
|
57
66
|
});
|
|
58
67
|
if (primary.isBlocked) {
|
|
59
68
|
return primary;
|
|
60
69
|
}
|
|
70
|
+
if (trafficFilter.skipExtrasOnValidDnsPath && dnsPathValid === true) {
|
|
71
|
+
return { isBlocked: false };
|
|
72
|
+
}
|
|
61
73
|
for (const extra of extraIpInfos ?? []) {
|
|
62
74
|
const result = evaluateIpInfo(extra, trafficFilter, {
|
|
63
75
|
suppressVpnDatacenterInteraction: false
|