From 6b8108fab47a2a0974a418f94c826e918c414644 Mon Sep 17 00:00:00 2001 From: Lisa Benmore Date: Wed, 15 Sep 2021 12:31:12 -0700 Subject: [PATCH] Gumgum Bid Adapter: remove slotid type checking (#7420) * Gumgum: ADTS-149 Prevent slot ID type coercion before sending request * confirmed with ad server BE that native params should also not be forced integers --- modules/gumgumBidAdapter.js | 8 ++++---- test/spec/modules/gumgumBidAdapter_spec.js | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/modules/gumgumBidAdapter.js b/modules/gumgumBidAdapter.js index 3a0862b9aec..7ac43d32d56 100644 --- a/modules/gumgumBidAdapter.js +++ b/modules/gumgumBidAdapter.js @@ -336,11 +336,11 @@ function buildRequests(validBidRequests, bidderRequest) { const [maxw, maxh] = getGreatestDimensions(sizes); data.maxw = maxw; data.maxh = maxh; - data.si = parseInt(params.slot, 10); + data.si = params.slot; data.pi = 3; data.bf = sizes.reduce((acc, curSlotDim) => `${acc}${acc && ','}${curSlotDim[0]}x${curSlotDim[1]}`, ''); } else if (params.native) { - data.ni = parseInt(params.native, 10); + data.ni = params.native; data.pi = 5; } else if (mediaTypes.video) { data.pi = mediaTypes.video.linearity === 2 ? 6 : 7; // invideo : video @@ -391,12 +391,12 @@ function handleLegacyParams(params, sizes) { const [maxw, maxh] = getGreatestDimensions(sizes); data.maxw = maxw; data.maxh = maxh; - data.si = parseInt(params.inSlot, 10); + data.si = params.inSlot; data.pi = 3; data.bf = sizes.reduce((acc, curSlotDim) => `${acc}${acc && ','}${curSlotDim[0]}x${curSlotDim[1]}`, ''); } if (params.ICV) { - data.ni = parseInt(params.ICV, 10); + data.ni = params.ICV; data.pi = 5; } if (params.videoPubID) { diff --git a/test/spec/modules/gumgumBidAdapter_spec.js b/test/spec/modules/gumgumBidAdapter_spec.js index 6c3b4eb680d..e91308849ed 100644 --- a/test/spec/modules/gumgumBidAdapter_spec.js +++ b/test/spec/modules/gumgumBidAdapter_spec.js @@ -177,7 +177,27 @@ describe('gumgumAdapter', function () { expect(slotZoneBidRequest.data.maxh).to.equal(600); expect(slotPubIdBidRequest.data.maxw).to.equal(300); expect(slotPubIdBidRequest.data.maxh).to.equal(600); - }) + }); + + // if slot ID is set up incorrectly by a pub, we should send the invalid ID to be + // invalidated by ad server instead of trying to force integer type. forcing + // integer type can result in incorrect slot IDs that correlate to the incorrect pub ID + it('should send params.slot or params.inSlot as string when configured incorrectly', function () { + const invalidSlotId = '9gkal1cn'; + const slotRequest = { ...bidRequests[0] }; + const legacySlotRequest = { ...bidRequests[0] }; + let req; + let legReq; + + slotRequest.params.slot = invalidSlotId; + legacySlotRequest.params.inSlot = invalidSlotId; + + req = spec.buildRequests([ slotRequest ])[0]; + legReq = spec.buildRequests([ legacySlotRequest ])[0]; + + expect(req.data.si).to.equal(invalidSlotId); + expect(legReq.data.si).to.equal(invalidSlotId); + }); it('should set the iriscat param when found', function () { const request = { ...bidRequests[0], params: { iriscat: 'abc123' } }