Skip to content

Commit 9d3c6de

Browse files
committed
Require geofeeds to be valid UTF-8
1 parent 633a920 commit 9d3c6de

13 files changed

Lines changed: 74 additions & 28 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## CHANGELOG
22

3+
## 4.0.0 (2026-02-16)
4+
5+
* Require that geofeeds be encoded as valid UTF-8.
6+
37
## 3.1.0 (2024-11-05)
48

59
* Empty geofeeds will now be considered invalid, unless the (new) EmptyOK option

go.mod

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
module github.com/maxmind/mm-geofeed-verifier/v3
1+
module github.com/maxmind/mm-geofeed-verifier/v4
22

33
go 1.24.0
44

55
require (
6-
github.com/TomOnTime/utfutil v1.0.0
7-
github.com/oschwald/geoip2-golang v1.13.0
6+
github.com/oschwald/maxminddb-golang/v2 v2.1.0
87
github.com/stretchr/testify v1.11.1
98
)
109

1110
require (
1211
github.com/davecgh/go-spew v1.1.1 // indirect
13-
github.com/oschwald/maxminddb-golang v1.13.0 // indirect
14-
github.com/oschwald/maxminddb-golang/v2 v2.1.0 // indirect
1512
github.com/pmezard/go-difflib v1.0.0 // indirect
1613
golang.org/x/sys v0.37.0 // indirect
17-
golang.org/x/text v0.23.0 // indirect
1814
gopkg.in/yaml.v3 v3.0.1 // indirect
1915
)

go.sum

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
github.com/TomOnTime/utfutil v1.0.0 h1:/0Ivgo2OjXJxo8i7zgvs7ewSFZMLwCRGm3P5Umowb90=
2-
github.com/TomOnTime/utfutil v1.0.0/go.mod h1:l9lZmOniizVSuIliSkEf87qivMRlSNzbdBFKjuLRg1c=
31
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
42
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/oschwald/geoip2-golang v1.13.0 h1:Q44/Ldc703pasJeP5V9+aFSZFmBN7DKHbNsSFzQATJI=
6-
github.com/oschwald/geoip2-golang v1.13.0/go.mod h1:P9zG+54KPEFOliZ29i7SeYZ/GM6tfEL+rgSn03hYuUo=
7-
github.com/oschwald/maxminddb-golang v1.13.0 h1:R8xBorY71s84yO06NgTmQvqvTvlS/bnYZrrWX1MElnU=
8-
github.com/oschwald/maxminddb-golang v1.13.0/go.mod h1:BU0z8BfFVhi1LQaonTwwGQlsHUEu9pWNdMfmq4ztm0o=
93
github.com/oschwald/maxminddb-golang/v2 v2.1.0 h1:2Iv7lmG9XtxuZA/jFAsd7LnZaC1E59pFsj5O/nU15pw=
104
github.com/oschwald/maxminddb-golang/v2 v2.1.0/go.mod h1:gG4V88LsawPEqtbL1Veh1WRh+nVSYwXzJ1P5Fcn77g0=
115
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
126
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
137
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
148
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
15-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
16-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
179
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
1810
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
19-
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
20-
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
2111
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2212
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2313
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"sort" //nolint:depguard // preexisting
1919
"strings"
2020

21-
"github.com/maxmind/mm-geofeed-verifier/v3/verify"
21+
"github.com/maxmind/mm-geofeed-verifier/v4/verify"
2222
)
2323

2424
// This value is set by build scripts. Changing the name of

verify/errors.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ package verify
33
import "errors"
44

55
var (
6+
// ErrNotUTF8 indicates a file encoding that is not valid UTF-8 (with
7+
// optional BOM). RFC 8805 says that "feeds MUST use UTF-8 character
8+
// encoding". This is a separate error from ErrInvalidGeofeed, because we
9+
// can't confidently read anything from the file if it's not UTF-8.
10+
ErrNotUTF8 = errors.New("geofeed is not valid UTF-8")
611
// ErrInvalidGeofeed represents error that is returned in case of incomplete
712
// compliance with RFC 8805 standards and the mode in which the program is
813
// run.
-200 Bytes
Binary file not shown.
-189 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2a02:ecc0::/29 ,US,US-NJ, Parsippany ,
2+
202.196.224.5/32,AT,AT-9,Vienna,1060,/22
3+
# Verifier should compare most specific subdivision, i.e. GB-WBK instead of GB-ENG
4+
2.125.160.216/29,GB,GB-WBK,“Œ‹ž,
406 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2a02:ecc0::/29 ,US,US-NJ, Parsippany ,
2+
202.196.224.5/32,AT,AT-9,Vienna,1060,/22
3+
# Verifier should compare most specific subdivision, i.e. GB-WBK instead of GB-ENG
4+
2.125.160.216/29,GB,GB-WBK,Boxford,

0 commit comments

Comments
 (0)