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

Fix TCF1 Fetcher Fallback #1438

Merged
merged 2 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion gdpr/vendorlist-fetching.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func newVendorListCache(fallbackVL api.VendorList) (save func(id uint16, list ap
if ok {
return list.(vendorlist.VendorList)
}
return fallbackVL
return nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method needs to return nil in order to attempt a url lazy loading fetch. If we return fallbackVL here, it effectively disables lazy loading.

}
return
}
Expand Down
6 changes: 3 additions & 3 deletions gdpr/vendorlist-fetching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func TestDefaultVendorList(t *testing.T) {
assert.Equal(t, false, vendor.Purpose(2))
}

func TestDefaultVendorListPassthrough(t *testing.T) {
func TestFallbackVendorListPassthrough(t *testing.T) {
firstVendorList := mockVendorListData(t, 1, map[uint16]*purposes{
32: {
purposes: []int{1, 2},
Expand All @@ -184,7 +184,7 @@ func TestDefaultVendorListPassthrough(t *testing.T) {
purposes: []int{2},
},
})
server := httptest.NewServer(http.HandlerFunc(mockServer(2, map[int]string{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both lists were originally preloaded and always pulled from cache. If we change the latest version from 2 to 1, it no longer preloads version 2 and attempts a lazy load. This exposed the bug.

server := httptest.NewServer(http.HandlerFunc(mockServer(1, map[int]string{
1: firstVendorList,
2: secondVendorList,
})))
Expand All @@ -204,7 +204,7 @@ func TestDefaultVendorListPassthrough(t *testing.T) {
assert.Equal(t, true, vendor.Purpose(2))
}

func TestDefaultVendorListNoFetch(t *testing.T) {
func TestFallbackVendorListNoFetch(t *testing.T) {
firstVendorList := mockVendorListData(t, 1, map[uint16]*purposes{
32: {
purposes: []int{1, 2},
Expand Down