Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GVL For TCF2 Allows Empty Vendor List #27

Merged
merged 3 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/prebid/go-gdpr

go 1.13

require github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456
require (
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456
github.com/stretchr/testify v1.7.0
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456 h1:SnUWpAH4lEUoS86woR12h21VMUbDe+DYp88V646wwMI=
github.com/buger/jsonparser v0.0.0-20180318095312-2cac668e8456/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are all indirect dependencies from Testify.

3 changes: 0 additions & 3 deletions vendorlist2/eager-parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ func ParseEagerly(data []byte) (api.VendorList, error) {
if contract.Version == 0 {
return nil, errors.New("data.vendorListVersion was 0 or undefined. Versions should start at 1")
}
if len(contract.Vendors) == 0 {
return nil, errors.New("data.vendors was undefined or had no elements")
}

parsedList := parsedVendorList{
version: contract.Version,
Expand Down
17 changes: 17 additions & 0 deletions vendorlist2/eager-parsing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"testing"

"github.com/prebid/go-gdpr/api"
"github.com/stretchr/testify/assert"
)

func TestEagerlyParsedVendorList(t *testing.T) {
Expand All @@ -15,3 +16,19 @@ func TestEagerlyParsedVendorList(t *testing.T) {
return vendorList
})
}

func TestParseEagerlyVendorsEmpty(t *testing.T) {
vendorListJSON := `
{
"gvlSpecificationVersion": 2,
"vendorListVersion": 28,
"tcfPolicyVersion": 2,
"lastUpdated": "2020-03-05T16:05:29Z",
"vendors": { }
}
`
vendorList, err := ParseEagerly([]byte(vendorListJSON))

assert.NoError(t, err)
assert.Nil(t, vendorList.Vendor(0))
}