Skip to content

Commit

Permalink
Multiple modules: decouple GVL IDs from storage access control (#9736)
Browse files Browse the repository at this point in the history
* Core: allow restriction of cookies / localStorage through `bidderSettings.*.storageAllowed`

* Add test cases

* Remove gvlid param from storage manager logic

* Refactor every invocation of `getStorageManager`

* GVL ID registry

* Refactor gdprEnforcement gvlid lookup

* fix lint

* Remove empty file

* Undo #9728 for realVu

* Fix typo
  • Loading branch information
dgirardi authored Apr 6, 2023
1 parent 7ea38f1 commit 4f45f15
Show file tree
Hide file tree
Showing 108 changed files with 685 additions and 488 deletions.
2 changes: 1 addition & 1 deletion modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const SUPPORTED_MEDIA_TYPES = [BANNER, NATIVE, VIDEO];
const ADAGIO_TAG_URL = 'https://script.4dex.io/localstore.js';
const ADAGIO_LOCALSTORAGE_KEY = 'adagioScript';
const GVLID = 617;
export const storage = getStorageManager({gvlid: GVLID, bidderCode: BIDDER_CODE});
export const storage = getStorageManager({bidderCode: BIDDER_CODE});
export const RENDERER_URL = 'https://script.4dex.io/outstream-player.js';
const MAX_SESS_DURATION = 30 * 60 * 1000;
const ADAGIO_PUBKEY = 'AL16XT44Sfp+8SHVF1UdC7hydPSMVLMhsYknKDdwqq+0ToDSJrP0+Qh0ki9JJI2uYm/6VEYo8TJED9WfMkiJ4vf02CW3RvSWwc35bif2SK1L8Nn/GfFYr/2/GG/Rm0vUsv+vBHky6nuuYls20Og0HDhMgaOlXoQ/cxMuiy5QSktp';
Expand Down
6 changes: 4 additions & 2 deletions modules/adkernelAdnAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { logError, parseUrl, _each } from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {config} from '../src/config.js';
import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';

const MODULE_CODE = 'adkernelAdn';
const GVLID = 14;
const ANALYTICS_VERSION = '1.0.2';
const DEFAULT_QUEUE_TIMEOUT = 4000;
const DEFAULT_HOST = 'tag.adkernel.com';
const storageObj = getStorageManager({gvlid: GVLID});
const storageObj = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_CODE});

const ADK_HB_EVENTS = {
AUCTION_INIT: 'auctionInit',
Expand Down Expand Up @@ -104,7 +106,7 @@ analyticsAdapter.enableAnalytics = (config) => {

adapterManager.registerAnalyticsAdapter({
adapter: analyticsAdapter,
code: 'adkernelAdn',
code: MODULE_CODE,
gvlid: GVLID
});

Expand Down
6 changes: 4 additions & 2 deletions modules/admixerIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ import { logError, logInfo } from '../src/utils.js'
import { ajax } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

export const storage = getStorageManager();
const NAME = 'admixerId';
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: NAME});

/** @type {Submodule} */
export const admixerIdSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: 'admixerId',
name: NAME,
/**
* used to specify vendor id
* @type {number}
Expand Down
2 changes: 1 addition & 1 deletion modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const getSegmentsFromOrtb = function (ortb2) {
// }

const handleMeta = function () {
const storage = getStorageManager({ gvlid: GVLID, bidderCode: BIDDER_CODE })
const storage = getStorageManager({ bidderCode: BIDDER_CODE })
let adnMeta = null
if (storage.localStorageIsEnabled()) {
adnMeta = JSON.parse(storage.getDataFromLocalStorage('adn.metaData'))
Expand Down
2 changes: 1 addition & 1 deletion modules/adqueryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ADQUERY_USER_SYNC_DOMAIN = ADQUERY_BIDDER_DOMAIN_PROTOCOL + '://' + ADQUER
const ADQUERY_DEFAULT_CURRENCY = 'PLN';
const ADQUERY_NET_REVENUE = true;
const ADQUERY_TTL = 360;
const storage = getStorageManager({gvlid: ADQUERY_GVLID, bidderCode: ADQUERY_BIDDER_CODE});
const storage = getStorageManager({bidderCode: ADQUERY_BIDDER_CODE});

/** @type {BidderSpec} */
export const spec = {
Expand Down
3 changes: 2 additions & 1 deletion modules/adqueryIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import { isFn, isStr, isPlainObject, logError } from '../src/utils.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

const MODULE_NAME = 'qid';
const AU_GVLID = 902;

export const storage = getStorageManager({gvlid: AU_GVLID, moduleName: 'qid'});
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: 'qid'});

