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

make case insensitive comparison in auction request #3113

Merged
merged 4 commits into from
Sep 25, 2023
Merged
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
15 changes: 9 additions & 6 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
@@ -1575,18 +1575,21 @@ func (deps *endpointDeps) parseBidExt(req *openrtb_ext.RequestWrapper) error {
}

func (deps *endpointDeps) validateAliases(aliases map[string]string) error {
for alias, coreBidder := range aliases {
if _, isCoreBidderDisabled := deps.disabledBidders[coreBidder]; isCoreBidderDisabled {
return fmt.Errorf("request.ext.prebid.aliases.%s refers to disabled bidder: %s", alias, coreBidder)
for alias, bidderName := range aliases {
normalisedBidderName, _ := openrtb_ext.NormalizeBidderName(bidderName)
gargcreation1992 marked this conversation as resolved.
Show resolved Hide resolved
coreBidderName := normalisedBidderName.String()
if _, isCoreBidderDisabled := deps.disabledBidders[coreBidderName]; isCoreBidderDisabled {
return fmt.Errorf("request.ext.prebid.aliases.%s refers to disabled bidder: %s", alias, bidderName)
}

if _, isCoreBidder := deps.bidderMap[coreBidder]; !isCoreBidder {
return fmt.Errorf("request.ext.prebid.aliases.%s refers to unknown bidder: %s", alias, coreBidder)
if _, isCoreBidder := deps.bidderMap[coreBidderName]; !isCoreBidder {
return fmt.Errorf("request.ext.prebid.aliases.%s refers to unknown bidder: %s", alias, bidderName)
}

if alias == coreBidder {
if alias == coreBidderName {
return fmt.Errorf("request.ext.prebid.aliases.%s defines a no-op alias. Choose a different alias, or remove this entry.", alias)
}
aliases[alias] = coreBidderName
}
return nil
}
Original file line number Diff line number Diff line change
@@ -2,8 +2,16 @@
"description": "This demonstrates all of the OpenRTB extensions supported by Prebid Server. Very few requests will need all of these at once.",
"config": {
"mockBidders": [
{"bidderName": "appnexus", "currency": "USD", "price": 1.00},
{"bidderName": "rubicon", "currency": "USD", "price": 1.00}
{
"bidderName": "appnexus",
"currency": "USD",
"price": 1.00
},
{
"bidderName": "rubicon",
"currency": "USD",
"price": 1.00
}
]
},
"mockBidRequest": {
@@ -61,7 +69,7 @@
"ext": {
"prebid": {
"aliases": {
"districtm": "appnexus"
"districtm": "Appnexus"
},
"bidadjustmentfactors": {
"appnexus": 1.01,
gargcreation1992 marked this conversation as resolved.
Show resolved Hide resolved
@@ -91,42 +99,42 @@
}
},
"expectedBidResponse": {
"id":"some-request-id",
"seatbid": [
{
"bid": [
{
"id": "appnexus-bid",
"impid": "some-impression-id",
"price": 1.01
}
],
"seat": "appnexus"
},
{
"bid": [
{
"id": "appnexus-bid",
"impid": "some-impression-id",
"price": 0.98
}
],
"seat": "districtm"
},
{
"bid": [
{
"id": "rubicon-bid",
"impid": "some-impression-id",
"price": 0.99
}
],
"seat": "rubicon"
}
],
"bidid":"test bid id",
"cur":"USD",
"nbr":0
"id": "some-request-id",
"seatbid": [
{
"bid": [
{
"id": "appnexus-bid",
"impid": "some-impression-id",
"price": 1.01
}
],
"seat": "appnexus"
},
{
"bid": [
{
"id": "appnexus-bid",
"impid": "some-impression-id",
"price": 0.98
}
],
"seat": "districtm"
},
{
"bid": [
{
"id": "rubicon-bid",
"impid": "some-impression-id",
"price": 0.99
}
],
"seat": "rubicon"
}
],
"bidid": "test bid id",
"cur": "USD",
"nbr": 0
},
"expectedReturnCode": 200
}
}