Skip to content

fix(market): no sales to Tier A jurisdictions - #30

Merged
M0nsxx merged 1 commit into
mainfrom
fix/market-tier-a
Nov 27, 2026
Merged

M0nsxx merged 1 commit into
mainfrom
fix/market-tier-a

Conversation

@Eras256

@Eras256 Eras256 commented Nov 27, 2026

Copy link
Copy Markdown
Member

Found in the 27 Nov legal check: Nirium's Restricted Jurisdictions & Sanctions Policy gives Tier A no access to any Nirium service, paid or free, and this market sells data for real USDC on mainnet with no IP check at all.

  • avalanche/market/geo.mjs: blockTierA() answers 451 (same JSON as the Nirium node) to Cuba, Iran, North Korea, Syria, Afghanistan, Myanmar, Russia, Belarus and China, on every route except /health (Fly's checks). Same country set and the same geoip-lite data as the node (Eras256/nirium-core-private#293). Unknown country passes, as the policy's §7 says geolocation is imperfect.
  • Tier B (EEA, UK, US) is not restricted here: the policy closes only Payouts and Treasury there.
  • server.mjs: app.set("trust proxy", 1) so req.ip is the client from Fly's X-Forwarded-For hop, then app.use(blockTierA()) before every route.
  • geoip-lite pinned at 2.0.3 (same as the node); the Dockerfile copies geo.mjs.
  • Tests (test/geo.test.mjs, real app and real geoip data): Iran, North Korea and China get 451 on /, /v1/market/info and the paid /v1/market; the US and Mexico get 200; /health stays 200 from Iran; the country list matches the node. npm test 7/7.

Needs a market redeploy (bluegreen) to take effect.

🤖 Generated with Claude Code

Nirium's Restricted Jurisdictions & Sanctions Policy (§2) gives Tier A no access to any Nirium
service, paid or free, and the market sells data for real USDC on mainnet with no IP check. The
market now answers 451 to Cuba, Iran, North Korea, Syria, Afghanistan, Myanmar, Russia, Belarus
and China on every route except /health, with the same countries and geoip-lite data as the
Nirium node. Tier B is not restricted here (the policy closes only Payouts and Treasury there).
trust proxy 1 reads the client IP from Fly's X-Forwarded-For hop. geoip-lite pinned at 2.0.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@M0nsxx M0nsxx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-assisted review (Claude)

Read the diff: market/geo.mjs adds blockTierA with the same Tier A countries and geoip-lite 2.0.3 as the node, mounted before every route except /health with trust proxy 1, and the Dockerfile now copies geo.mjs. Tests show Iran, North Korea and China get 451 on the info and paid routes and the US and Mexico get 200. npm test 7/7, and CI including market-image is green. Approve.

@M0nsxx
M0nsxx merged commit 7cebe9e into main Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants