Sanctions lookup budget fixes #22

Merged
Taskuler-bot merged 2 commits from fix/sanctions-lookup-budget into main 2026-11-30 02:22:39 +00:00
Member

Follow-up to #21. Merge after #14–#21, in order. Branch = #21 (982bc97) + one commit.

Changes

  • Chainalysis only when needed: the Chainalysis lookup runs last and only when every other check (OFAC, location, VPN) passed. When another check already blocks or is unavailable, the result is already "not ok", so no decision changes.
  • Daily caps on new Chainalysis lookups, using #21's counters (all checked before any is spent, so a refusal records nothing): CHAINALYSIS_NETWORK_DAILY_CAP per IPv6 /64 or IPv4 address (default 40), CHAINALYSIS_DAILY_CAP_PER_48 (100), CHAINALYSIS_DAILY_CAP_PER_24 (150). Over a cap: "unavailable" (fails closed).
  • Per-wallet Chainalysis pass reuse: CHAINALYSIS_PASS_CACHE_HOURS, in memory, 0 (off) by default, because Chainalysis's terms prohibit caching its data (Legal R6). Turn it on only after Legal confirms.
  • Rate limiter: one map per bucket type (client IP, IPv6 /48, wallet), each capped at 200,000 live keys, so one type can't crowd out another.
  • Approve then post/bid: the post or bid now waits for the approve's receipt and checks its sender before it is sent.
  • .env.example documents the new settings.

No user-facing copy changes. A mismatched approve sender reuses the existing wallet-changed message.

Tests: this branch passes 197/197 tests, both tsc checks and the testnet build. A local merge of #14→#21 and then this PR passes 205/205, tsc and the build. The only conflict is the known #15 import. Tests make no network calls.

Follow-up to #21. Merge **after #14–#21**, in order. Branch = #21 (`982bc97`) + one commit. **Changes** - **Chainalysis only when needed:** the Chainalysis lookup runs last and only when every other check (OFAC, location, VPN) passed. When another check already blocks or is unavailable, the result is already "not ok", so no decision changes. - **Daily caps on new Chainalysis lookups**, using #21's counters (all checked before any is spent, so a refusal records nothing): `CHAINALYSIS_NETWORK_DAILY_CAP` per IPv6 /64 or IPv4 address (default 40), `CHAINALYSIS_DAILY_CAP_PER_48` (100), `CHAINALYSIS_DAILY_CAP_PER_24` (150). Over a cap: "unavailable" (fails closed). - **Per-wallet Chainalysis pass reuse:** `CHAINALYSIS_PASS_CACHE_HOURS`, in memory, **0 (off) by default**, because Chainalysis's terms prohibit caching its data (Legal R6). Turn it on only after Legal confirms. - **Rate limiter:** one map per bucket type (client IP, IPv6 /48, wallet), each capped at 200,000 live keys, so one type can't crowd out another. - **Approve then post/bid:** the post or bid now waits for the approve's receipt and checks its sender before it is sent. - `.env.example` documents the new settings. **No user-facing copy changes.** A mismatched approve sender reuses the existing wallet-changed message. **Tests:** this branch passes 197/197 tests, both `tsc` checks and the testnet build. A local merge of #14→#21 and then this PR passes 205/205, `tsc` and the build. The only conflict is the known #15 import. Tests make no network calls.
Chainalysis is called only when every other check passed, with daily caps on new lookups per IPv6 /64 or IPv4
address, per /48 and per /24 (configurable). An optional per-wallet pass cache, off by default. Separate
rate-limit maps per bucket type with a higher size cap. The post or bid waits for the approve's receipt and
checks its sender first.
george approved these changes 2026-11-30 01:56:48 +00:00
Taskuler-bot changed target branch from fix/screening-budget-restart to main 2026-11-30 02:22:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
taskuler/web!22
No description provided.