Skip to content

Issue 188: security: Implement IP-based Geoblocking middleware for restricted jurisdictions #92

@AlAfiz

Description

@AlAfiz

Description

As a DeFi protocol launching on Mainnet, we must be careful about regulatory compliance. Certain jurisdictions (like OFAC-sanctioned countries) cannot be allowed to access our frontend API.
We need to implement a geoblocking middleware that reads the incoming request's IP address, checks it against a GeoIP database, and blocks access if they are from a restricted region.
This protects the core team from legal liability during the Wave 3 launch.

Requirements

  • Install the geoip-lite npm package.
  • Create a restrictedRegions.js array containing standard ISO country codes to block (e.g., ['KP', 'IR', 'SY']).
  • Create a middleware that reads req.ip (or req.headers['x-forwarded-for'] if behind a proxy) and looks up the country.
  • If the country is in the restricted list, return a 451 Unavailable For Legal Reasons HTTP status code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions