Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various adapters: setting imp secure #12385

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libraries/ortbConverter/processors/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const DEFAULT_PROCESSORS = {
// sets initial imp to bidRequest.ortb2Imp
priority: 99,
fn(imp, bidRequest) {
imp.secure = imp.secure || 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imp.secure ?? 1 (here and elsewhere)

The problem with this (and also a good test case) is that if as the pub I set secure: 0, this would still override it to 1.

mergeDeep(imp, bidRequest.ortb2Imp);
}
},
Expand Down
2 changes: 1 addition & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/adtrgtmeBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion modules/adxcgBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/asoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},

Expand Down
2 changes: 1 addition & 1 deletion modules/equativBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion modules/eskimiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion modules/improvedigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions modules/interactiveOffersBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/prebidServerBidAdapter/ortbConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},
Expand Down
2 changes: 1 addition & 1 deletion modules/tappxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion modules/yahooAdsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/a1MediaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const getConvertedBidReq = () => {
},
bidfloor: 0,
bidfloorcur: 'JPY',
id: '2e9f38ea93bb9e'
id: '2e9f38ea93bb9e',
secure: 1
}
],
test: 0,
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/aidemBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
1 change: 1 addition & 0 deletions test/spec/modules/bidmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/dsp_genieeBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ describe('Geniee adapter tests', () => {
ext: {
test: 1
},
id: 'bid-id'
id: 'bid-id',
secure: 1
}
],
test: 1
Expand Down
4 changes: 2 additions & 2 deletions test/spec/modules/improvedigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,8 @@ describe('OpenxRtbAdapter', function () {
},
ext: {
divid: 'adunit-code',
}
},
secure: 1
}
}
});
Expand Down
1 change: 1 addition & 0 deletions test/spec/modules/smaatoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ describe('smaatoBidAdapterTest', () => {
id: 'bidId',
banner: BANNER_OPENRTB_IMP,
tagid: 'adspaceId',
secure: 1
}
]);
});
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/sparteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const VALID_REQUEST_BANNER = {
url: REQUEST_URL,
data: {
'imp': [{
'secure': 1,
'id': '1a2b3c4d',
'banner': {
'format': [{
Expand Down Expand Up @@ -95,6 +96,7 @@ const VALID_REQUEST_VIDEO = {
url: REQUEST_URL,
data: {
'imp': [{
'secure': 1,
'id': '5e6f7g8h',
'video': {
'w': 640,
Expand Down Expand Up @@ -137,6 +139,7 @@ const VALID_REQUEST = {
url: REQUEST_URL,
data: {
'imp': [{
'secure': 1,
'id': '1a2b3c4d',
'banner': {
'format': [{
Expand All @@ -155,6 +158,7 @@ const VALID_REQUEST = {
}
}
}, {
'secure': 1,
'id': '5e6f7g8h',
'video': {
'w': 640,
Expand Down
1 change: 1 addition & 0 deletions test/spec/modules/taboolaBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand Down
Loading