/**
* Param or default.
Expand Down
5 changes: 3 additions & 2 deletions modules/adriverIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
import { logError, isPlainObject } from '../src/utils.js'
import { ajax } from '../src/ajax.js';
import { submodule } from '../src/hook.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

const MODULE_NAME = 'adriverId';

export const storage = getStorageManager();
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME});

/** @type {Submodule} */
export const adriverIdSubmodule = {
Expand Down
6 changes: 4 additions & 2 deletions modules/airgridRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import {
deepAccess,
} from '../src/utils.js';
import { getGlobal } from '../src/prebidGlobal.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_RTD} from '../src/activities/modules.js';

const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'airgrid';
const AG_TCF_ID = 782;
export const AG_AUDIENCE_IDS_KEY = 'edkt_matched_audience_ids';

export const storage = getStorageManager({
gvlid: AG_TCF_ID,
moduleType: MODULE_TYPE_RTD,
moduleName: SUBMODULE_NAME,
});

Expand Down Expand Up @@ -154,6 +155,7 @@ export const airgridSubmodule = {
name: SUBMODULE_NAME,
init: init,
getBidRequestData: passAudiencesToBidders,
gvlid: AG_TCF_ID
};

submodule(MODULE_NAME, airgridSubmodule);
3 changes: 2 additions & 1 deletion modules/akamaiDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import {isPlainObject, mergeDeep, logMessage, logInfo, logError} from '../src/utils.js';
import { loadExternalScript } from '../src/adloader.js';
import {MODULE_TYPE_RTD} from '../src/activities/modules.js';

const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'dap';
Expand All @@ -23,7 +24,7 @@ export const DAP_DEFAULT_TOKEN_TTL = 3600; // in seconds
export const DAP_MAX_RETRY_TOKENIZE = 1;
export const DAP_CLIENT_ENTROPY = 'dap_client_entropy'

export const storage = getStorageManager({gvlid: null, moduleName: SUBMODULE_NAME});
export const storage = getStorageManager({moduleType: MODULE_TYPE_RTD, moduleName: SUBMODULE_NAME});
let dapRetryTokenize = 0;

/**
Expand Down
18 changes: 9 additions & 9 deletions modules/amxBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
import {
parseUrl,
deepAccess,
_each,
deepAccess,
formatQS,
getUniqueIdentifierStr,
triggerPixel,
isArray,
isFn,
logError,
isArray,
parseUrl,
triggerPixel,
} from '../src/utils.js';
import { config } from '../src/config.js';
import { getStorageManager } from '../src/storageManager.js';
import {config} from '../src/config.js';
import {getStorageManager} from '../src/storageManager.js';

const BIDDER_CODE = 'amx';
const storage = getStorageManager({ gvlid: 737, bidderCode: BIDDER_CODE });
const storage = getStorageManager({ bidderCode: BIDDER_CODE });
const SIMPLE_TLD_TEST = /\.com?\.\w{2,4}$/;
const DEFAULT_ENDPOINT = 'https://prebid.a-mo.net/a/c';
const VERSION = 'pba1.3.2';
Expand Down
2 changes: 1 addition & 1 deletion modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const SCRIPT_TAG_START = '<script';
const VIEWABILITY_URL_START = /\/\/cdn\.adnxs\.com\/v|\/\/cdn\.adnxs\-simple\.com\/v/;
const VIEWABILITY_FILE_NAME = 'trk.js';
const GVLID = 32;
const storage = getStorageManager({gvlid: GVLID, bidderCode: BIDDER_CODE});
const storage = getStorageManager({bidderCode: BIDDER_CODE});

export const spec = {
code: BIDDER_CODE,
Expand Down
2 changes: 1 addition & 1 deletion modules/apstreamBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const CONSTANTS = {
BIDDER_CODE: 'apstream',
GVLID: 394
};
const storage = getStorageManager({gvlid: CONSTANTS.GVLID, bidderCode: CONSTANTS.BIDDER_CODE});
const storage = getStorageManager({bidderCode: CONSTANTS.BIDDER_CODE});

var dsuModule = (function() {
'use strict';
Expand Down
6 changes: 4 additions & 2 deletions modules/atsAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {getGlobal} from '../src/prebidGlobal.js';

export const storage = getStorageManager();
import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';
const MODULE_CODE = 'atsAnalytics';
export const storage = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_CODE});

/**
* Analytics adapter for - https://liveramp.com
Expand Down Expand Up @@ -399,7 +401,7 @@ atsAnalyticsAdapter.callHandler = function (evtype, args) {

adaptermanager.registerAnalyticsAdapter({
adapter: atsAnalyticsAdapter,
code: 'atsAnalytics',
code: MODULE_CODE,
gvlid: 97
});

Expand Down
3 changes: 2 additions & 1 deletion modules/blueconicRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import {getStorageManager} from '../src/storageManager.js';
import {submodule} from '../src/hook.js';
import {mergeDeep, isPlainObject, logMessage, logError} from '../src/utils.js';
import {MODULE_TYPE_RTD} from '../src/activities/modules.js';

const MODULE_NAME = 'realTimeData';
const SUBMODULE_NAME = 'blueconic';

export const RTD_LOCAL_NAME = 'bcPrebidData';

export const storage = getStorageManager({moduleName: SUBMODULE_NAME});
export const storage = getStorageManager({moduleType: MODULE_TYPE_RTD, moduleName: SUBMODULE_NAME});

/**
* Try parsing stringified array of data.
Expand Down
6 changes: 4 additions & 2 deletions modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import {find, includes} from '../src/polyfill.js';
import {getGlobal} from '../src/prebidGlobal.js';
import * as events from '../src/events.js';
import CONSTANTS from '../src/constants.json';
import {MODULE_TYPE_RTD} from '../src/activities/modules.js';
const MODULE_NAME = 'browsi';

const storage = getStorageManager();
const storage = getStorageManager({moduleType: MODULE_TYPE_RTD, moduleName: MODULE_NAME});

/** @type {ModuleParams} */
let _moduleParams = {};
Expand Down Expand Up @@ -336,7 +338,7 @@ export const browsiSubmodule = {
* used to link submodule with realTimeData
* @type {string}
*/
name: 'browsi',
name: MODULE_NAME,
/**
* get data and send back to realTimeData module
* @function
Expand Down
9 changes: 6 additions & 3 deletions modules/byDataAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import enc from 'crypto-js/enc-utf8';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import CONSTANTS from '../src/constants.json';
import adapterManager from '../src/adapterManager.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import { auctionManager } from '../src/auctionManager.js';
import { ajax } from '../src/ajax.js';
import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';

const versionCode = '4.4.1'
const secretKey = 'bydata@123456'
Expand All @@ -16,7 +17,9 @@ const DEFAULT_EVENT_URL = 'https://pbjs-stream.bydata.com/topics/prebid'
const analyticsType = 'endpoint'
const isBydata = isKeyInUrl('bydata_debug')
const adunitsMap = {}
const storage = getStorageManager();
const MODULE_CODE = 'bydata';
const storage = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_CODE});

let initOptions = {}
var payload = {}
var winPayload = {}
Expand Down Expand Up @@ -391,7 +394,7 @@ function sendDataOnKf(dataObj) {

adapterManager.registerAnalyticsAdapter({
adapter: ascAdapter,
code: 'bydata'
code: MODULE_CODE,
});

function _logInfo(message, meta) {
Expand Down
2 changes: 1 addition & 1 deletion modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const BIDDER_CODE = 'criteo';
const CDB_ENDPOINT = 'https://bidder.criteo.com/cdb';
const PROFILE_ID_INLINE = 207;
export const PROFILE_ID_PUBLISHERTAG = 185;
export const storage = getStorageManager({ gvlid: GVLID, bidderCode: BIDDER_CODE });
export const storage = getStorageManager({ bidderCode: BIDDER_CODE });
const LOG_PREFIX = 'Criteo: ';

/*
Expand Down
5 changes: 3 additions & 2 deletions modules/criteoIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { timestamp, parseUrl, triggerPixel, logError } from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { getRefererInfo } from '../src/refererDetection.js';
import { submodule } from '../src/hook.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

const gvlid = 91;
const bidderCode = 'criteo';
export const storage = getStorageManager({ gvlid: gvlid, moduleName: bidderCode });
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: bidderCode});

const bididStorageKey = 'cto_bidid';
const bundleStorageKey = 'cto_bundle';
Expand Down
5 changes: 3 additions & 2 deletions modules/czechAdIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
*/

import { submodule } from '../src/hook.js'
import { getStorageManager } from '../src/storageManager.js'
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

// Returns StorageManager
export const storage = getStorageManager({ gvlid: 570, moduleName: 'czechAdId' })
export const storage = getStorageManager({ moduleType: MODULE_TYPE_UID, moduleName: 'czechAdId' })

// Returns the id string from either cookie or localstorage
const readId = () => { return storage.getCookie('czaid') || storage.getDataFromLocalStorage('czaid') }
Expand Down
7 changes: 4 additions & 3 deletions modules/dacIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import {
import {
getStorageManager
} from '../src/storageManager.js';

export const storage = getStorageManager();
import {MODULE_TYPE_UID} from '../src/activities/modules.js';
const MODULE_NAME = 'dacId';
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME});

export const FUUID_COOKIE_NAME = '_a1_f';
export const AONEID_COOKIE_NAME = '_a1_d';
Expand Down Expand Up @@ -116,7 +117,7 @@ export const dacIdSystemSubmodule = {
* used to link submodule with config
* @type {string}
*/
name: 'dacId',
name: MODULE_NAME,

/**
* decode the stored id value for passing to bid requests
Expand Down
5 changes: 3 additions & 2 deletions modules/deepintentDpesIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
*/

import { submodule } from '../src/hook.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

const MODULE_NAME = 'deepintentId';
export const storage = getStorageManager({gvlid: null, moduleName: MODULE_NAME});
export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME});

