Skip to content

Commit f019cb2

Browse files
dgirardipatmmccann
andauthored
Multiple modules: remove GVL IDs that are missing or marked as deleted in the GVL (prebid#13647)
* validate GVL IDs deletedDate * remove invalid GVL IDs * fix lint * Update cadent_aperture_mxBidAdapter.js * Update beachfrontBidAdapter.js --------- Co-authored-by: Patrick McCann <pmccann@cafemedia.com>
1 parent ba9a622 commit f019cb2

25 files changed

Lines changed: 120 additions & 62 deletions

gulpfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,9 @@ gulp.task('build-bundle-verbose', gulp.series(precompile(), 'build-creative-dev'
534534

535535
// public tasks (dependencies are needed for each task since they can be ran on their own)
536536
gulp.task('update-browserslist', execaTask('npx update-browserslist-db@latest'));
537-
gulp.task('test-only-nobuild', testTaskMaker({coverage: true}))
538-
gulp.task('test-only', gulp.series('precompile', test));
537+
gulp.task('test-build-logic', execaTask('npx mocha ./test/build-logic'))
538+
gulp.task('test-only-nobuild', gulp.series('test-build-logic', testTaskMaker({coverage: true})))
539+
gulp.task('test-only', gulp.series('test-build-logic', 'precompile', test));
539540

540541
gulp.task('test-all-features-disabled-nobuild', testTaskMaker({disableFeatures: helpers.getTestDisableFeatures(), oneBrowser: 'chrome', watch: false}));
541542
gulp.task('test-all-features-disabled', gulp.series('precompile-all-features-disabled', 'test-all-features-disabled-nobuild'));

metadata/compileMetadata.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import coreMetadata from './core.json' with {type: 'json'};
66

77
import overrides from './overrides.mjs';
88
import {fetchDisclosure, getDisclosureUrl, logErrorSummary} from './storageDisclosure.mjs';
9+
import {isValidGvlId} from './gvl.mjs';
910

1011
const MAX_DISCLOSURE_AGE_DAYS = 14;
1112

@@ -109,6 +110,28 @@ async function updateModuleMetadata(moduleName, metadata) {
109110
);
110111
}
111112

113+
async function validateGvlIds() {
114+
let invalid = false;
115+
(await Promise.all(
116+
moduleMetadata
117+
.components
118+
.filter(({gvlid}) => gvlid != null)
119+
.map(({componentName, componentType, gvlid}) => isValidGvlId(gvlid).then(valid => ({
120+
valid,
121+
componentName,
122+
componentType,
123+
gvlid
124+
})))
125+
)).filter(({valid}) => !valid)
126+
.forEach(({componentName, componentType, gvlid}) => {
127+
console.error(`"${componentType}.${componentName}" provides a GVL ID that is deleted or missing: ${gvlid}`)
128+
invalid = true;
129+
})
130+
if (invalid) {
131+
throw new Error('One or more GVL IDs are invalid')
132+
}
133+
}
134+
112135
async function compileModuleMetadata() {
113136
const processed = [];
114137
const found = new WeakSet();
@@ -155,6 +178,7 @@ async function compileModuleMetadata() {
155178

156179

157180
export default async function compileMetadata() {
181+
await validateGvlIds();
158182
const allModules = new Set((await compileCoreMetadata())
159183
.concat(await compileModuleMetadata()));
160184
logErrorSummary();

metadata/gvl.mjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const GVL_URL = 'https://vendor-list.consensu.org/v3/vendor-list.json';
2+
3+
export const getGvl = (() => {
4+
let gvl;
5+
return function () {
6+
if (gvl == null) {
7+
gvl = fetch(GVL_URL)
8+
.then(resp => resp.json())
9+
.catch((err) => {
10+
gvl = null;
11+
return Promise.reject(err);
12+
});
13+
}
14+
return gvl;
15+
};
16+
})();
17+
18+
export function isValidGvlId(gvlId, gvl = getGvl) {
19+
return gvl().then(gvl => {
20+
return !!(gvl.vendors[gvlId] && !gvl.vendors[gvlId].deletedDate);
21+
})
22+
}

metadata/storageDisclosure.mjs

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
import fs from 'fs';
2+
import {getGvl, isValidGvlId} from './gvl.mjs';
23

3-
const GVL_URL = 'https://vendor-list.consensu.org/v3/vendor-list.json';
44
const LOCAL_DISCLOSURE_PATTERN = /^local:\/\//;
55
const LOCAL_DISCLOSURE_PATH = './metadata/disclosures/'
66
const LOCAL_DISCLOSURES_URL = 'https://cdn.jsdelivr.net/gh/prebid/Prebid.js/metadata/disclosures/';
77

88
const PARSE_ERROR_LINES = 20;
99

10-
export const getGvl = (() => {
11-
let gvl;
12-
return function () {
13-
if (gvl == null) {
14-
gvl = fetch(GVL_URL)
15-
.then(resp => resp.json())
16-
.catch((err) => {
17-
gvl = null;
18-
return Promise.reject(err);
19-
});
20-
}
21-
return gvl;
22-
};
23-
})();
2410

25-
export function getDisclosureUrl(gvlId) {
26-
return getGvl().then(gvl => {
27-
return gvl.vendors[gvlId]?.deviceStorageDisclosureUrl;
28-
});
11+
export async function getDisclosureUrl(gvlId, gvl = getGvl) {
12+
if (await isValidGvlId(gvlId, gvl)) {
13+
return (await gvl()).vendors[gvlId]?.deviceStorageDisclosureUrl;
14+
}
2915
}
3016

3117
function parseDisclosure(payload) {

modules/aidemBidAdapter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const BIDDER_CODE = 'aidem';
1010
const BASE_URL = 'https://zero.aidemsrv.com';
1111
const LOCAL_BASE_URL = 'http://127.0.0.1:8787';
1212

13-
const GVLID = 1218
1413
const SUPPORTED_MEDIA_TYPES = [BANNER, VIDEO];
1514
const REQUIRED_VIDEO_PARAMS = [ 'mimes', 'protocols', 'context' ];
1615

@@ -233,7 +232,6 @@ function hasValidParameters(bidRequest) {
233232

234233
export const spec = {
235234
code: BIDDER_CODE,
236-
gvlid: GVLID,
237235
supportedMediaTypes: SUPPORTED_MEDIA_TYPES,
238236
isBidRequestValid: function(bidRequest) {
239237
logInfo('bid: ', bidRequest);

modules/ampliffyBidAdapter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
22
import {logError, logInfo, triggerPixel} from '../src/utils.js';
33

44
const BIDDER_CODE = 'ampliffy';
5-
const GVLID = 1258;
65
const DEFAULT_ENDPOINT = 'bidder.ampliffy.com';
76
const TTL = 600; // Time-to-Live - how long (in seconds) Prebid can use this bid.
87
const LOG_PREFIX = 'AmpliffyBidder: ';
@@ -400,7 +399,6 @@ function onTimeOut() {
400399

401400
export const spec = {
402401
code: BIDDER_CODE,
403-
gvlid: GVLID,
404402
aliases: ['ampliffy', 'amp', 'videoffy', 'publiffy'],
405403
supportedMediaTypes: ['video', 'banner'],
406404
isBidRequestValid,

modules/beachfrontBidAdapter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {BANNER, VIDEO} from '../src/mediaTypes.js';
1313
import { getFirstSize, getOsVersion, getVideoSizes, getBannerSizes, isConnectedTV, getDoNotTrack, isMobile, isBannerBid, isVideoBid, getBannerBidFloor, getVideoBidFloor, getVideoTargetingParams, getTopWindowLocation } from '../libraries/advangUtils/index.js';
1414

1515
const ADAPTER_VERSION = '1.21';
16-
const GVLID = 335;
16+
const GVLID = 157;
1717
const ADAPTER_NAME = 'BFIO_PREBID';
1818
const OUTSTREAM = 'outstream';
1919
const CURRENCY = 'USD';
@@ -38,9 +38,8 @@ let appId = '';
3838

3939
export const spec = {
4040
code: 'beachfront',
41-
gvlid: GVLID,
4241
supportedMediaTypes: [ VIDEO, BANNER ],
43-
42+
gvlid: GVLID,
4443
isBidRequestValid(bid) {
4544
if (isVideoBid(bid)) {
4645
if (!getVideoBidParam(bid, 'appId')) {

modules/cadent_aperture_mxBidAdapter.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const RENDERER_URL = 'https://js.brealtime.com/outstream/1.30.0/bundle.js';
1919
const ADAPTER_VERSION = '1.5.1';
2020
const DEFAULT_CUR = 'USD';
2121
const ALIASES = [
22-
{ code: 'emx_digital', gvlid: 183 },
23-
{ code: 'cadent', gvlid: 183 },
24-
{ code: 'emxdigital', gvlid: 183 },
25-
{ code: 'cadentaperturemx', gvlid: 183 },
22+
{ code: 'emx_digital'},
23+
{ code: 'cadent'},
24+
{ code: 'emxdigital'},
25+
{ code: 'cadentaperturemx'},
2626
];
2727

2828
const EIDS_SUPPORTED = [
@@ -222,8 +222,7 @@ export const cadentAdapter = {
222222

223223
export const spec = {
224224
code: BIDDER_CODE,
225-
gvlid: 183,
226-
alias: ALIASES,
225+
aliases: ALIASES,
227226
supportedMediaTypes: [BANNER, VIDEO],
228227
isBidRequestValid: function (bid) {
229228
if (!bid || !bid.params) {

modules/ccxBidAdapter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {getStorageManager} from '../src/storageManager.js';
55
const BIDDER_CODE = 'ccx'
66
const storage = getStorageManager({bidderCode: BIDDER_CODE});
77
const BID_URL = 'https://delivery.clickonometrics.pl/ortb/prebid/bid'
8-
const GVLID = 773;
98
const SUPPORTED_VIDEO_PROTOCOLS = [2, 3, 5, 6]
109
const SUPPORTED_VIDEO_MIMES = ['video/mp4', 'video/x-flv']
1110
const SUPPORTED_VIDEO_PLAYBACK_METHODS = [1, 2, 3, 4]
@@ -144,7 +143,6 @@ function _buildResponse (bid, currency, ttl) {
144143

145144
export const spec = {
146145
code: BIDDER_CODE,
147-
gvlid: GVLID,
148146
supportedMediaTypes: ['banner', 'video'],
149147

150148
isBidRequestValid: function (bid) {

modules/innityBidAdapter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { parseSizesInput, timestamp } from '../src/utils.js';
22
import { registerBidder } from '../src/adapters/bidderFactory.js';
33

44
const BIDDER_CODE = 'innity';
5-
const GVLID = 535;
65
const ENDPOINT = 'https://as.innity.com/synd/';
76

87
export const spec = {
98
code: BIDDER_CODE,
10-
gvlid: GVLID,
119
isBidRequestValid: function(bid) {
1210
return !!(bid.params && bid.params.pub && bid.params.zone);
1311
},

0 commit comments

Comments
 (0)