Skip to content

Commit 12ccfc9

Browse files
committed
Prebid 8: remove GDPR check when GDPR enforcement is disabled
1 parent f3fadda commit 12ccfc9

File tree

4 files changed

+2
-51
lines changed

4 files changed

+2
-51
lines changed

modules/gdprEnforcement.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {deepAccess, logError, logWarn} from '../src/utils.js';
66
import {config} from '../src/config.js';
77
import adapterManager, {gdprDataHandler} from '../src/adapterManager.js';
88
import {find} from '../src/polyfill.js';
9-
import {getHook} from '../src/hook.js';
109
import * as events from '../src/events.js';
1110
import CONSTANTS from '../src/constants.json';
1211
import {GDPR_GVLIDS, VENDORLESS_GVLID} from '../src/consentHandler.js';
@@ -219,15 +218,6 @@ export const accessDeviceRule = ((rule) => {
219218
export const syncUserRule = gdprRule(1, () => purpose1Rule, storageBlocked);
220219
export const enrichEidsRule = gdprRule(1, () => purpose1Rule, storageBlocked);
221220

222-
export function userIdHook(fn, submodules, consentData) {
223-
// TODO: remove this in v8 (https://github.com/prebid/Prebid.js/issues/9766)
224-
if (shouldEnforce(consentData, 1, 'User ID')) {
225-
fn.call(this, submodules, {...consentData, hasValidated: true});
226-
} else {
227-
fn.call(this, submodules, consentData);
228-
}
229-
}
230-
231221
export const fetchBidsRule = ((rule) => {
232222
return function (params) {
233223
if (params[ACTIVITY_PARAM_COMPONENT_TYPE] !== MODULE_TYPE_BIDDER) {
@@ -307,8 +297,6 @@ export function setEnforcementConfig(config) {
307297
RULE_HANDLES.push(registerActivityControl(ACTIVITY_ACCESS_DEVICE, RULE_NAME, accessDeviceRule));
308298
RULE_HANDLES.push(registerActivityControl(ACTIVITY_SYNC_USER, RULE_NAME, syncUserRule));
309299
RULE_HANDLES.push(registerActivityControl(ACTIVITY_ENRICH_EIDS, RULE_NAME, enrichEidsRule));
310-
// TODO: remove this hook in v8 (https://github.com/prebid/Prebid.js/issues/9766)
311-
getHook('validateGdprEnforcement').before(userIdHook, 47);
312300
}
313301
if (purpose2Rule) {
314302
RULE_HANDLES.push(registerActivityControl(ACTIVITY_FETCH_BIDS, RULE_NAME, fetchBidsRule));
@@ -321,9 +309,6 @@ export function setEnforcementConfig(config) {
321309

322310
export function uninstall() {
323311
while (RULE_HANDLES.length) RULE_HANDLES.pop()();
324-
[
325-
getHook('validateGdprEnforcement').getHooks({hook: userIdHook}),
326-
].forEach(hook => hook.remove());
327312
hooksAdded = false;
328313
}
329314

modules/userId/index.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ import * as events from '../../src/events.js';
132132
import {getGlobal} from '../../src/prebidGlobal.js';
133133
import adapterManager, {gdprDataHandler} from '../../src/adapterManager.js';
134134
import CONSTANTS from '../../src/constants.json';
135-
import {hook, module, ready as hooksReady} from '../../src/hook.js';
135+
import {module, ready as hooksReady} from '../../src/hook.js';
136136
import {buildEidPermissions, createEidsArray, USER_IDS_CONFIG} from './eids.js';
137137
import {
138138
getCoreStorageManager,
@@ -159,7 +159,6 @@ import {
159159
} from '../../src/utils.js';
160160
import {getPPID as coreGetPPID} from '../../src/adserver.js';
161161
import {defer, GreedyPromise} from '../../src/utils/promise.js';
162-
import {hasPurpose1Consent} from '../../src/utils/gpdr.js';
163162
import {registerOrtbProcessor, REQUEST} from '../../src/pbjsORTB.js';
164163
import {newMetrics, timedAuctionHook, useMetrics} from '../../src/utils/perfMetrics.js';
165164
import {findRootDomain} from '../../src/fpd/rootDomain.js';
@@ -784,15 +783,6 @@ function getUserIdsAsync() {
784783
);
785784
}
786785

787-
/**
788-
* This hook returns updated list of submodules which are allowed to do get user id based on TCF 2 enforcement rules configured
789-
*/
790-
export const validateGdprEnforcement = hook('sync', function (submodules, consentData) {
791-
// TODO: remove the `hasValidated` check in v8. Enforcement should be OFF by default.
792-
// https://github.com/prebid/Prebid.js/issues/9766
793-
return { userIdModules: submodules, hasValidated: consentData && consentData.hasValidated };
794-
}, 'validateGdprEnforcement');
795-
796786
function populateSubmoduleId(submodule, consentData, storedConsentData, forceRefresh) {
797787
// There are two submodule configuration types to handle: storage or value
798788
// 1. storage: retrieve user id data from cookie/html storage or with the submodule's getId method
@@ -882,18 +872,11 @@ function initSubmodules(dest, submodules, consentData, forceRefresh = false) {
882872
return [];
883873
}
884874

885-
// TODO: remove this check in v8 (https://github.com/prebid/Prebid.js/issues/9766)
886-
let { userIdModules, hasValidated } = validateGdprEnforcement(submodules, consentData);
887-
if (!hasValidated && !hasPurpose1Consent(consentData)) {
888-
logWarn(`${MODULE_NAME} - gdpr permission not valid for local storage or cookies, exit module`);
889-
return [];
890-
}
891-
892875
// we always want the latest consentData stored, even if we don't execute any submodules
893876
const storedConsentData = getStoredConsentData();
894877
setStoredConsentData(consentData);
895878

896-
const initialized = userIdModules.reduce((carry, submodule) => {
879+
const initialized = submodules.reduce((carry, submodule) => {
897880
return submoduleMetrics(submodule.submodule.name).measureTime('init', () => {
898881
try {
899882
populateSubmoduleId(submodule, consentData, storedConsentData, forceRefresh);

test/spec/modules/euidIdSystem_spec.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ describe('EUID module', function() {
6464
coreStorage.removeDataFromLocalStorage(moduleCookieName);
6565
});
6666

67-
it('When a server-only token value is provided in config but consent is not available, it is not available to the auction.', async function() {
68-
setGdprApplies();
69-
config.setConfig(makePrebidConfig(null, {value: makeEuidIdentityContainer(initialToken)}));
70-
const bid = await runAuction();
71-
expectNoIdentity(bid);
72-
});
73-
7467
it('When a server-only token value is provided in config, it is available to the auction.', async function() {
7568
setGdprApplies(true);
7669
config.setConfig(makePrebidConfig(null, {value: makeEuidIdentityContainer(initialToken)}));

test/spec/modules/uid2IdSystem_spec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,6 @@ describe(`UID2 module`, function () {
170170
expectLegacyToken(bid);
171171
});
172172

173-
it('When a legacy value is provided directly in configuration but GDPR applies, it is not passed on', async function() {
174-
const valueConfig = makePrebidConfig();
175-
setGdprApplies();
176-
valueConfig.userSync.userIds[0].value = {uid2: {id: legacyToken}}
177-
config.setConfig(valueConfig);
178-
const bid = await runAuction();
179-
180-
expectNoIdentity(bid);
181-
});
182-
183173
// These tests cover 'legacy' cookies - i.e. cookies set with just the uid2 advertising token, which was how some previous integrations worked.
184174
// Some users might still have this cookie, and the module should use that token if a newer one isn't provided.
185175
// This should cover older integrations where the server is setting this legacy cookie and expecting the module to pass it on.

0 commit comments

Comments
 (0)