Skip to content

fix(geoblock): match country codes case-insensitively - #38

Open
SashaMIT wants to merge 1 commit into
WalletConnect:mainfrom
SashaMIT:fix/country-code-case
Open

SashaMIT wants to merge 1 commit into
WalletConnect:mainfrom
SashaMIT:fix/country-code-case

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 9, 2026

Copy link
Copy Markdown

Description

Country blocks compared the configured code to MaxMind's ISO code with ==. MaxMind returns uppercase codes (CU). A list entry of cu did not match, so the request was allowed. Subdivision codes already ignore ASCII case. The country check now does too.

The visitor does not choose the block list. A lowercase entry in the operator's config fails open and serves traffic from a country the operator meant to block.

No existing issue.

How Has This Been Tested?

cargo test -p geoip --features middleware test_country_blocked

The new test configures cu against a resolver that returns CU and expects 401. Reverting the comparison makes that test return 200.

cargo +nightly-2026-02-11 fmt --all -- --check passed.
cargo +nightly-2026-02-11 clippy -p geoip --all-features --all-targets -- -D warnings passed.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

A blocked country written as cu did not match MaxMind's CU, so the
request was allowed. Subdivision codes already ignore ASCII case.
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