@prosopo/types-database 4.1.5 → 4.8.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.
Files changed (42) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +16 -12
  2. package/.turbo/turbo-build$colon$tsc.log +17 -14
  3. package/.turbo/turbo-build.log +17 -13
  4. package/CHANGELOG.md +514 -0
  5. package/dist/cjs/index.cjs +6 -7
  6. package/dist/cjs/types/bannedDomain.cjs +8 -0
  7. package/dist/cjs/types/client.cjs +77 -5
  8. package/dist/cjs/types/index.cjs +6 -7
  9. package/dist/cjs/types/provider.cjs +299 -88
  10. package/dist/cjs/types/spamEmailDomain.cjs +8 -0
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +8 -9
  14. package/dist/types/bannedDomain.d.ts +15 -0
  15. package/dist/types/bannedDomain.d.ts.map +1 -0
  16. package/dist/types/bannedDomain.js +8 -0
  17. package/dist/types/bannedDomain.js.map +1 -0
  18. package/dist/types/captcha.d.ts +2 -2
  19. package/dist/types/captcha.d.ts.map +1 -1
  20. package/dist/types/captcha.js.map +1 -1
  21. package/dist/types/client.d.ts +111 -12
  22. package/dist/types/client.d.ts.map +1 -1
  23. package/dist/types/client.js +78 -6
  24. package/dist/types/client.js.map +1 -1
  25. package/dist/types/index.d.ts +2 -0
  26. package/dist/types/index.d.ts.map +1 -1
  27. package/dist/types/index.js +8 -9
  28. package/dist/types/index.js.map +1 -1
  29. package/dist/types/mongo.d.ts +1 -1
  30. package/dist/types/provider.d.ts +59 -463
  31. package/dist/types/provider.d.ts.map +1 -1
  32. package/dist/types/provider.js +301 -90
  33. package/dist/types/provider.js.map +1 -1
  34. package/dist/types/spamEmailDomain.d.ts +15 -0
  35. package/dist/types/spamEmailDomain.d.ts.map +1 -0
  36. package/dist/types/spamEmailDomain.js +8 -0
  37. package/dist/types/spamEmailDomain.js.map +1 -0
  38. package/package.json +9 -7
  39. package/dist/provider/pendingCaptchaRequest.d.ts +0 -14
  40. package/dist/provider/pendingCaptchaRequest.d.ts.map +0 -1
  41. package/dist/provider/pendingCaptchaRequest.js +0 -2
  42. package/dist/provider/pendingCaptchaRequest.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,519 @@
1
1
  # @prosopo/types-database
2
2
 
