From a2170ec13f8b77af5e4ec70aed52110a1b3940e6 Mon Sep 17 00:00:00 2001 From: Scott Kay Date: Wed, 6 May 2020 11:46:03 -0400 Subject: [PATCH] Remove Outdated GDPR AMP Special Case (#1283) --- exchange/utils.go | 3 +-- privacy/enforcement.go | 17 ++++--------- privacy/enforcement_test.go | 51 ++----------------------------------- 3 files changed, 8 insertions(+), 63 deletions(-) diff --git a/exchange/utils.go b/exchange/utils.go index d1c95b88b86..f09b11513f1 100644 --- a/exchange/utils.go +++ b/exchange/utils.go @@ -43,7 +43,6 @@ func cleanOpenRTBRequests(ctx context.Context, gdpr := extractGDPR(orig, usersyncIfAmbiguous) consent := extractConsent(orig) - isAMP := labels.RType == pbsmetrics.ReqTypeAMP privacyEnforcement := privacy.Enforcement{ COPPA: orig.Regs != nil && orig.Regs.COPPA == 1, @@ -66,7 +65,7 @@ func cleanOpenRTBRequests(ctx context.Context, privacyEnforcement.GDPR = false } - privacyEnforcement.Apply(bidReq, isAMP) + privacyEnforcement.Apply(bidReq) } return diff --git a/privacy/enforcement.go b/privacy/enforcement.go index caea396c0f6..592b6fb6937 100644 --- a/privacy/enforcement.go +++ b/privacy/enforcement.go @@ -17,14 +17,14 @@ func (e Enforcement) Any() bool { } // Apply cleans personally identifiable information from an OpenRTB bid request. -func (e Enforcement) Apply(bidRequest *openrtb.BidRequest, isAMP bool) { - e.apply(bidRequest, isAMP, NewScrubber()) +func (e Enforcement) Apply(bidRequest *openrtb.BidRequest) { + e.apply(bidRequest, NewScrubber()) } -func (e Enforcement) apply(bidRequest *openrtb.BidRequest, isAMP bool, scrubber Scrubber) { +func (e Enforcement) apply(bidRequest *openrtb.BidRequest, scrubber Scrubber) { if bidRequest != nil && e.Any() { bidRequest.Device = scrubber.ScrubDevice(bidRequest.Device, e.getDeviceMacAndIFA(), e.getIPv6ScrubStrategy(), e.getGeoScrubStrategy()) - bidRequest.User = scrubber.ScrubUser(bidRequest.User, e.getUserScrubStrategy(isAMP), e.getGeoScrubStrategy()) + bidRequest.User = scrubber.ScrubUser(bidRequest.User, e.getUserScrubStrategy(), e.getGeoScrubStrategy()) } } @@ -56,18 +56,11 @@ func (e Enforcement) getGeoScrubStrategy() ScrubStrategyGeo { return ScrubStrategyGeoNone } -func (e Enforcement) getUserScrubStrategy(isAMP bool) ScrubStrategyUser { +func (e Enforcement) getUserScrubStrategy() ScrubStrategyUser { if e.COPPA { return ScrubStrategyUserFull } - // There's no way for AMP to send a GDPR consent string yet so it's hard - // to know if the vendor is consented or not and therefore for AMP requests - // we keep the BuyerUID as is for GDPR. - if e.GDPR && isAMP { - return ScrubStrategyUserNone - } - if e.GDPR || e.CCPA { return ScrubStrategyUserBuyerIDOnly } diff --git a/privacy/enforcement_test.go b/privacy/enforcement_test.go index ffc9da5d30c..3bc716b38d2 100644 --- a/privacy/enforcement_test.go +++ b/privacy/enforcement_test.go @@ -52,7 +52,6 @@ func TestAny(t *testing.T) { func TestApply(t *testing.T) { testCases := []struct { enforcement Enforcement - isAMP bool expectedDeviceMacAndIFA bool expectedDeviceIPv6 ScrubStrategyIPV6 expectedDeviceGeo ScrubStrategyGeo @@ -66,7 +65,6 @@ func TestApply(t *testing.T) { COPPA: true, GDPR: true, }, - isAMP: true, expectedDeviceMacAndIFA: true, expectedDeviceIPv6: ScrubStrategyIPV6Lowest32, expectedDeviceGeo: ScrubStrategyGeoFull, @@ -80,7 +78,6 @@ func TestApply(t *testing.T) { COPPA: true, GDPR: false, }, - isAMP: false, expectedDeviceMacAndIFA: true, expectedDeviceIPv6: ScrubStrategyIPV6Lowest32, expectedDeviceGeo: ScrubStrategyGeoFull, @@ -94,7 +91,6 @@ func TestApply(t *testing.T) { COPPA: false, GDPR: true, }, - isAMP: false, expectedDeviceMacAndIFA: false, expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, @@ -102,27 +98,12 @@ func TestApply(t *testing.T) { expectedUserGeo: ScrubStrategyGeoReducedPrecision, description: "GDPR", }, - { - enforcement: Enforcement{ - CCPA: false, - COPPA: false, - GDPR: true, - }, - isAMP: true, - expectedDeviceMacAndIFA: false, - expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, - expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserNone, - expectedUserGeo: ScrubStrategyGeoReducedPrecision, - description: "GDPR For AMP", - }, { enforcement: Enforcement{ CCPA: true, COPPA: false, GDPR: false, }, - isAMP: false, expectedDeviceMacAndIFA: false, expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, @@ -130,34 +111,6 @@ func TestApply(t *testing.T) { expectedUserGeo: ScrubStrategyGeoReducedPrecision, description: "CCPA", }, - { - enforcement: Enforcement{ - CCPA: true, - COPPA: false, - GDPR: false, - }, - isAMP: true, - expectedDeviceMacAndIFA: false, - expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, - expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserBuyerIDOnly, - expectedUserGeo: ScrubStrategyGeoReducedPrecision, - description: "CCPA For AMP", - }, - { - enforcement: Enforcement{ - CCPA: true, - COPPA: false, - GDPR: true, - }, - isAMP: true, - expectedDeviceMacAndIFA: false, - expectedDeviceIPv6: ScrubStrategyIPV6Lowest16, - expectedDeviceGeo: ScrubStrategyGeoReducedPrecision, - expectedUser: ScrubStrategyUserNone, - expectedUserGeo: ScrubStrategyGeoReducedPrecision, - description: "GDPR And CCPA For AMP", - }, } for _, test := range testCases { @@ -172,7 +125,7 @@ func TestApply(t *testing.T) { m.On("ScrubDevice", req.Device, test.expectedDeviceMacAndIFA, test.expectedDeviceIPv6, test.expectedDeviceGeo).Return(device).Once() m.On("ScrubUser", req.User, test.expectedUser, test.expectedUserGeo).Return(user).Once() - test.enforcement.apply(req, test.isAMP, m) + test.enforcement.apply(req, m) m.AssertExpectations(t) assert.Equal(t, device, req.Device, "Device Set Correctly") @@ -191,7 +144,7 @@ func TestApplyNoneApplicable(t *testing.T) { m := &mockScrubber{} - enforcement.apply(req, true, m) + enforcement.apply(req, m) m.AssertNotCalled(t, "ScrubDevice") m.AssertNotCalled(t, "ScrubUser")