diff --git a/exchange/utils_test.go b/exchange/utils_test.go index f9117eca31b..6fe0e55fe50 100644 --- a/exchange/utils_test.go +++ b/exchange/utils_test.go @@ -2294,6 +2294,7 @@ func TestCleanOpenRTBRequestsWithOpenRTBDowngrade(t *testing.T) { bidReq.Regs.GPPSID = []int8{6} bidReq.User.ID = "" bidReq.User.BuyerUID = "" + bidReq.User.Yob = 0 downgradedRegs := *bidReq.Regs downgradedUser := *bidReq.User diff --git a/privacy/enforcement.go b/privacy/enforcement.go index e1669f78282..50d42e89435 100644 --- a/privacy/enforcement.go +++ b/privacy/enforcement.go @@ -69,17 +69,9 @@ func (e Enforcement) getGeoScrubStrategy() ScrubStrategyGeo { } func (e Enforcement) getUserScrubStrategy() ScrubStrategyUser { - if e.COPPA { + if e.COPPA || e.CCPA || e.LMT || e.GDPRID { return ScrubStrategyUserIDAndDemographic } - if e.CCPA || e.LMT { - return ScrubStrategyUserID - } - - if e.GDPRID { - return ScrubStrategyUserID - } - return ScrubStrategyUserNone } diff --git a/privacy/enforcement_test.go b/privacy/enforcement_test.go index 5902a913665..a9d7ca9275a 100644 --- a/privacy/enforcement_test.go +++ b/privacy/enforcement_test.go @@ -95,7 +95,7 @@ func TestApply(t *testing.T) { expectedDeviceIPv4: ScrubStrategyIPV4Lowest8, expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserID, + expectedUser: ScrubStrategyUserIDAndDemographic, expectedUserGeo: ScrubStrategyGeoReducedPrecision, }, { @@ -127,7 +127,7 @@ func TestApply(t *testing.T) { expectedDeviceIPv4: ScrubStrategyIPV4Lowest8, expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserID, + expectedUser: ScrubStrategyUserIDAndDemographic, expectedUserGeo: ScrubStrategyGeoReducedPrecision, }, { @@ -143,7 +143,7 @@ func TestApply(t *testing.T) { expectedDeviceIPv4: ScrubStrategyIPV4None, expectedDeviceIPv6: ScrubStrategyIPV6None, expectedDeviceGeo: ScrubStrategyGeoNone, - expectedUser: ScrubStrategyUserID, + expectedUser: ScrubStrategyUserIDAndDemographic, expectedUserGeo: ScrubStrategyGeoNone, }, { @@ -175,7 +175,7 @@ func TestApply(t *testing.T) { expectedDeviceIPv4: ScrubStrategyIPV4Lowest8, expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserID, + expectedUser: ScrubStrategyUserIDAndDemographic, expectedUserGeo: ScrubStrategyGeoReducedPrecision, }, { diff --git a/privacy/scrubber.go b/privacy/scrubber.go index c2ea7d63441..428193bcda1 100644 --- a/privacy/scrubber.go +++ b/privacy/scrubber.go @@ -55,9 +55,6 @@ const ( // ScrubStrategyUserIDAndDemographic removes the user's buyer id, exchange id year of birth, and gender. ScrubStrategyUserIDAndDemographic - - // ScrubStrategyUserID removes the user's buyer id. - ScrubStrategyUserID ) // ScrubStrategyDeviceID defines the approach to remove hardware id and device id data. @@ -131,17 +128,12 @@ func (scrubber) ScrubUser(user *openrtb2.User, strategy ScrubStrategyUser, geo S userCopy := *user - switch strategy { - case ScrubStrategyUserIDAndDemographic: + if strategy == ScrubStrategyUserIDAndDemographic { userCopy.BuyerUID = "" userCopy.ID = "" userCopy.Ext = scrubUserExtIDs(userCopy.Ext) userCopy.Yob = 0 userCopy.Gender = "" - case ScrubStrategyUserID: - userCopy.BuyerUID = "" - userCopy.ID = "" - userCopy.Ext = scrubUserExtIDs(userCopy.Ext) } switch geo { diff --git a/privacy/scrubber_test.go b/privacy/scrubber_test.go index d8f2fdd8429..7b4afac247e 100644 --- a/privacy/scrubber_test.go +++ b/privacy/scrubber_test.go @@ -269,57 +269,6 @@ func TestScrubUser(t *testing.T) { scrubUser: ScrubStrategyUserIDAndDemographic, scrubGeo: ScrubStrategyGeoNone, }, - { - description: "User ID & Geo Full", - expected: &openrtb2.User{ - ID: "", - BuyerUID: "", - Yob: 42, - Gender: "anyGender", - Ext: json.RawMessage(`{}`), - Geo: &openrtb2.Geo{}, - }, - scrubUser: ScrubStrategyUserID, - scrubGeo: ScrubStrategyGeoFull, - }, - { - description: "User ID & Geo Reduced", - expected: &openrtb2.User{ - ID: "", - BuyerUID: "", - Yob: 42, - Gender: "anyGender", - Ext: json.RawMessage(`{}`), - Geo: &openrtb2.Geo{ - Lat: 123.46, - Lon: 678.89, - Metro: "some metro", - City: "some city", - ZIP: "some zip", - }, - }, - scrubUser: ScrubStrategyUserID, - scrubGeo: ScrubStrategyGeoReducedPrecision, - }, - { - description: "User ID & Geo None", - expected: &openrtb2.User{ - ID: "", - BuyerUID: "", - Yob: 42, - Gender: "anyGender", - Ext: json.RawMessage(`{}`), - Geo: &openrtb2.Geo{ - Lat: 123.456, - Lon: 678.89, - Metro: "some metro", - City: "some city", - ZIP: "some zip", - }, - }, - scrubUser: ScrubStrategyUserID, - scrubGeo: ScrubStrategyGeoNone, - }, { description: "User None & Geo Full", expected: &openrtb2.User{