diff --git a/gdpr/impl.go b/gdpr/impl.go index 481e92df0c7..aca07fd068d 100644 --- a/gdpr/impl.go +++ b/gdpr/impl.go @@ -116,10 +116,6 @@ func (p *permissionsImpl) allowSync(ctx context.Context, vendorID uint16, consen return false, nil } - if parsedConsent.Version() != 2 { - return false, nil - } - if !p.cfg.TCF2.Purpose1.Enabled { return true, nil } @@ -137,11 +133,12 @@ func (p *permissionsImpl) allowActivities(ctx context.Context, vendorID uint16, return false, false, false, err } + // vendor will be nil if not a valid TCF2 consent string if vendor == nil { return false, false, false, nil } - if parsedConsent.Version() != 2 || !p.cfg.TCF2.Enabled { + if !p.cfg.TCF2.Enabled { return true, false, false, nil } diff --git a/gdpr/impl_test.go b/gdpr/impl_test.go index 23050a22975..d26c0c57231 100644 --- a/gdpr/impl_test.go +++ b/gdpr/impl_test.go @@ -798,3 +798,21 @@ func TestAllowActivitiesBidRequests(t *testing.T) { assert.EqualValuesf(t, td.passID, passID, "PassID failure on %s", td.description) } } + +func TestTCF1Consent(t *testing.T) { + bidderAllowedByConsent := openrtb_ext.BidderAppnexus + tcf1Consent := "BOS2bx5OS2bx5ABABBAAABoAAAABBwAA" + + perms := permissionsImpl{ + vendorIDs: map[openrtb_ext.BidderName]uint16{ + openrtb_ext.BidderAppnexus: 2, + }, + } + + bidReq, passGeo, passID, err := perms.AuctionActivitiesAllowed(context.Background(), bidderAllowedByConsent, "", SignalYes, tcf1Consent, false) + + assert.Nil(t, err, "TCF1 consent - no error returned") + assert.Equal(t, false, bidReq, "TCF1 consent - bid request not allowed") + assert.Equal(t, false, passGeo, "TCF1 consent - passing geo not allowed") + assert.Equal(t, false, passID, "TCF1 consent - passing id not allowed") +}