Skip to content

Commit

Permalink
Gumgum Bid Adapter: remove slotid type checking (#7420)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lbenmore authored Sep 15, 2021
1 parent 274b101 commit 6b8108f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
8 changes: 4 additions & 4 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
22 changes: 21 additions & 1 deletion test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' } }
Expand Down

0 comments on commit 6b8108f

Please sign in to comment.