3
+ ## 4.8.1
4
+ ### Patch Changes
5
+
6
+ - b03dad1: Thread `shadowDomPenalty: boolean` from the catcher's encrypted detection payload through `decryptPayload` and persist it on `Session.scoreComponents` so the flag is queryable in Mongo without inferring it from `baseScore=1 ∧ ¬triggeredDetectors`. Field is optional on the wire (position 6); older catcher bundles omit it and `shadowDomPenalty` stays undefined.
7
+ - Updated dependencies [b03dad1]
8
+ - @prosopo/types@4.3.1
9
+ - @prosopo/user-access-policy@3.7.12
10
+
11
+ ## 4.8.0
12
+ ### Minor Changes
13
+
14
+ - 2392aaf: Integrate the prosopo/dns sidecar against the procaptcha provider.
15
+
16
+ - New admin endpoint `POST /v1/prosopo/provider/admin/dns/event` ingests batched DNS observation events from the sidecar (auth: admin sr25519 JWT) and merges resolver / peer IPs onto the matching Session record under a new `Session.dnsEvent` field.
17
+ - Frictionless response carries a per-session `dns_url` when the pronode has `DNS_EVENT_SUBZONE` + `DNS_EVENT_HMAC_SECRET` set. The HMAC path mirrors the sidecar's Rust implementation so both sides agree without shared per-request state.
18
+ - The frictionless bundle fires one no-cors GET to `dns_url` on detection completion (fire-and-forget; failures never affect the captcha flow).
19
+ - `dns_url` is included on the `reuse_session` short-circuit path too, not only the new-session path — otherwise repeat visits from the same user/IP/sitekey combination silently dropped the observation hop.
20
+ - Deploy compose entry for the sidecar plus a Caddy `layer4` SNI-passthrough block so the sidecar terminates TLS itself (no Cloudflare token needed). Caddy image must be rebuilt with the `caddy-l4` plugin.
21
+
22
+ ### Patch Changes
23
+
24
+ - a1d60db: Add optional internal ML labelling fields (label/labelReason/labelledBy/labelledAt) to captcha records.
25
+ - Updated dependencies [a1d60db]
26
+ - Updated dependencies [2392aaf]
27
+ - Updated dependencies [97cf7bd]
28
+ - Updated dependencies [6ca1125]
29
+ - Updated dependencies [32a591b]
30
+ - @prosopo/types@4.3.0
31
+ - @prosopo/logger@1.0.2
32
+ - @prosopo/common@3.1.38
33
+ - @prosopo/user-access-policy@3.7.11
34
+
35
+ ## 4.7.8
36
+ ### Patch Changes
37
+
38
+ - 6c26669: Add per-site honeypot trap. When enabled, the provider attaches an encoded question (morse or semaphore, base64-wrapped) in the `x-prosopo-meta` response header on frictionless responses. The widget renders the value into an off-screen hidden input with `name="email_confirm"`; bots that auto-fill text inputs populate it and the value rides back on the solution submit as `clientMetaData.hp`, which is persisted on the `StoredCaptcha` record. Falls back to a random phrase from `PROSOPO_HONEYPOT_PHRASE_BANK_PATH` when no custom question is configured.
39
+ - Updated dependencies [6c26669]
40
+ - Updated dependencies [f7f9ec5]
41
+ - @prosopo/types@4.2.1
42
+ - @prosopo/user-access-policy@3.7.10
43
+
44
+ ## 4.7.7
45
+ ### Patch Changes
46
+
47
+ - 0fd81af: Extract the logger into its own `@prosopo/logger` package, out of `@prosopo/common`. Consumers now import logger symbols from `@prosopo/logger`; `@prosopo/common` no longer re-exports them. Unused `@prosopo/common` dependencies pruned where the only usage was the logger.
48
+ - Updated dependencies [0fd81af]
49
+ - @prosopo/common@3.1.37
50
+ - @prosopo/logger@1.0.1
51
+ - @prosopo/user-access-policy@3.7.9
52
+
53
+ ## 4.7.6
54
+ ### Patch Changes
55
+
56
+ - cdbc5ed: fix(types-database): persist `autoBanScoreThreshold` on client settings
57
+
58
+ `autoBanScoreThreshold` was added to the zod `ClientSettingsSchema` and the
59
+ frictionless decision machine in #2592, but the Mongoose `UserSettingsSchema`
60
+ was never updated. Mongoose's strict mode silently dropped the field on every
61
+ `$set`, so neither the portal account collection nor the provider
62
+ `ClientRecord` collection ever persisted the value — meaning a system user
63
+ could set the threshold in the portal, the API would accept it, but the
64
+ provider would never actually enforce it.
65
+
66
+ Adds the field to the Mongoose schema (`Number`, `min: 0`, `required: false`,
67
+ no default) so the property is preserved on write.
68
+ - 4d9923e: test(provider): integration test asserting every IUserSettings field round-trips through Mongo
69
+
70
+ Registers a site key with a fully-populated `IUserSettings` (every field set, including the new `storeMetadata` and the existing nested `contextAware` / `ipValidationRules` / `spamFilter` / `trafficFilter` sub-documents), reads the record back from Mongo via the real Mongoose write/read path, and asserts each top-level and nested field survived. This is the regression test class that would have caught the `autoBanScoreThreshold` Mongoose-strict-mode drop on the original PR.
71
+
72
+ While adding the test it caught another field that was in zod `ClientSettingsSchema` but missing from the Mongoose `UserSettingsSchema`: `puzzleTolerance`. The fix is bundled here — adds `puzzleTolerance: { type: Number, required: false }` to `UserSettingsSchema` so it actually persists.
73
+ - 4d9923e: feat: optional `storeMetadata` site setting persists `/verify` metadata
74
+
75
+ Adds a per-site-key boolean `storeMetadata` (default `false`) to
76
+ `ClientSettingsSchema` / `UserSettingsSchema`. When enabled, the provider
77
+ writes the dapp-server-forwarded metadata that arrives on the image, PoW
78
+ and puzzle `/verify` endpoints onto the corresponding captcha record under
79
+ a new `metadata` sub-document (`{ email?: string }` today; more fields
80
+ will be added here as the verify payload grows).
81
+
82
+ `providedIp` stays top-level — existing data and indexes already use it,
83
+ and it predates this setting.
84
+
85
+ Off by default. Existing spam-email checks still inspect the submitted
86
+ email unconditionally — this setting only gates **storage** of metadata
87
+ so the submitted values can be sampled later to judge whether traffic is
88
+ mostly spam.
89
+ - Updated dependencies [20cae63]
90
+ - Updated dependencies [4d9923e]
91
+ - @prosopo/types@4.2.0
92
+ - @prosopo/user-access-policy@3.7.8
93
+
94
+ ## 4.7.5
95
+ ### Patch Changes
96
+
97
+ - d351362: fix: replace `$or + $expr` unstored-records sweep with a `pendingStage` sentinel
98
+
99
+ The `StoreCommitmentsExternal` background job fetches "records that still
100
+ need to be shipped to the central DB" via
101
+ `{ $or: [ { storedAtTimestamp: { $exists: false } }, { $expr: { $lt: [$storedAtTimestamp, $lastUpdatedTimestamp] } } ] }`.
102
+ `$expr` is unindexable (per-doc computation) and combined with `$or`
103
+ defeats the planner entirely — production was running this every sweep
104
+ as a `IXSCAN { _id: 1 }` collection scan, examining ~673K powcaptcha
105
+ docs, ~240K usercommitments docs, and ~60K sessions docs per pass. On
106
+ the worst-affected nodes this thrashed the WiredTiger cache (10h of
107
+ cumulative app-thread blocking on disk reads in 43h of uptime) and made
108
+ every other Mongo lookup (including the frictionless session dedup
109
+ queries) slow by eviction — manifesting as traffic-correlated provider
110
+ latency starting 2026-05-26.
111
+
112
+ Replace the query semantics with a `pendingStage: true` sentinel:
113
+
114
+ - New optional `pendingStage` field on `StoredCaptcha` and `Session`
115
+ (Zod + TS + Mongoose schemas).
116
+ - New tiny partial index per collection:
117
+ `{ pendingStage: 1 }` with `partialFilterExpression: { pendingStage: true }`.
118
+ Indexes only the rows that need staging — typically a tiny rolling set,
119
+ ~20 KB for a 700K-row collection with 100 pending rows in local tests.
120
+ - Write paths (`storeXxx`, `updateXxx`, `markXxxChecked`, approve /
121
+ disapprove, `checkAndRemoveSession`, `recordSessionSimdReadingsIfAbsent`,
122
+ `storePendingImageCommitment`) set `pendingStage: true` alongside the
123
+ existing `lastUpdatedTimestamp` bump.
124
+ - `markXxxStored` and the per-record streamer mark-stored callbacks
125
+ `$unset: { pendingStage: 1 }` alongside the `storedAtTimestamp` write,
126
+ guarded by `lastUpdatedTimestamp: { $lte: ts }` so an in-flight update
127
+ doesn't get its pending flag cleared by an older stage completion.
128
+ - `markXxxStored` bulk methods accept an `asOfTimestamp` argument; the
129
+ sweep passes the time it fetched the batch so the guard is correct
130
+ across the full ship-then-mark round trip.
131
+ - `getUnstoredXxx` queries become `{ pendingStage: true }` sorted by
132
+ `_id` — uses the new partial index, examines only pending docs.
133
+
134
+ Local verification on a 700,100-doc test collection: old query ~549 ms
135
+ examining 700,100 docs; new query 0 ms examining 100 docs. Index storage
136
+ ~20 KB.
137
+ - Updated dependencies [d351362]
138
+ - @prosopo/types@4.1.4
139
+ - @prosopo/user-access-policy@3.7.7
140
+
141
+ ## 4.7.4
142
+ ### Patch Changes
143
+
144
+ - 7e8cbb7: fix(types-database): replace broken partial indexes with regular non-sparse indexes for CHECK_IP_INFO / PARSE_USER_AGENT backfill queries
145
+
146
+ The original partial-index approach (#2587, then #2589) couldn't work in MongoDB:
147
+
148
+ - `partialFilterExpression` isn't allowed on `_id` indexes (caught by #2589).
149
+ - More fundamentally, `{ $exists: false }` is rewritten internally as `$not: { $exists: true }`, and `$not` isn't on the partial-filter operator allowlist either. So no key field could rescue the partial-index design.
150
+
151
+ Replace the six broken partial-index definitions on `PoWCaptchaRecordSchema`, `PuzzleCaptchaRecordSchema`, and `UserCommitmentRecordSchema` with regular non-sparse indexes on the fields themselves (`{ ipInfo: 1 }` and `{ parsedUserAgentInfo: 1 }`). Non-sparse indexes include entries for missing-field documents (stored as null), which the planner can use to satisfy `{ <field>: { $exists: false } }` via `IXSCAN`.
152
+
153
+ Note: both layers that swallowed the original `createIndex` failures (`CaptchaDatabase.ensureIndexes()` `.catch` warning, and Mongoose `autoIndex`'s un-listened `'index'` event) are still silent — worth a follow-up so the next bad schema change doesn't ship unnoticed.
154
+ - Updated dependencies [e2711ae]
155
+ - Updated dependencies [5786629]
156
+ - @prosopo/types@4.1.3
157
+ - @prosopo/locale@3.2.4
158
+ - @prosopo/user-access-policy@3.7.6
159
+ - @prosopo/common@3.1.36
160
+
161
+ ## 4.7.3
162
+ ### Patch Changes
163
+
164
+ - @prosopo/types@4.1.2
165
+ - @prosopo/user-access-policy@3.7.5
166
+
167
+ ## 4.7.2
168
+ ### Patch Changes
169
+
170
+ - Updated dependencies [53bfd45]
171
+ - Updated dependencies [91958da]
172
+ - @prosopo/locale@3.2.3
173
+ - @prosopo/types@4.1.1
174
+ - @prosopo/common@3.1.35
175
+ - @prosopo/user-access-policy@3.7.4
176
+
177
+ ## 4.7.1
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies [6a741ce]
181
+ - @prosopo/types@4.1.0
182
+ - @prosopo/user-access-policy@3.7.3
183
+
184
+ ## 4.7.0
185
+ ### Minor Changes
186
+
187
+ - d865319: Add puzzle captcha (drag-to-target challenge) as a new captcha type:
188
+ provider endpoints, manager + widget package, types, demo pages, and
189
+ a `puzzleTolerance` site setting.
190
+
191
+ ### Patch Changes
192
+
193
+ - f9ea09d: Drop flat ipinfo fields (`vpn`, `countryCode`, `tor`, `proxy`, `datacenter`, `abuser`, `geolocation`) from captcha records — persist the full `IPInfoResponse` payload as `ipInfo` instead
194
+
195
+ The provider's `ipInfoMiddleware` already calls `ipInfoService.lookup()` on every captcha request and attaches the result to `req.ipInfo`. Persisting that whole payload on every captcha record means the portal sees the *exact* response the traffic filter consulted, with no cherry-picked-field translation layer in between. Adding a new flag in the future (e.g. `isMobile`) requires zero schema changes — it's already in the payload.
196
+
197
+ - `StoredCaptcha` interface: removed `vpn`, `countryCode`, `geolocation`. Keeps `ipInfo?: IPInfoResponse`.
198
+ - `PoWCaptchaStoredSchema` zod validator: same removals, adds `ipInfo` (validated as `any()` since `IPInfoResponse` is a discriminated union narrowed at read time).
199
+ - PoW, Puzzle, UserCommitment mongoose schemas in `@prosopo/types-database`: same removals. UserCommitment now also has `ipInfo` (previously only PoW + Puzzle did). Replaced `{ countryCode: 1 }` index with `{ "ipInfo.countryCode": 1 }` + `{ "ipInfo.isVPN": 1 }`.
200
+ - `IProviderDatabase` interface: `storePowCaptchaRecord` / `storePuzzleCaptchaRecord` / `storePendingImageCommitment` now take `ipInfo?: IPInfoResponse` in place of `countryCode?: string`.
201
+ - Provider call sites (`getPoWCaptchaChallenge.ts`, `getPuzzleCaptchaChallenge.ts`, `getImageCaptchaChallenge.ts`, `submitImageCaptchaSolution.ts`) pass `req.ipInfo` directly. The earlier "prefer session.countryCode, fallback to req's countryCode" branching is gone — record `ipInfo` reflects what was true at challenge-issuance time.
202
+ - Provider read sites (`powTasks.ts`, `puzzleTasks.ts`, `imgCaptchaTasks.ts`) narrow `record.ipInfo?.isValid` then read `.countryCode` for access-policy / decision-machine input — same effective value, derived from the persisted payload.
203
+ - Lean projections in `provider.ts` switched from `countryCode: 1` to `ipInfo: 1`.
204
+
205
+ Paired with [captcha-private#3339](https://github.com/prosopo/captcha-private/pull/3339), which updates the CHECK_IP_INFO backfill job (now writes the full payload, query becomes `{ ipInfo: { $exists: false } }`), the portal search models / aggregation pipeline (read nested `ipInfo.*`), and the anomaly detectors.
206
+ - f9ea09d: Drop flat `countryCode` / `geolocation` fields from Session records — persist the full `IPInfoResponse` payload as `session.ipInfo` instead
207
+
208
+ Brings sessions in line with captcha records (PoW / Puzzle / UserCommitment), which already store the full payload. The provider's `ipInfoMiddleware` populates `req.ipInfo` at session-creation time; that whole payload now lives on the session, so consumers narrow on `session.ipInfo?.isValid` and read whichever sub-field they need (countryCode, isVPN, isMobile, isTor, ...).
209
+
210
+ - `Session` interface + `SessionSchema` zod (`@prosopo/types`): replace `countryCode?: string` / `geolocation?: string` with `ipInfo?: IPInfoResponse`.
211
+ - `SessionRecordSchema` mongoose (`@prosopo/types-database`): same.
212
+ - `FrictionlessManager.setSessionParams` / `createSession`: accept `ipInfo` instead of `countryCode`.
213
+ - `getFrictionlessCaptchaChallenge.ts` call sites (10 of them — `sendImageCaptcha`, `sendPowCaptcha`, `registerBlockedSession`, etc.) pass `req.ipInfo` instead of `countryCode`.
214
+ - `CaptchaManager.isValidRequest()` return: drop dead `countryCode: sessionRecord.countryCode` field (no caller was destructuring it after the earlier refactor), surface `ipInfo: sessionRecord.ipInfo` instead for callers that want it.
215
+ - Two new MongoMemory roundtrip tests in `ipInfoPersistence.integration.test.ts` cover Session.ipInfo (valid response + error response). `routingDecisionMachines.integration.test.ts` fixture updated to write the full payload.
216
+
217
+ `RoutingContext.countryCode` is unchanged — that's a transient runtime struct fed into the routing machine, not a stored record. Callers of `setRoutingContext` already derive `countryCode` from `req.ipInfo.countryCode` at the API boundary.
218
+
219
+ Paired with [captcha-private#3339](https://github.com/prosopo/captcha-private/pull/3339).
220
+ - 4aae4e6: Plumb the WASM SIMD CPU fingerprint readings (collected by the catcher
221
+ client per https://blog.azerpas.com/writing/wasm-simd-fingerprinting/)
222
+ through the captcha flow and onto the linked `Session` record.
223
+ Collection-only — no scoring or classification yet.
224
+
225
+ The readings are sent at the earliest moment they're available so the
226
+ signal lands on the session as soon as possible:
227
+
228
+ 1. **Captcha-challenge GET** (PoW / Puzzle / Image) — the procaptcha
229
+ Manager calls `frictionlessState.getSimdReadings(0)` (non-blocking
230
+ cache check) and attaches it to the challenge-request body. The
231
+ provider handler decodes and patches the linked session via
232
+ `updateSessionRecord`.
233
+ 2. **Solution submission** (PoW / Puzzle / Image) — same non-blocking
234
+ check on the submit body. Acts as a backup if the benchmark wasn't
235
+ ready in time for the challenge GET.
236
+
237
+ Frictionless init itself stays SIMD-free (benchmark is too slow to gate
238
+ the first hop).
239
+
240
+ Surface area:
241
+
242
+ - `SimdReadings` discriminated union + `SimdOpReadingRecord` /
243
+ `SimdOpCategory` in `@prosopo/types`, plus `simdReadingsCodec` shared
244
+ encode/decode helpers so the browser SDK and the provider use the same
245
+ pipe-safe wire format.
246
+ - Optional `simdReadings: string()` on `CaptchaRequestBody`,
247
+ `GetPowCaptchaChallengeRequestBody`, `GetPuzzleCaptchaChallengeRequestBody`,
248
+ `CaptchaSolutionBody`, `SubmitPowCaptchaSolutionBody`, and
249
+ `SubmitPuzzleCaptchaSolutionBody`.
250
+ - `FrictionlessState.getSimdReadings` + `BotDetectionFunctionResult.getSimdReadings`
251
+ so the catcher's prefetched benchmark is consumed at the request sites.
252
+ - `ProcaptchaApiInterface.{getCaptchaChallenge, submitCaptchaSolution}` and
253
+ the `ProviderApi.{getCaptchaChallenge, getPowCaptchaChallenge, getPuzzleCaptchaChallenge,
254
+ submitCaptchaSolution, submitPowCaptchaSolution, submitPuzzleCaptchaSolution}`
255
+ client methods accept the field.
256
+ - Provider challenge + solution handlers decode via `decodeSimdReadings`
257
+ and `updateSessionRecord` (Mongoose `Mixed`, Zod discriminated-union
258
+ validation at the edge). The challenge-GET patch is fire-and-forget.
259
+
260
+ Backward-compatible: older catcher clients omit the field at every layer;
261
+ the session record omits it in turn.
262
+ - Updated dependencies [3c0be68]
263
+ - Updated dependencies [f9ea09d]
264
+ - Updated dependencies [4aae4e6]
265
+ - Updated dependencies [d865319]
266
+ - Updated dependencies [753304b]
267
+ - Updated dependencies [8bb7286]
268
+ - Updated dependencies [f9ea09d]
269
+ - Updated dependencies [4aae4e6]
270
+ - Updated dependencies [4993813]
271
+ - Updated dependencies [72a0483]
272
+ - @prosopo/types@4.0.0
273
+ - @prosopo/locale@3.2.2
274
+ - @prosopo/common@3.1.34
275
+ - @prosopo/user-access-policy@3.7.2
276
+
277
+ ## 4.6.2
278
+ ### Patch Changes
279
+
280
+ - 819ed95: Adding invisible mode to session data
281
+ - Updated dependencies [819ed95]
282
+ - @prosopo/types@3.16.1
283
+ - @prosopo/user-access-policy@3.7.1
284
+
285
+ ## 4.6.1
286
+ ### Patch Changes
287
+
288
+ - Updated dependencies [60ba3b1]
289
+ - @prosopo/user-access-policy@3.7.0
290
+
291
+ ## 4.6.0
292
+ ### Minor Changes
293
+
294
+ - 74092d0: Stream data back to central for decisions
295
+
296
+ ## 4.5.3
297
+ ### Patch Changes
298
+
299
+ - f6a4402: API endpoint for removing site keys
300
+ - Updated dependencies [f6a4402]
301
+ - Updated dependencies [99dfb44]
302
+ - @prosopo/types@3.16.0
303
+ - @prosopo/user-access-policy@3.6.24
304
+
305
+ ## 4.5.2
306
+ ### Patch Changes
307
+
308
+ - Updated dependencies [3e54c0a]
309
+ - @prosopo/types@3.15.0
310
+ - @prosopo/user-access-policy@3.6.23
311
+
312
+ ## 4.5.1
313
+ ### Patch Changes
314
+
315
+ - 946a8ba: Abuser score threshold
316
+ - Updated dependencies [946a8ba]
317
+ - Updated dependencies [5614814]
318
+ - Updated dependencies [b94890c]
319
+ - @prosopo/types@3.14.1
320
+ - @prosopo/locale@3.2.1
321
+ - @prosopo/common@3.1.33
322
+ - @prosopo/user-access-policy@3.6.22
323
+
324
+ ## 4.5.0
325
+ ### Minor Changes
326
+
327
+ - 42650db: Add better spam rules and move ipinfo service to local instead of external
328
+
329
+ ### Patch Changes
330
+
331
+ - fc514dd: ability to block different types of traffic
332
+ - Updated dependencies [fc514dd]
333
+ - Updated dependencies [42650db]
334
+ - @prosopo/locale@3.2.0
335
+ - @prosopo/types@3.14.0
336
+ - @prosopo/common@3.1.32
337
+ - @prosopo/user-access-policy@3.6.21
338
+
339
+ ## 4.4.14
340
+ ### Patch Changes
341
+
342
+ - Updated dependencies [4a9c518]
343
+ - @prosopo/common@3.1.31
344
+ - @prosopo/user-access-policy@3.6.20
345
+
346
+ ## 4.4.13
347
+ ### Patch Changes
348
+
349
+ - @prosopo/types@3.13.3
350
+ - @prosopo/user-access-policy@3.6.19
351
+
352
+ ## 4.4.12
353
+ ### Patch Changes
354
+
355
+ - @prosopo/types@3.13.2
356
+ - @prosopo/user-access-policy@3.6.18
357
+
358
+ ## 4.4.11
359
+ ### Patch Changes
360
+
361
+ - @prosopo/types@3.13.1
362
+ - @prosopo/user-access-policy@3.6.17
363
+
364
+ ## 4.4.10
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [e6d9553]
368
+ - @prosopo/types@3.13.0
369
+ - @prosopo/user-access-policy@3.6.16
370
+
371
+ ## 4.4.9
372
+ ### Patch Changes
373
+
374
+ - e1ea65f: Better spam email domain checking
375
+ - c316257: Adding sync fo sessions wrt captcha status
376
+ - Updated dependencies [d5082a9]
377
+ - Updated dependencies [e1ea65f]
378
+ - Updated dependencies [c316257]
379
+ - @prosopo/types@3.12.3
380
+ - @prosopo/user-access-policy@3.6.15
381
+
382
+ ## 4.4.8
383
+ ### Patch Changes
384
+
385
+ - adb89a6: Disposable email checking
386
+ - Updated dependencies [adb89a6]
387
+ - @prosopo/locale@3.1.29
388
+ - @prosopo/types@3.12.2
389
+ - @prosopo/common@3.1.30
390
+ - @prosopo/user-access-policy@3.6.14
391
+
392
+ ## 4.4.7
393
+ ### Patch Changes
394
+
395
+ - a90eb54: We know WHAT happens but we don't know WHY happens
396
+ - Updated dependencies [c5ee492]
397
+ - Updated dependencies [a90eb54]
398
+ - @prosopo/common@3.1.29
399
+ - @prosopo/types@3.12.1
400
+ - @prosopo/user-access-policy@3.6.13
401
+
402
+ ## 4.4.6
403
+ ### Patch Changes
404
+
405
+ - Updated dependencies [676c5f2]
406
+ - Updated dependencies [feaca02]
407
+ - @prosopo/types@3.12.0
408
+ - @prosopo/user-access-policy@3.6.12
409
+
410
+ ## 4.4.5
411
+ ### Patch Changes
412
+
413
+ - 8148587: Clustering
414
+ - Updated dependencies [8148587]
415
+ - @prosopo/types@3.11.1
416
+ - @prosopo/user-access-policy@3.6.11
417
+
418
+ ## 4.4.4
419
+ ### Patch Changes
420
+
421
+ - 90033e9: Add missing schema field
422
+
423
+ ## 4.4.3
424
+ ### Patch Changes
425
+
426
+ - Updated dependencies [7f6ffc5]
427
+ - @prosopo/types@3.11.0
428
+ - @prosopo/user-access-policy@3.6.10
429
+
430
+ ## 4.4.2
431
+ ### Patch Changes
432
+
433
+ - 93fa086: Add decision engine endpoints
434
+ - Updated dependencies [93fa086]
435
+ - @prosopo/types@3.10.2
436
+ - @prosopo/user-access-policy@3.6.9
437
+
438
+ ## 4.4.1
439
+ ### Patch Changes
440
+
441
+ - cde7550: enhance/frictionless-headers-db-field
442
+ - Updated dependencies [cde7550]
443
+ - @prosopo/types@3.10.1
444
+ - @prosopo/user-access-policy@3.6.8
445
+
446
+ ## 4.4.0
447
+ ### Minor Changes
448
+
449
+ - ad6d622: Separate types from mongoose schemas to avoid bundling mongoose in frontend
450
+
451
+ ### Patch Changes
452
+
453
+ - fa95c5f: zod types for db records
454
+ - Updated dependencies [ad6d622]
455
+ - @prosopo/types@3.10.0
456
+ - @prosopo/user-access-policy@3.6.7
457
+
458
+ ## 4.3.1
459
+ ### Patch Changes
460
+
461
+ - Updated dependencies [ff58a70]
462
+ - @prosopo/types@3.9.0
463
+ - @prosopo/user-access-policy@3.6.6
464
+
465
+ ## 4.3.0
466
+ ### Minor Changes
467
+
468
+ - 3feeea4: Store geolocation. Remove pending image captcha collection
469
+
470
+ ## 4.2.4
471
+ ### Patch Changes
472
+
473
+ - 4c08158: Skip ip validation unit tests
474
+ - d2431cd: Allow IP validation rules to be disabled
475
+ - Updated dependencies [d2431cd]
476
+ - @prosopo/types@3.8.4
477
+ - @prosopo/user-access-policy@3.6.5
478
+
479
+ ## 4.2.3
480
+ ### Patch Changes
481
+
482
+ - 8dad7f3: Implement frictionless blocks
483
+
484
+ ## 4.2.2
485
+ ### Patch Changes
486
+
487
+ - Updated dependencies [bd6995b]
488
+ - @prosopo/user-access-policy@3.6.4
489
+ - @prosopo/types@3.8.3
490
+
491
+ ## 4.2.1
492
+ ### Patch Changes
493
+
494
+ - 9633e58: Add captcha type to decision machine and run on image verification"
495
+ - Updated dependencies [9633e58]
496
+ - @prosopo/types@3.8.2
497
+ - @prosopo/user-access-policy@3.6.3
498
+
499
+ ## 4.2.0
500
+ ### Minor Changes
501
+
502
+ - 4299cae: Adding site key to session records
503
+
504
+ ### Patch Changes
505
+
506
+ - f52a5c1: Adding decision machine to provider for behavior detection
507
+ - Updated dependencies [f52a5c1]
508
+ - @prosopo/types@3.8.1
509
+ - @prosopo/user-access-policy@3.6.2
510
+
511
+ ## 4.1.6
512
+ ### Patch Changes
513
+
514
+ - Updated dependencies [ed87b6f]
515
+ - @prosopo/user-access-policy@3.6.1
516
+
3
517
  ## 4.1.5
4
518
  ### Patch Changes
5
519
 
@@ -4,26 +4,23 @@ require("./types/index.cjs");
4
4
  const provider = require("./types/provider.cjs");
5
5
  const client = require("./types/client.cjs");
6
6
  const captcha = require("./types/captcha.cjs");
7
+ const spamEmailDomain = require("./types/spamEmailDomain.cjs");
8
+ const bannedDomain = require("./types/bannedDomain.cjs");
7
9
  exports.CaptchaRecordSchema = provider.CaptchaRecordSchema;
8
10
  exports.ClientContextEntropyRecordSchema = provider.ClientContextEntropyRecordSchema;
9
11
  exports.ClientRecordSchema = provider.ClientRecordSchema;
10
12
  exports.CompositeIpAddressRecordSchemaObj = provider.CompositeIpAddressRecordSchemaObj;
11
- exports.CompositeIpAddressSchema = provider.CompositeIpAddressSchema;
12
13
  exports.DatasetRecordSchema = provider.DatasetRecordSchema;
14
+ exports.DecisionMachineArtifactRecordSchema = provider.DecisionMachineArtifactRecordSchema;
13
15
  exports.DetectorRecordSchema = provider.DetectorRecordSchema;
14
- exports.IpAddressType = provider.IpAddressType;
15
- exports.PendingRecordSchema = provider.PendingRecordSchema;
16
16
  exports.PoWCaptchaRecordSchema = provider.PoWCaptchaRecordSchema;
17
+ exports.PuzzleCaptchaRecordSchema = provider.PuzzleCaptchaRecordSchema;
17
18
  exports.ScheduledTaskRecordSchema = provider.ScheduledTaskRecordSchema;
18
19
  exports.ScheduledTaskSchema = provider.ScheduledTaskSchema;
19
20
  exports.SessionRecordSchema = provider.SessionRecordSchema;
20
21
  exports.SolutionRecordSchema = provider.SolutionRecordSchema;
21
22
  exports.UserCommitmentRecordSchema = provider.UserCommitmentRecordSchema;
22
- exports.UserCommitmentSchema = provider.UserCommitmentSchema;
23
- exports.UserCommitmentWithSolutionsSchema = provider.UserCommitmentWithSolutionsSchema;
24
23
  exports.UserSolutionRecordSchema = provider.UserSolutionRecordSchema;
25
- exports.UserSolutionSchema = provider.UserSolutionSchema;
26
- exports.parseMongooseCompositeIpAddress = provider.parseMongooseCompositeIpAddress;
27
24
  exports.AccountSchema = client.AccountSchema;
28
25
  exports.IPValidationRulesSchema = client.IPValidationRulesSchema;
29
26
  exports.TableNames = client.TableNames;
@@ -32,3 +29,5 @@ exports.UserSettingsSchema = client.UserSettingsSchema;
32
29
  exports.StoredPoWCaptchaRecordSchema = captcha.StoredPoWCaptchaRecordSchema;
33
30
  exports.StoredSessionRecordSchema = captcha.StoredSessionRecordSchema;
34
31
  exports.StoredUserCommitmentRecordSchema = captcha.StoredUserCommitmentRecordSchema;
32
+ exports.SpamEmailDomainRecordSchema = spamEmailDomain.SpamEmailDomainRecordSchema;
33
+ exports.BannedDomainRecordSchema = bannedDomain.BannedDomainRecordSchema;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const mongoose = require("mongoose");
4
+ const BannedDomainRecordSchema = new mongoose.Schema({
5
+ domain: { type: String, required: true, unique: true }
6
+ });
7
+ BannedDomainRecordSchema.index({ domain: 1 });
8
+ exports.BannedDomainRecordSchema = BannedDomainRecordSchema;
@@ -3,6 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("@prosopo/types");
4
4
  const mongoose = require("mongoose");
5
5
  const IPValidationRulesSchema = new mongoose.Schema({
6
+ enabled: {
7
+ type: Boolean,
8
+ default: false,
9
+ required: true
10
+ },
6
11
  actions: {
7
12
  countryChangeAction: {
8
13
  type: mongoose.Schema.Types.Mixed,
@@ -61,12 +66,34 @@ const IPValidationRulesSchema = new mongoose.Schema({
61
66
  }
62
67
  });
63
68
  const UserSettingsSchema = new mongoose.Schema({
64
- captchaType: String,
65
- frictionlessThreshold: Number,
66
- powDifficulty: Number,
67
- imageThreshold: Number,
69
+ captchaType: {
70
+ type: String,
71
+ enum: types.CaptchaType,
72
+ default: types.captchaTypeDefault
73
+ },
74
+ frictionlessThreshold: {
75
+ type: Number,
76
+ default: types.frictionlessThresholdDefault
77
+ },
78
+ powDifficulty: { type: Number, default: types.powDifficultyDefault },
79
+ imageThreshold: {
80
+ type: Number,
81
+ default: types.imageThresholdDefault
82
+ },
83
+ imageMaxRounds: {
84
+ type: Number,
85
+ default: types.imageMaxRoundsDefault,
86
+ required: false
87
+ },
88
+ puzzleTolerance: {
89
+ type: Number,
90
+ required: false
91
+ },
68
92
  ipValidationRules: IPValidationRulesSchema,
69
- domains: [String],
93
+ domains: {
94
+ type: [String],
95
+ default: types.domainsDefault
96
+ },
70
97
  disallowWebView: {
71
98
  type: Boolean,
72
99
  default: false
@@ -86,6 +113,51 @@ const UserSettingsSchema = new mongoose.Schema({
86
113
  }
87
114
  }
88
115
  }
116
+ },
117
+ spamEmailDomainCheckEnabled: {
118
+ type: Boolean,
119
+ default: false,
120
+ required: false
121
+ },
122
+ autoBanScoreThreshold: {
123
+ type: Number,
124
+ min: 0,
125
+ required: false
126
+ },
127
+ spamFilter: {
128
+ enabled: { type: Boolean, default: false },
129
+ emailRules: {
130
+ enabled: { type: Boolean, default: false },
131
+ maxLocalPartDots: { type: Number, required: false },
132
+ normaliseGmail: { type: Boolean, default: false },
133
+ useDefaultPatterns: { type: Boolean, default: false },
134
+ customRegexBlocklist: { type: [String], default: [] }
135
+ }
136
+ },
137
+ trafficFilter: {
138
+ blockVpn: { type: Boolean, default: false },
139
+ blockProxy: { type: Boolean, default: false },
140
+ blockTor: { type: Boolean, default: false },
141
+ blockAbuser: { type: Boolean, default: true },
142
+ abuserScoreThreshold: { type: Number, min: 0, max: 1, default: 0 },
143
+ blockDatacenter: { type: Boolean, default: false },
144
+ blockMobile: { type: Boolean, default: false },
145
+ blockSatellite: { type: Boolean, default: false },
146
+ blockCrawler: { type: Boolean, default: false }
147
+ },
148
+ storeMetadata: {
149
+ type: Boolean,
150
+ default: false,
151
+ required: false
152
+ },
153
+ honeypot: {
154
+ enabled: { type: Boolean, default: false },
155
+ question: { type: String, required: false },
156
+ encodingType: {
157
+ type: String,
158
+ enum: ["morse", "semaphore"],
159
+ default: "morse"
160
+ }
89
161
  }
90
162
  });
91
163
  const UserDataSchema = new mongoose.Schema({