/** @type {Submodule} */
export const deepintentDpesSubmodule = {
Expand Down
2 changes: 1 addition & 1 deletion modules/discoveryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BANNER, NATIVE } from '../src/mediaTypes.js';
const BIDDER_CODE = 'discovery';
const ENDPOINT_URL = 'https://rtb-jp.mediago.io/api/bid?tn=';
const TIME_TO_LIVE = 500;
const storage = getStorageManager();
const storage = getStorageManager({bidderCode: BIDDER_CODE});
let globals = {};
let itemMaps = {};
const MEDIATYPE = [BANNER, NATIVE];
Expand Down
8 changes: 5 additions & 3 deletions modules/fintezaAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { parseUrl, logError } from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import { getStorageManager } from '../src/storageManager.js';
import {getStorageManager} from '../src/storageManager.js';
import CONSTANTS from '../src/constants.json';
import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';

const storage = getStorageManager();
const MODULE_CODE = 'finteza';
const storage = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_CODE});

const ANALYTICS_TYPE = 'endpoint';
const FINTEZA_HOST = 'https://content.mql5.com/tr';
Expand Down Expand Up @@ -439,7 +441,7 @@ fntzAnalyticsAdapter.enableAnalytics = function (config) {

adapterManager.registerAnalyticsAdapter({
adapter: fntzAnalyticsAdapter,
code: 'finteza'
code: MODULE_CODE,
});

export default fntzAnalyticsAdapter;
Loading

0 comments on commit 4f45f15

Please sign in to comment.