Skip to content

feat: add country/jurisdiction support to data broker database#9

Open
thomasnemer wants to merge 1 commit intomainfrom
feat/country-support
Open

feat: add country/jurisdiction support to data broker database#9
thomasnemer wants to merge 1 commit intomainfrom
feat/country-support

Conversation

@thomasnemer
Copy link
Copy Markdown
Contributor

Summary

  • Adds geographic modeling to the broker system so brokers can be tagged with their home country and the countries whose residents' data they process
  • Adds --country CLI flags to broker list and scan commands for jurisdiction-based filtering
  • Enables GDPR cross-border scenarios where users need to find brokers outside their country that hold their data

Changes

  • CountryCode type (src/broker/mod.rs): ISO 3166-1 alpha-2 validated country code with auto-uppercasing
  • BrokerConnector trait: new home_country() and data_countries() default methods
  • BeenVerified: implements home_country → "US", data_countries → ["US"]
  • DB schema: migration 2 adds country and data_countries TEXT columns to brokers
  • list_brokers: refactored with dynamic WHERE clause supporting category + country + data_country filters (LIKE-based comma-separated matching)
  • CLI: --country flag on broker list and scan; country info displayed in broker info
  • Scan: auto-filters connectors to those relevant to the user's country via data_countries
  • Registry: propagates country/data_countries from remote registry to local DB

Test plan

  • cargo build compiles cleanly
  • cargo test — all 21 tests pass (4 new country-specific tests)
  • Manual: data-breaker broker list --country US filters by home country
  • Manual: data-breaker broker info beenverified shows country info
  • Manual: data-breaker scan --first-name John --last-name Doe --country US --state NY filters connectors

Add geographic modeling so brokers can be associated with countries and
filtered by the user's jurisdiction. This enables GDPR cross-border
scenarios where European users need to find non-European brokers holding
their data.

- Add CountryCode type with ISO 3166-1 alpha-2 validation
- Add country and data_countries fields to Broker model
- Add DB migration 2 for new columns
- Add home_country()/data_countries() to BrokerConnector trait
- Implement country info for BeenVerified (US)
- Add --country flag to `broker list` and `scan` commands
- Display country info in `broker info`
- Auto-filter scan connectors by user's country
- Refactor list_brokers with dynamic filtering (category + country + data_country)
- Update registry to propagate country fields
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.

1 participant