From 270c50c1251d4ae79a238e91b75a9e581ce363c7 Mon Sep 17 00:00:00 2001 From: markiian Date: Mon, 24 Feb 2025 22:23:16 +0200 Subject: [PATCH 1/3] Add functional tests for allowPersonalDataConsent2 USGen module --- .../model/config/GppModuleConfig.groovy | 9 +- .../privacy/GppSyncUserActivitiesSpec.groovy | 134 ++++++++++++ .../GppTransmitEidsActivitiesSpec.groovy | 126 +++++++++++ ...GppTransmitPreciseGeoActivitiesSpec.groovy | 199 +++++++++++++++++- .../GppTransmitUfpdActivitiesSpec.groovy | 198 +++++++++++++++-- 5 files changed, 640 insertions(+), 26 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy b/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy index 0d10144e0bf..ad120c77988 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy @@ -23,6 +23,11 @@ class GppModuleConfig { List skipSidsSnakeCase @JsonProperty("skip-sids") List skipSidsKebabCase + Boolean allowPersonalDataConsent2 + @JsonProperty("allow_personal_data_consent2") + Boolean allowPersonalDataConsent2SnakeCase + @JsonProperty("allow-personal-data-consent2") + Boolean allowPersonalDataConsent2KebabCase static GppModuleConfig getDefaultModuleConfig(ActivityConfig activityConfig = ActivityConfig.configWithDefaultRestrictRules, List sids = [GppSectionId.US_NAT_V1], @@ -35,8 +40,8 @@ class GppModuleConfig { } static GppModuleConfig getDefaultModuleConfigSnakeCase(ActivityConfig activityConfig = ActivityConfig.configWithDefaultRestrictRules, - List sids = [GppSectionId.US_NAT_V1], - Boolean normalizeFlags = true) { + List sids = [GppSectionId.US_NAT_V1], + Boolean normalizeFlags = true) { new GppModuleConfig().tap { it.activityConfigSnakeCase = [activityConfig] it.sids = sids diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy index 8d358306721..e8ac00c3c9e 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy @@ -2055,4 +2055,138 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { cleanup: "Stop and remove pbs container" pbsServiceFactory.removeContainer(pbsConfig) } + + def "PBS cookie sync should exclude bidders URLs when privacy regulation match and personal data consent is 2"() { + given: "Cookie sync request with link to account" + def accountId = PBSUtils.randomString + def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { + it.gppSid = US_NAT_V1.value + it.account = accountId + it.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for cookie sync with allowing privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig().tap { + it.enabled = true + it.code = IAB_US_GENERAL + } + + and: "Existed account with cookie sync and privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes cookie sync request" + def response = activityPbsService.sendCookieSyncRequest(cookieSyncRequest) + + then: "Response should not contain any URLs for bidders" + assert !response.bidderStatus.userSync.url + + where: + privacyAllowRegulations << [IAB_US_GENERAL, IAB_ALL, ALL] + } + + def "PBS cookie sync should exclude bidders URLs when privacy regulation match and personal data consent is 2 and allowPersonalDataConsent2 is false"() { + given: "Cookie sync request with gpp privacy" + def accountId = PBSUtils.randomString + def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { + it.gppSid = US_NAT_V1.value + it.account = accountId + it.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for cookie sync with allowing privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulation] + } + def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig().tap { + enabled = true + code = IAB_US_GENERAL + config = gppModuleConfig + } + + and: "Save account with cookie sync and privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes cookie sync request" + def response = activityPbsService.sendCookieSyncRequest(cookieSyncRequest) + + then: "Response should not contain any URLs for bidders" + assert !response.bidderStatus.userSync.url + + where: + privacyAllowRegulation | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + } + + def "PBS cookie sync shouldn't exclude bidders URLs when privacy regulation match and personal data consent is 2 and allowPersonalDataConsent2 is true"() { + given: "Cookie sync request with gpp privacy" + def accountId = PBSUtils.randomString + def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { + it.gppSid = US_NAT_V1.value + it.account = accountId + it.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for cookie sync with allowing privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulation] + } + def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig().tap { + enabled = true + code = IAB_US_GENERAL + config = gppModuleConfig + } + + and: "Save account with cookie sync and privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes cookie sync request" + def response = activityPbsService.sendCookieSyncRequest(cookieSyncRequest) + + then: "Response should contain any URLs for bidders" + assert response.bidderStatus.userSync.url + + where: + privacyAllowRegulation | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy index 42ee2290663..70e32deb3c2 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy @@ -2334,4 +2334,130 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { new EqualityValueRule(CHILD_CONSENTS_FROM_13_TO_16, NO_CONSENT)] | new UsCtV1Consent.Builder() .setKnownChildSensitiveDataConsents(PBSUtils.getRandomNumber(0, 2), 1, PBSUtils.getRandomNumber(0, 2)) } + + def "PBS should remove EIDS fields in request when privacy regulation match and personalDataConsents is 2"() { + given: "Default bid requests with EIDS fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitEIDS with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(code: IAB_US_GENERAL, enabled: true) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request shouldn't contain EIDS fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + assert !bidderRequest.user.eids + assert !bidderRequest.user?.ext?.eids + + where: + privacyAllowRegulations << [IAB_US_GENERAL, IAB_ALL, ALL] + } + + def "PBS should remove EIDS fields in request when privacy regulation match and personalDataConsents is 2 and allowPersonalDataConsent2 is false"() { + given: "Default bid requests with EIDS fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitEIDS with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(enabled: true, code: IAB_US_GENERAL, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request shouldn't contain EIDS fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + assert !bidderRequest.user.eids + assert !bidderRequest.user?.ext?.eids + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + } + + def "PBS shouldn't remove EIDS fields in request when privacy regulation match and personalDataConsents is 2 and allowPersonalDataConsent2 is true"() { + given: "Default bid requests with EIDS fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitEIDS with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(enabled: true, code: IAB_US_GENERAL, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should contain EIDS fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + assert bidderRequest.user.eids + assert bidderRequest.user?.ext?.eids + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy index e51a9b8f193..b8e647681d6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy @@ -992,7 +992,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { regs.gpp = SIMPLE_GPC_DISALLOW_LOGIC } - and: "Activities set for transmitPreciseGeINTERNAL_SERVER_ERRORo with rejecting privacy regulation" + and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" def rule = new ActivityRule().tap { it.privacyRegulation = [privacyAllowRegulations] } @@ -3015,4 +3015,201 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { new EqualityValueRule(CHILD_CONSENTS_FROM_13_TO_16, NO_CONSENT)] | new UsCtV1Consent.Builder() .setKnownChildSensitiveDataConsents(PBSUtils.getRandomNumber(0, 2), 1, PBSUtils.getRandomNumber(0, 2)) } + + def "PBS auction should round lat/lon data to 2 digits call when privacy regulation match and personalDataConsents is 2"() { + given: "Default bid requests with gppConsent and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = bidRequestWithGeo.tap { + it.setAccountId(accountId) + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(code: IAB_US_GENERAL, enabled: true) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should contain rounded geo data for device and user to 2 digits" + def bidderRequests = bidder.getBidderRequest(bidRequest.id) + verifyAll { + bidderRequests.device.ip == "43.77.114.0" + bidderRequests.device.ipv6 == "af47:892b:3e98:b400::" + bidderRequests.device.geo.lat == bidRequest.device.geo.lat.round(2) + bidderRequests.device.geo.lon == bidRequest.device.geo.lon.round(2) + + bidderRequests.device.geo.country == bidRequest.device.geo.country + bidderRequests.device.geo.region == bidRequest.device.geo.region + bidderRequests.device.geo.utcoffset == bidRequest.device.geo.utcoffset + } + + and: "Bidder request should mask several geo fields" + verifyAll { + !bidderRequests.device.geo.metro + !bidderRequests.device.geo.city + !bidderRequests.device.geo.zip + !bidderRequests.device.geo.accuracy + !bidderRequests.device.geo.ipservice + !bidderRequests.device.geo.ext + } + + and: "Bidder request shouldn't mask geo.{lat,lon} fields" + verifyAll { + bidderRequests.user.geo.lat == bidRequest.user.geo.lat + bidderRequests.user.geo.lon == bidRequest.user.geo.lon + } + + where: + privacyAllowRegulations << [IAB_US_GENERAL, IAB_ALL, ALL] + } + + def "PBS auction should round lat/lon data to 2 digits call when privacy regulation match and personalDataConsents is 2 and allowPersonalDataConsent2 is false"() { + given: "Default bid requests with gppConsent and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = bidRequestWithGeo.tap { + it.setAccountId(accountId) + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(enabled: true, code: IAB_US_GENERAL, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should contain rounded geo data for device and user to 2 digits" + def bidderRequests = bidder.getBidderRequest(bidRequest.id) + verifyAll { + bidderRequests.device.ip == "43.77.114.0" + bidderRequests.device.ipv6 == "af47:892b:3e98:b400::" + bidderRequests.device.geo.lat == bidRequest.device.geo.lat.round(2) + bidderRequests.device.geo.lon == bidRequest.device.geo.lon.round(2) + + bidderRequests.device.geo.country == bidRequest.device.geo.country + bidderRequests.device.geo.region == bidRequest.device.geo.region + bidderRequests.device.geo.utcoffset == bidRequest.device.geo.utcoffset + } + + and: "Bidder request should mask several geo fields" + verifyAll { + !bidderRequests.device.geo.metro + !bidderRequests.device.geo.city + !bidderRequests.device.geo.zip + !bidderRequests.device.geo.accuracy + !bidderRequests.device.geo.ipservice + !bidderRequests.device.geo.ext + } + + and: "Bidder request shouldn't mask geo.{lat,lon} fields" + verifyAll { + bidderRequests.user.geo.lat == bidRequest.user.geo.lat + bidderRequests.user.geo.lon == bidRequest.user.geo.lon + } + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + } + + def "PBS auction shouldn't round lat/lon data to 2 digits call when privacy regulation match and personalDataConsents is 2 and allowPersonalDataConsent2 is true"() { + given: "Default bid requests with gppConsent and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = bidRequestWithGeo.tap { + it.setAccountId(accountId) + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(enabled: true, code: IAB_US_GENERAL, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should contain not rounded geo data for device and user" + def bidderRequests = bidder.getBidderRequest(bidRequest.id) + def deviceBidderRequest = bidderRequests.device + verifyAll { + deviceBidderRequest.ip == bidRequest.device.ip + deviceBidderRequest.ipv6 == "af47:892b:3e98:b49a::" + deviceBidderRequest.geo.lat == bidRequest.device.geo.lat + deviceBidderRequest.geo.lon == bidRequest.device.geo.lon + deviceBidderRequest.geo.country == bidRequest.device.geo.country + deviceBidderRequest.geo.region == bidRequest.device.geo.region + deviceBidderRequest.geo.utcoffset == bidRequest.device.geo.utcoffset + deviceBidderRequest.geo.metro == bidRequest.device.geo.metro + deviceBidderRequest.geo.city == bidRequest.device.geo.city + deviceBidderRequest.geo.zip == bidRequest.device.geo.zip + deviceBidderRequest.geo.accuracy == bidRequest.device.geo.accuracy + deviceBidderRequest.geo.ipservice == bidRequest.device.geo.ipservice + deviceBidderRequest.geo.ext == bidRequest.device.geo.ext + } + + and: "Bidder request user.geo.{lat,lon} shouldn't mask" + verifyAll { + bidderRequests.user.geo.lat == bidRequest.user.geo.lat + bidderRequests.user.geo.lon == bidRequest.user.geo.lon + } + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy index bbb019d515d..e29bd8787be 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy @@ -3067,29 +3067,181 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { new PurposeEid(activityTransitionKebabCase: false)] } - private static BidRequest givenBidRequestWithAccountAndUfpdData(String accountId) { - BidRequest.getDefaultBidRequest().tap { - it.setAccountId(accountId) - it.ext.prebid.trace = VERBOSE - it.device = new Device().tap { - didsha1 = PBSUtils.randomString - didmd5 = PBSUtils.randomString - dpidsha1 = PBSUtils.randomString - ifa = PBSUtils.randomString - macsha1 = PBSUtils.randomString - macmd5 = PBSUtils.randomString - dpidmd5 = PBSUtils.randomString - } - it.user = User.defaultUser - it.user.customdata = PBSUtils.randomString - it.user.eids = [Eid.defaultEid] - it.user.data = [new Data(name: PBSUtils.randomString)] - it.user.buyeruid = PBSUtils.randomString - it.user.yob = PBSUtils.randomNumber - it.user.gender = PBSUtils.randomString - it.user.geo = Geo.FPDGeo - it.user.ext = new UserExt(data: new UserExtData(buyeruid: PBSUtils.randomString)) - it.regs.ext ?= new RegsExt() + def "PBS should remove UFPD fields when privacy regulation match and rejecting and personalDataConsents is 2"() { + given: "Default Generic BidRequests with UFPD fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() } + + and: "Activities set for transmitUfpd with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(code: IAB_US_GENERAL, enabled: true) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should have empty UFPD fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + verifyAll { + !bidderRequest.device.didsha1 + !bidderRequest.device.didmd5 + !bidderRequest.device.dpidsha1 + !bidderRequest.device.ifa + !bidderRequest.device.macsha1 + !bidderRequest.device.macmd5 + !bidderRequest.device.dpidmd5 + !bidderRequest.user.id + !bidderRequest.user.buyeruid + !bidderRequest.user.yob + !bidderRequest.user.gender + !bidderRequest.user.data + !bidderRequest.user.geo + !bidderRequest.user.ext + } + + and: "Bidder request should have data in EIDS fields" + assert bidderRequest.user.eids == bidRequest.user.eids + + where: + privacyAllowRegulations << [IAB_US_GENERAL, IAB_ALL, ALL] + } + + def "PBS should remove UFPD fields when privacy regulation match and rejecting and personalDataConsents is 2 and allowPersonalDataConsent2 is false"() { + given: "Default Generic BidRequests with UFPD fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitUfpd with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(code: IAB_US_GENERAL, enabled: true, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should have empty UFPD fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + verifyAll { + !bidderRequest.device.didsha1 + !bidderRequest.device.didmd5 + !bidderRequest.device.dpidsha1 + !bidderRequest.device.ifa + !bidderRequest.device.macsha1 + !bidderRequest.device.macmd5 + !bidderRequest.device.dpidmd5 + !bidderRequest.user.id + !bidderRequest.user.buyeruid + !bidderRequest.user.yob + !bidderRequest.user.gender + !bidderRequest.user.data + !bidderRequest.user.geo + !bidderRequest.user.ext + } + + and: "Bidder request should have data in EIDS fields" + assert bidderRequest.user.eids == bidRequest.user.eids + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: false) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: null) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: null) + } + + def "PBS shouldn't remove UFPD fields when privacy regulation match and rejecting and personalDataConsents is 2 and allowPersonalDataConsent2 is false"() { + given: "Default Generic BidRequests with UFPD fields and account id" + def accountId = PBSUtils.randomNumber as String + def bidRequest = getBidRequestWithPersonalData(accountId).tap { + regs.gppSid = [US_NAT_V1.intValue] + regs.gpp = new UsNatV1Consent.Builder().setPersonalDataConsents(2).build() + } + + and: "Activities set for transmitUfpd with rejecting privacy regulation" + def rule = new ActivityRule().tap { + it.privacyRegulation = [privacyAllowRegulations] + } + def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) + + and: "Account gpp configuration" + def accountGppConfig = new AccountGppConfig(code: IAB_US_GENERAL, enabled: true, config: gppModuleConfig) + + and: "Existed account with privacy regulation setup" + def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) + accountDao.save(account) + + when: "PBS processes auction requests" + activityPbsService.sendAuctionRequest(bidRequest) + + then: "Bidder request should have data in UFPD fields" + def bidderRequest = bidder.getBidderRequest(bidRequest.id) + verifyAll { + bidderRequest.device.didsha1 == bidRequest.device.didsha1 + bidderRequest.device.didmd5 == bidRequest.device.didmd5 + bidderRequest.device.dpidsha1 == bidRequest.device.dpidsha1 + bidderRequest.device.ifa == bidRequest.device.ifa + bidderRequest.device.macsha1 == bidRequest.device.macsha1 + bidderRequest.device.macmd5 == bidRequest.device.macmd5 + bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 + bidderRequest.user.id == bidRequest.user.id + bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.yob == bidRequest.user.yob + bidderRequest.user.gender == bidRequest.user.gender + bidderRequest.user.data == bidRequest.user.data + bidderRequest.user.geo == bidRequest.user.geo + bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + } + + and: "Bidder request should have data in EIDS fields" + assert bidderRequest.user.eids == bidRequest.user.eids + + where: + privacyAllowRegulations | gppModuleConfig + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2KebabCase: true) + IAB_US_GENERAL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + IAB_ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) + ALL | new GppModuleConfig(allowPersonalDataConsent2SnakeCase: true) } } From dd605ed2e035508ac8f64a7ea587373e3b48d1ad Mon Sep 17 00:00:00 2001 From: markiian Date: Thu, 27 Feb 2025 15:29:34 +0200 Subject: [PATCH 2/3] Update after review --- .../privacy/GppFetchBidActivitiesSpec.groovy | 9 ++------ .../privacy/GppSyncUserActivitiesSpec.groovy | 20 +++++------------- .../GppTransmitEidsActivitiesSpec.groovy | 20 +++++------------- ...GppTransmitPreciseGeoActivitiesSpec.groovy | 20 +++++------------- .../GppTransmitUfpdActivitiesSpec.groovy | 21 +++++-------------- 5 files changed, 22 insertions(+), 68 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppFetchBidActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppFetchBidActivitiesSpec.groovy index db74b18ee48..46634fda48f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppFetchBidActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppFetchBidActivitiesSpec.groovy @@ -604,10 +604,7 @@ class GppFetchBidActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for fetchBid with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } - + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(FETCH_BIDS, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -1312,9 +1309,7 @@ class GppFetchBidActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for fetchBid with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(FETCH_BIDS, Activity.getDefaultActivity([rule])) diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy index e8ac00c3c9e..a6d9d6e7aad 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy @@ -352,9 +352,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for cookie sync with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) @@ -1185,9 +1183,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def uidsCookie = UidsCookie.defaultUidsCookie and: "Activities set for cookie sync with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) @@ -2066,9 +2062,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for cookie sync with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -2101,9 +2095,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for cookie sync with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulation] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulation]) def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -2155,9 +2147,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for cookie sync with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulation] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulation]) def activities = AllowActivities.getDefaultAllowActivities(SYNC_USER, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy index 70e32deb3c2..685a2589d1f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy @@ -619,9 +619,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitEIDS with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) @@ -1588,9 +1586,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitEIDS with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) @@ -2344,9 +2340,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitEIDS with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -2377,9 +2371,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitEIDS with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -2428,9 +2420,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitEIDS with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_EIDS, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy index b8e647681d6..c0c9495bfc3 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitPreciseGeoActivitiesSpec.groovy @@ -993,9 +993,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) @@ -2208,9 +2206,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitPreciseGeo with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) @@ -3026,9 +3022,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -3084,9 +3078,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -3160,9 +3152,7 @@ class GppTransmitPreciseGeoActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitPreciseGeo with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_PRECISE_GEO, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy index e29bd8787be..920196ea576 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy @@ -847,9 +847,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitUfpd with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) @@ -2100,9 +2098,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitUfpd with allowing privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) @@ -3076,10 +3072,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitUfpd with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } - + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -3127,9 +3120,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitUfpd with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" @@ -3195,9 +3186,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { } and: "Activities set for transmitUfpd with rejecting privacy regulation" - def rule = new ActivityRule().tap { - it.privacyRegulation = [privacyAllowRegulations] - } + def rule = new ActivityRule(privacyRegulation: [privacyAllowRegulations]) def activities = AllowActivities.getDefaultAllowActivities(TRANSMIT_UFPD, Activity.getDefaultActivity([rule])) and: "Account gpp configuration" From 39541242b89622d74bb201c815559573a7df100d Mon Sep 17 00:00:00 2001 From: markiian Date: Fri, 28 Feb 2025 14:09:57 +0200 Subject: [PATCH 3/3] Update after review --- .../server/functional/model/config/GppModuleConfig.groovy | 4 ++-- .../tests/privacy/GppTransmitEidsActivitiesSpec.groovy | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy b/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy index ad120c77988..7afeed64fa8 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/GppModuleConfig.groovy @@ -24,9 +24,9 @@ class GppModuleConfig { @JsonProperty("skip-sids") List skipSidsKebabCase Boolean allowPersonalDataConsent2 - @JsonProperty("allow_personal_data_consent2") + @JsonProperty("allow_personal_data_consent_2") Boolean allowPersonalDataConsent2SnakeCase - @JsonProperty("allow-personal-data-consent2") + @JsonProperty("allow-personal-data-consent-2") Boolean allowPersonalDataConsent2KebabCase static GppModuleConfig getDefaultModuleConfig(ActivityConfig activityConfig = ActivityConfig.configWithDefaultRestrictRules, diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy index 685a2589d1f..73dfda85a23 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy @@ -2430,13 +2430,12 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { def account = getAccountWithAllowActivitiesAndPrivacyModule(accountId, activities, [accountGppConfig]) accountDao.save(account) - when: "PBS processes auction requests" + when: "PBS processes auction request" activityPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain EIDS fields" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert bidderRequest.user.eids - assert bidderRequest.user?.ext?.eids where: privacyAllowRegulations | gppModuleConfig