From ef65c62c863e3b2590f78d2a4ad927ddcb87eb56 Mon Sep 17 00:00:00 2001 From: Marcin Komorski Date: Wed, 30 Oct 2024 14:58:12 +0100 Subject: [PATCH 1/4] Various adapters: setting imp secure --- libraries/ortbConverter/processors/default.js | 1 + modules/adkernelBidAdapter.js | 2 +- modules/adtrgtmeBidAdapter.js | 2 +- modules/adxcgBidAdapter.js | 2 +- modules/asoBidAdapter.js | 2 +- modules/equativBidAdapter.js | 2 +- modules/eskimiBidAdapter.js | 2 +- modules/improvedigitalBidAdapter.js | 2 +- modules/interactiveOffersBidAdapter.js | 3 +-- modules/prebidServerBidAdapter/ortbConverter.js | 2 +- modules/tappxBidAdapter.js | 2 +- modules/yahooAdsBidAdapter.js | 2 +- test/spec/modules/a1MediaBidAdapter_spec.js | 3 ++- test/spec/modules/aidemBidAdapter_spec.js | 4 ++-- test/spec/modules/bidmaticBidAdapter_spec.js | 1 + test/spec/modules/dsp_genieeBidAdapter_spec.js | 3 ++- test/spec/modules/improvedigitalBidAdapter_spec.js | 4 ++-- test/spec/modules/openxBidAdapter_spec.js | 3 ++- test/spec/modules/smaatoBidAdapter_spec.js | 1 + test/spec/modules/sparteoBidAdapter_spec.js | 4 ++++ test/spec/modules/taboolaBidAdapter_spec.js | 1 + 21 files changed, 29 insertions(+), 19 deletions(-) diff --git a/libraries/ortbConverter/processors/default.js b/libraries/ortbConverter/processors/default.js index 9d916b87172..5e0ed3a6b74 100644 --- a/libraries/ortbConverter/processors/default.js +++ b/libraries/ortbConverter/processors/default.js @@ -39,6 +39,7 @@ export const DEFAULT_PROCESSORS = { // sets initial imp to bidRequest.ortb2Imp priority: 99, fn(imp, bidRequest) { + imp.secure = imp.secure || 1; mergeDeep(imp, bidRequest.ortb2Imp); } }, diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js index 4997c92dffd..06f9154c083 100644 --- a/modules/adkernelBidAdapter.js +++ b/modules/adkernelBidAdapter.js @@ -263,7 +263,7 @@ function buildImps(bidRequest, secure) { 'tagid': bidRequest.adUnitCode }; if (secure) { - imp.secure = 1; + imp.secure = bidRequest.ortb2Imp?.secure || 1; } var sizes = []; let mediaTypes = bidRequest.mediaTypes; diff --git a/modules/adtrgtmeBidAdapter.js b/modules/adtrgtmeBidAdapter.js index 955e908f000..080a33547e9 100644 --- a/modules/adtrgtmeBidAdapter.js +++ b/modules/adtrgtmeBidAdapter.js @@ -55,7 +55,7 @@ function extractUserSyncUrls(syncOptions, pixels) { } function isSecure(bid) { - return deepAccess(bid, 'params.bidOverride.imp.secure') || (document.location.protocol === 'https:') ? 1 : 0; + return deepAccess(bid, 'params.bidOverride.imp.secure') || deepAccess(bid, 'ortb2Imp.secure') || 1; }; function getMediaType(bid) { diff --git a/modules/adxcgBidAdapter.js b/modules/adxcgBidAdapter.js index c6dde0d3f6c..6a69953af9b 100644 --- a/modules/adxcgBidAdapter.js +++ b/modules/adxcgBidAdapter.js @@ -122,7 +122,7 @@ const converter = ortbConverter({ }; } - imp.secure = Number(window.location.protocol === 'https:'); + imp.secure = bidRequest.ortb2Imp?.secure || 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; diff --git a/modules/asoBidAdapter.js b/modules/asoBidAdapter.js index a4a6c78566e..e2bc292e958 100644 --- a/modules/asoBidAdapter.js +++ b/modules/asoBidAdapter.js @@ -106,7 +106,7 @@ const converter = ortbConverter({ const imp = buildImp(bidRequest, context); imp.tagid = bidRequest.adUnitCode; - imp.secure = Number(window.location.protocol === 'https:'); + imp.secure = bidRequest.ortb2Imp?.secure || 1; return imp; }, diff --git a/modules/equativBidAdapter.js b/modules/equativBidAdapter.js index c7cb304d22b..1984f56c38b 100644 --- a/modules/equativBidAdapter.js +++ b/modules/equativBidAdapter.js @@ -94,7 +94,7 @@ export const converter = ortbConverter({ delete imp.dt; imp.bidfloor = imp.bidfloor || getBidFloor(bidRequest); - imp.secure = 1; + imp.secure = bidRequest.ortb2Imp?.secure || 1; imp.tagid = bidRequest.adUnitCode; if (siteId || pageId || formatId) { diff --git a/modules/eskimiBidAdapter.js b/modules/eskimiBidAdapter.js index 36feda03ec1..aa554725fe3 100644 --- a/modules/eskimiBidAdapter.js +++ b/modules/eskimiBidAdapter.js @@ -80,7 +80,7 @@ const CONVERTER = ortbConverter({ }, imp(buildImp, bidRequest, context) { let imp = buildImp(bidRequest, context); - imp.secure = Number(window.location.protocol === 'https:'); + imp.secure = bidRequest.ortb2Imp?.secure || 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; imp.bidfloorcur = getBidIdParameter('bidFloorCur', bidRequest.params).toUpperCase() || 'USD' diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index 158c2bd6c75..d8a47612aed 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -153,7 +153,7 @@ export const CONVERTER = ortbConverter({ }, imp(buildImp, bidRequest, context) { const imp = buildImp(bidRequest, context); - imp.secure = Number(window.location.protocol === 'https:'); + imp.secure = bidRequest.ortb2Imp?.secure || 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; imp.bidfloorcur = getBidIdParameter('bidFloorCur', bidRequest.params).toUpperCase() || DEFAULT_CURRENCY; diff --git a/modules/interactiveOffersBidAdapter.js b/modules/interactiveOffersBidAdapter.js index 8d2f0a7734d..962c266af2b 100644 --- a/modules/interactiveOffersBidAdapter.js +++ b/modules/interactiveOffersBidAdapter.js @@ -79,7 +79,6 @@ function parseRequestPrebidjsToOpenRTB(prebidRequest, bidderRequest) { // TODO: these should probably look at refererInfo let pageURL = window.location.href; let domain = window.location.hostname; - let secure = (window.location.protocol == 'https:' ? 1 : 0); let openRTBRequest = deepClone(DEFAULT['OpenRTBBidRequest']); openRTBRequest.id = bidderRequest.bidderRequestId; openRTBRequest.ext = { @@ -120,7 +119,7 @@ function parseRequestPrebidjsToOpenRTB(prebidRequest, bidderRequest) { } let imp = deepClone(DEFAULT['OpenRTBBidRequestImp']); imp.id = bid.bidId; - imp.secure = secure; + imp.secure = bid.ortb2Imp?.secure || 1; imp.tagid = bid.adUnitCode; imp.ext = { rawdata: bid diff --git a/modules/prebidServerBidAdapter/ortbConverter.js b/modules/prebidServerBidAdapter/ortbConverter.js index 31ea363c9df..5f5f85edfa2 100644 --- a/modules/prebidServerBidAdapter/ortbConverter.js +++ b/modules/prebidServerBidAdapter/ortbConverter.js @@ -37,7 +37,7 @@ const PBS_CONVERTER = ortbConverter({ } }); if (Object.values(SUPPORTED_MEDIA_TYPES).some(mtype => imp[mtype])) { - imp.secure = context.s2sBidRequest.s2sConfig.secure; + imp.secure = proxyBidRequest.ortb2Imp?.secure || 1; return imp; } }, diff --git a/modules/tappxBidAdapter.js b/modules/tappxBidAdapter.js index 28965cf8ad0..02b28a74f29 100644 --- a/modules/tappxBidAdapter.js +++ b/modules/tappxBidAdapter.js @@ -369,7 +369,7 @@ function buildOneRequest(validBidRequests, bidderRequest) { imp.id = validBidRequests.bidId; imp.tagid = tagid; - imp.secure = 1; + imp.secure = validBidRequests.ortb2Imp?.secure || 1; imp.bidfloor = deepAccess(validBidRequests, 'params.bidfloor'); if (isFn(validBidRequests.getFloor)) { diff --git a/modules/yahooAdsBidAdapter.js b/modules/yahooAdsBidAdapter.js index eaffa1f6fae..9bfbc4d88af 100644 --- a/modules/yahooAdsBidAdapter.js +++ b/modules/yahooAdsBidAdapter.js @@ -150,7 +150,7 @@ function getSupportedEids(bid) { } function isSecure(bid) { - return deepAccess(bid, 'params.bidOverride.imp.secure') || (document.location.protocol === 'https:') ? 1 : 0; + return deepAccess(bid, 'params.bidOverride.imp.secure') || bid.ortb2Imp?.secure || 1; }; function getPubIdMode(bid) { diff --git a/test/spec/modules/a1MediaBidAdapter_spec.js b/test/spec/modules/a1MediaBidAdapter_spec.js index e1db2b9ad8d..8031b584d65 100644 --- a/test/spec/modules/a1MediaBidAdapter_spec.js +++ b/test/spec/modules/a1MediaBidAdapter_spec.js @@ -75,7 +75,8 @@ const getConvertedBidReq = () => { }, bidfloor: 0, bidfloorcur: 'JPY', - id: '2e9f38ea93bb9e' + id: '2e9f38ea93bb9e', + secure: 1 } ], test: 0, diff --git a/test/spec/modules/aidemBidAdapter_spec.js b/test/spec/modules/aidemBidAdapter_spec.js index c9d29ff09dd..c07b999afe6 100644 --- a/test/spec/modules/aidemBidAdapter_spec.js +++ b/test/spec/modules/aidemBidAdapter_spec.js @@ -455,7 +455,7 @@ describe('Aidem adapter', () => { expect(data.imp).to.be.a('array').that.has.lengthOf(DEFAULT_VALID_BANNER_REQUESTS.length) expect(data.imp[0]).to.be.a('object').that.has.all.keys( - 'banner', 'id', 'tagId' + 'banner', 'id', 'tagId', 'secure' ) expect(data.imp[0].banner).to.be.a('object').that.has.all.keys( 'format', 'topframe' @@ -471,7 +471,7 @@ describe('Aidem adapter', () => { expect(data.imp).to.be.a('array').that.has.lengthOf(DEFAULT_VALID_VIDEO_REQUESTS.length) expect(data.imp[0]).to.be.a('object').that.has.all.keys( - 'video', 'id', 'tagId' + 'video', 'id', 'tagId', 'secure' ) expect(data.imp[0].video).to.be.a('object').that.has.all.keys( 'mimes', 'minduration', 'maxduration', 'protocols', 'w', 'h' diff --git a/test/spec/modules/bidmaticBidAdapter_spec.js b/test/spec/modules/bidmaticBidAdapter_spec.js index dcf35d032ea..4b213c6dcc4 100644 --- a/test/spec/modules/bidmaticBidAdapter_spec.js +++ b/test/spec/modules/bidmaticBidAdapter_spec.js @@ -3,6 +3,7 @@ import { END_POINT, spec } from 'modules/bidmaticBidAdapter.js'; import { deepClone, deepSetValue, mergeDeep } from '../../../src/utils'; const expectedImp = { + 'secure': 1, 'id': '2eb89f0f062afe', 'banner': { 'topframe': 0, diff --git a/test/spec/modules/dsp_genieeBidAdapter_spec.js b/test/spec/modules/dsp_genieeBidAdapter_spec.js index 6b2286a5fe5..576fd9e404b 100644 --- a/test/spec/modules/dsp_genieeBidAdapter_spec.js +++ b/test/spec/modules/dsp_genieeBidAdapter_spec.js @@ -38,7 +38,8 @@ describe('Geniee adapter tests', () => { ext: { test: 1 }, - id: 'bid-id' + id: 'bid-id', + secure: 1 } ], test: 1 diff --git a/test/spec/modules/improvedigitalBidAdapter_spec.js b/test/spec/modules/improvedigitalBidAdapter_spec.js index 0c0789ced48..46e07bacbe4 100644 --- a/test/spec/modules/improvedigitalBidAdapter_spec.js +++ b/test/spec/modules/improvedigitalBidAdapter_spec.js @@ -238,7 +238,7 @@ describe('Improve Digital Adapter Tests', function () { sinon.assert.match(payload.imp, [ sinon.match({ id: '33e9500b21129f', - secure: 0, + secure: 1, ext: { bidder: { placementId: 1053688, @@ -265,7 +265,7 @@ describe('Improve Digital Adapter Tests', function () { sinon.assert.match(payload.imp, [ sinon.match({ id: '33e9500b21129f', - secure: 0, + secure: 1, ext: { bidder: { placementId: 1053688, diff --git a/test/spec/modules/openxBidAdapter_spec.js b/test/spec/modules/openxBidAdapter_spec.js index faaab727b17..5dc60b25ab0 100644 --- a/test/spec/modules/openxBidAdapter_spec.js +++ b/test/spec/modules/openxBidAdapter_spec.js @@ -1489,7 +1489,8 @@ describe('OpenxRtbAdapter', function () { }, ext: { divid: 'adunit-code', - } + }, + secure: 1 } } }); diff --git a/test/spec/modules/smaatoBidAdapter_spec.js b/test/spec/modules/smaatoBidAdapter_spec.js index 302a5fa1aa6..f9d300d84e4 100644 --- a/test/spec/modules/smaatoBidAdapter_spec.js +++ b/test/spec/modules/smaatoBidAdapter_spec.js @@ -174,6 +174,7 @@ describe('smaatoBidAdapterTest', () => { id: 'bidId', banner: BANNER_OPENRTB_IMP, tagid: 'adspaceId', + secure: 1 } ]); }); diff --git a/test/spec/modules/sparteoBidAdapter_spec.js b/test/spec/modules/sparteoBidAdapter_spec.js index e0b7349cb92..536129c417c 100644 --- a/test/spec/modules/sparteoBidAdapter_spec.js +++ b/test/spec/modules/sparteoBidAdapter_spec.js @@ -59,6 +59,7 @@ const VALID_REQUEST_BANNER = { url: REQUEST_URL, data: { 'imp': [{ + 'secure': 1, 'id': '1a2b3c4d', 'banner': { 'format': [{ @@ -95,6 +96,7 @@ const VALID_REQUEST_VIDEO = { url: REQUEST_URL, data: { 'imp': [{ + 'secure': 1, 'id': '5e6f7g8h', 'video': { 'w': 640, @@ -137,6 +139,7 @@ const VALID_REQUEST = { url: REQUEST_URL, data: { 'imp': [{ + 'secure': 1, 'id': '1a2b3c4d', 'banner': { 'format': [{ @@ -155,6 +158,7 @@ const VALID_REQUEST = { } } }, { + 'secure': 1, 'id': '5e6f7g8h', 'video': { 'w': 640, diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index bcf388a67e2..9aa245285c5 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -180,6 +180,7 @@ describe('Taboola Adapter', function () { const res = spec.buildRequests([defaultBidRequest], commonBidderRequest); const expectedData = { 'imp': [{ + 'secure': 1, 'id': res.data.imp[0].id, 'banner': { format: [{ From 1ebc1d2a21f1cd828f1858e22d12bd5a2f3a3ef8 Mon Sep 17 00:00:00 2001 From: Marcin Komorski Date: Mon, 4 Nov 2024 10:41:57 +0100 Subject: [PATCH 2/4] tests --- libraries/ortbConverter/processors/default.js | 7 ++++++- modules/adkernelBidAdapter.js | 2 +- modules/adtrgtmeBidAdapter.js | 2 +- modules/adxcgBidAdapter.js | 2 +- modules/asoBidAdapter.js | 2 +- modules/equativBidAdapter.js | 2 +- modules/eskimiBidAdapter.js | 2 +- modules/improvedigitalBidAdapter.js | 2 +- modules/interactiveOffersBidAdapter.js | 2 +- .../prebidServerBidAdapter/ortbConverter.js | 2 +- modules/tappxBidAdapter.js | 2 +- modules/yahooAdsBidAdapter.js | 2 +- test/spec/modules/taboolaBidAdapter_spec.js | 2 +- test/spec/ortbConverter/common_spec.js | 19 ++++++++++++++++++- 14 files changed, 36 insertions(+), 14 deletions(-) diff --git a/libraries/ortbConverter/processors/default.js b/libraries/ortbConverter/processors/default.js index 5e0ed3a6b74..cdd86a01100 100644 --- a/libraries/ortbConverter/processors/default.js +++ b/libraries/ortbConverter/processors/default.js @@ -39,7 +39,6 @@ export const DEFAULT_PROCESSORS = { // sets initial imp to bidRequest.ortb2Imp priority: 99, fn(imp, bidRequest) { - imp.secure = imp.secure || 1; mergeDeep(imp, bidRequest.ortb2Imp); } }, @@ -62,6 +61,12 @@ export const DEFAULT_PROCESSORS = { delete imp.ext?.data?.pbadslot; } } + }, + secure: { + // should set imp.secure to 1 unless publisher has set it + fn(imp, bidRequest) { + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; + } } }, [BID_RESPONSE]: { diff --git a/modules/adkernelBidAdapter.js b/modules/adkernelBidAdapter.js index 06f9154c083..44de76a68b1 100644 --- a/modules/adkernelBidAdapter.js +++ b/modules/adkernelBidAdapter.js @@ -263,7 +263,7 @@ function buildImps(bidRequest, secure) { 'tagid': bidRequest.adUnitCode }; if (secure) { - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; } var sizes = []; let mediaTypes = bidRequest.mediaTypes; diff --git a/modules/adtrgtmeBidAdapter.js b/modules/adtrgtmeBidAdapter.js index 080a33547e9..c342c2625be 100644 --- a/modules/adtrgtmeBidAdapter.js +++ b/modules/adtrgtmeBidAdapter.js @@ -55,7 +55,7 @@ function extractUserSyncUrls(syncOptions, pixels) { } function isSecure(bid) { - return deepAccess(bid, 'params.bidOverride.imp.secure') || deepAccess(bid, 'ortb2Imp.secure') || 1; + return deepAccess(bid, 'params.bidOverride.imp.secure') ?? deepAccess(bid, 'ortb2Imp.secure') ?? 1; }; function getMediaType(bid) { diff --git a/modules/adxcgBidAdapter.js b/modules/adxcgBidAdapter.js index 6a69953af9b..a0e99572809 100644 --- a/modules/adxcgBidAdapter.js +++ b/modules/adxcgBidAdapter.js @@ -122,7 +122,7 @@ const converter = ortbConverter({ }; } - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; diff --git a/modules/asoBidAdapter.js b/modules/asoBidAdapter.js index e2bc292e958..43215c05d5b 100644 --- a/modules/asoBidAdapter.js +++ b/modules/asoBidAdapter.js @@ -106,7 +106,7 @@ const converter = ortbConverter({ const imp = buildImp(bidRequest, context); imp.tagid = bidRequest.adUnitCode; - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; return imp; }, diff --git a/modules/equativBidAdapter.js b/modules/equativBidAdapter.js index 1984f56c38b..7f59e46920e 100644 --- a/modules/equativBidAdapter.js +++ b/modules/equativBidAdapter.js @@ -94,7 +94,7 @@ export const converter = ortbConverter({ delete imp.dt; imp.bidfloor = imp.bidfloor || getBidFloor(bidRequest); - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; imp.tagid = bidRequest.adUnitCode; if (siteId || pageId || formatId) { diff --git a/modules/eskimiBidAdapter.js b/modules/eskimiBidAdapter.js index aa554725fe3..8b1beba09c3 100644 --- a/modules/eskimiBidAdapter.js +++ b/modules/eskimiBidAdapter.js @@ -80,7 +80,7 @@ const CONVERTER = ortbConverter({ }, imp(buildImp, bidRequest, context) { let imp = buildImp(bidRequest, context); - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; imp.bidfloorcur = getBidIdParameter('bidFloorCur', bidRequest.params).toUpperCase() || 'USD' diff --git a/modules/improvedigitalBidAdapter.js b/modules/improvedigitalBidAdapter.js index d8a47612aed..33ba08e8fd2 100644 --- a/modules/improvedigitalBidAdapter.js +++ b/modules/improvedigitalBidAdapter.js @@ -153,7 +153,7 @@ export const CONVERTER = ortbConverter({ }, imp(buildImp, bidRequest, context) { const imp = buildImp(bidRequest, context); - imp.secure = bidRequest.ortb2Imp?.secure || 1; + imp.secure = bidRequest.ortb2Imp?.secure ?? 1; if (!imp.bidfloor && bidRequest.params.bidFloor) { imp.bidfloor = bidRequest.params.bidFloor; imp.bidfloorcur = getBidIdParameter('bidFloorCur', bidRequest.params).toUpperCase() || DEFAULT_CURRENCY; diff --git a/modules/interactiveOffersBidAdapter.js b/modules/interactiveOffersBidAdapter.js index 962c266af2b..bb27239fef4 100644 --- a/modules/interactiveOffersBidAdapter.js +++ b/modules/interactiveOffersBidAdapter.js @@ -119,7 +119,7 @@ function parseRequestPrebidjsToOpenRTB(prebidRequest, bidderRequest) { } let imp = deepClone(DEFAULT['OpenRTBBidRequestImp']); imp.id = bid.bidId; - imp.secure = bid.ortb2Imp?.secure || 1; + imp.secure = bid.ortb2Imp?.secure ?? 1; imp.tagid = bid.adUnitCode; imp.ext = { rawdata: bid diff --git a/modules/prebidServerBidAdapter/ortbConverter.js b/modules/prebidServerBidAdapter/ortbConverter.js index 5f5f85edfa2..67cc5a372cf 100644 --- a/modules/prebidServerBidAdapter/ortbConverter.js +++ b/modules/prebidServerBidAdapter/ortbConverter.js @@ -37,7 +37,7 @@ const PBS_CONVERTER = ortbConverter({ } }); if (Object.values(SUPPORTED_MEDIA_TYPES).some(mtype => imp[mtype])) { - imp.secure = proxyBidRequest.ortb2Imp?.secure || 1; + imp.secure = proxyBidRequest.ortb2Imp?.secure ?? 1; return imp; } }, diff --git a/modules/tappxBidAdapter.js b/modules/tappxBidAdapter.js index 02b28a74f29..cab3d4f35c2 100644 --- a/modules/tappxBidAdapter.js +++ b/modules/tappxBidAdapter.js @@ -369,7 +369,7 @@ function buildOneRequest(validBidRequests, bidderRequest) { imp.id = validBidRequests.bidId; imp.tagid = tagid; - imp.secure = validBidRequests.ortb2Imp?.secure || 1; + imp.secure = validBidRequests.ortb2Imp?.secure ?? 1; imp.bidfloor = deepAccess(validBidRequests, 'params.bidfloor'); if (isFn(validBidRequests.getFloor)) { diff --git a/modules/yahooAdsBidAdapter.js b/modules/yahooAdsBidAdapter.js index 9bfbc4d88af..eec5420ec6c 100644 --- a/modules/yahooAdsBidAdapter.js +++ b/modules/yahooAdsBidAdapter.js @@ -150,7 +150,7 @@ function getSupportedEids(bid) { } function isSecure(bid) { - return deepAccess(bid, 'params.bidOverride.imp.secure') || bid.ortb2Imp?.secure || 1; + return deepAccess(bid, 'params.bidOverride.imp.secure') ?? bid.ortb2Imp?.secure ?? 1; }; function getPubIdMode(bid) { diff --git a/test/spec/modules/taboolaBidAdapter_spec.js b/test/spec/modules/taboolaBidAdapter_spec.js index 9aa245285c5..5db0c8cf306 100644 --- a/test/spec/modules/taboolaBidAdapter_spec.js +++ b/test/spec/modules/taboolaBidAdapter_spec.js @@ -180,8 +180,8 @@ describe('Taboola Adapter', function () { const res = spec.buildRequests([defaultBidRequest], commonBidderRequest); const expectedData = { 'imp': [{ - 'secure': 1, 'id': res.data.imp[0].id, + 'secure': 1, 'banner': { format: [{ w: displayBidRequestParams.sizes[0][0], diff --git a/test/spec/ortbConverter/common_spec.js b/test/spec/ortbConverter/common_spec.js index d2d61e6778c..ae861e15fdc 100644 --- a/test/spec/ortbConverter/common_spec.js +++ b/test/spec/ortbConverter/common_spec.js @@ -1,5 +1,5 @@ import {DEFAULT_PROCESSORS} from '../../../libraries/ortbConverter/processors/default.js'; -import {BID_RESPONSE} from '../../../src/pbjsORTB.js'; +import {BID_RESPONSE, IMP} from '../../../src/pbjsORTB.js'; describe('common processors', () => { describe('bid response properties', () => { @@ -26,4 +26,21 @@ describe('common processors', () => { }) }) }) + describe('bid imp fpd', () => { + const impFpd = DEFAULT_PROCESSORS[IMP].secure.fn; + + it('should set secure as 1 if publisher did not set it', () => { + const imp = {secure: 1}; + const bidRequest = {adUnitCode: 'ad-code-1', ortb2Imp: {}}; + impFpd(imp, bidRequest); + expect(imp.secure).to.eql(1); + }); + + it('should not overwrite secure if set by publisher', () => { + const imp = {secure: 1}; + const bidRequest = {adUnitCode: 'ad-code-1', ortb2Imp: {secure: 0}}; + impFpd(imp, bidRequest); + expect(imp.secure).to.eql(0); + }); + }) }) From 3a5587b68d3f8ad00156478ee4ed59448456bf6d Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Mon, 18 Nov 2024 10:54:34 -0800 Subject: [PATCH 3/4] Default imp.secure to pub-provided imp.secure --- libraries/ortbConverter/processors/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ortbConverter/processors/default.js b/libraries/ortbConverter/processors/default.js index cdd86a01100..f9c7e3baefc 100644 --- a/libraries/ortbConverter/processors/default.js +++ b/libraries/ortbConverter/processors/default.js @@ -65,7 +65,7 @@ export const DEFAULT_PROCESSORS = { secure: { // should set imp.secure to 1 unless publisher has set it fn(imp, bidRequest) { - imp.secure = bidRequest.ortb2Imp?.secure ?? 1; + imp.secure = imp.secure ?? 1; } } }, From 93094f43b511c8788a3d7e1df60244972e305551 Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Mon, 18 Nov 2024 11:31:06 -0800 Subject: [PATCH 4/4] Update common_spec.js --- test/spec/ortbConverter/common_spec.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/spec/ortbConverter/common_spec.js b/test/spec/ortbConverter/common_spec.js index ae861e15fdc..4c2f41749a4 100644 --- a/test/spec/ortbConverter/common_spec.js +++ b/test/spec/ortbConverter/common_spec.js @@ -30,16 +30,14 @@ describe('common processors', () => { const impFpd = DEFAULT_PROCESSORS[IMP].secure.fn; it('should set secure as 1 if publisher did not set it', () => { - const imp = {secure: 1}; - const bidRequest = {adUnitCode: 'ad-code-1', ortb2Imp: {}}; - impFpd(imp, bidRequest); + const imp = {}; + impFpd(imp); expect(imp.secure).to.eql(1); }); it('should not overwrite secure if set by publisher', () => { - const imp = {secure: 1}; - const bidRequest = {adUnitCode: 'ad-code-1', ortb2Imp: {secure: 0}}; - impFpd(imp, bidRequest); + const imp = {secure: 0}; + impFpd(imp); expect(imp.secure).to.eql(0); }); })