Skip to content

Commit

Permalink
Cadent Aperture MX Bid Adapter: address auctionId/transactionId leak
Browse files Browse the repository at this point in the history
  • Loading branch information
EMXDigital authored Sep 13, 2023
1 parent d4203d2 commit 0f46551
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/cadentApertureMXBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const spec = {
let isVideo = !!bid.mediaTypes.video;
let data = {
id: bid.bidId,
tid: bid.transactionId,
tid: bid.ortb2Imp?.ext?.tid,
tagid,
secure
};
Expand All @@ -297,7 +297,7 @@ export const spec = {
});

let cadentData = {
id: bidderRequest.auctionId,
id: bidderRequest.auctionId ?? bidderRequest.bidderRequestId,
imp: cadentImps,
device,
site,
Expand Down
17 changes: 16 additions & 1 deletion test/spec/modules/cadentApertureMXBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ describe('cadent_aperture_mx Adapter', function () {
'bidId': '30b31c2501de1e',
'auctionId': 'e19f1eff-8b27-42a6-888d-9674e5a6130c',
'transactionId': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec',
'ortb2Imp': {
'ext': {
'tid': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ed',
},
},
}]
};
let request = spec.buildRequests(bidderRequest.bids, bidderRequest);
Expand Down Expand Up @@ -297,12 +302,22 @@ describe('cadent_aperture_mx Adapter', function () {
expect(data.id).to.equal(bidderRequest.auctionId);
expect(data.imp.length).to.equal(1);
expect(data.imp[0].id).to.equal('30b31c2501de1e');
expect(data.imp[0].tid).to.equal('d7b773de-ceaa-484d-89ca-d9f51b8d61ec');
expect(data.imp[0].tid).to.equal('d7b773de-ceaa-484d-89ca-d9f51b8d61ed');
expect(data.imp[0].tagid).to.equal('25251');
expect(data.imp[0].secure).to.equal(0);
expect(data.imp[0].vastXml).to.equal(undefined);
});

it('populates id even when auctionId is not available', function () {
// addressing https://github.com/prebid/Prebid.js/issues/9781
bidderRequest.auctionId = null;
request = spec.buildRequests(bidderRequest.bids, bidderRequest);

const data = JSON.parse(request.data);
expect(data.id).not.to.be.null;
expect(data.id).not.to.equal(bidderRequest.auctionId);
});

it('properly sends site information and protocol', function () {
request = spec.buildRequests(bidderRequest.bids, bidderRequest);
request = JSON.parse(request.data);
Expand Down

0 comments on commit 0f46551

Please sign in to comment.