From 32c62e17bc473024dccd031b35019b1204beec71 Mon Sep 17 00:00:00 2001 From: pm-avinash-kapre <112699665+AvinashKapre@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:44:20 +0530 Subject: [PATCH] UOE-9681,UOE-9670: Add OWS hosted PBS vanilla endpoint, for prebid.js DIY client (#583) --- .../pubmatic/openwrap/auctionresponsehook.go | 9 + .../pubmatic/openwrap/beforevalidationhook.go | 53 ++- .../openwrap/beforevalidationhook_test.go | 220 ++++++++++++- modules/pubmatic/openwrap/entrypointhook.go | 57 ++-- .../pubmatic/openwrap/entrypointhook_test.go | 302 +++++++++++++++++- modules/pubmatic/openwrap/models/constants.go | 2 + modules/pubmatic/openwrap/models/openwrap.go | 3 +- modules/pubmatic/openwrap/models/request.go | 3 +- 8 files changed, 598 insertions(+), 51 deletions(-) diff --git a/modules/pubmatic/openwrap/auctionresponsehook.go b/modules/pubmatic/openwrap/auctionresponsehook.go index 0d4b2d72d16..b678413ad9f 100644 --- a/modules/pubmatic/openwrap/auctionresponsehook.go +++ b/modules/pubmatic/openwrap/auctionresponsehook.go @@ -34,6 +34,15 @@ func (m OpenWrap) handleAuctionResponseHook( result.DebugMessages = append(result.DebugMessages, "error: request-ctx not found in handleBeforeValidationHook()") return result, nil } + + //SSHB request should not execute module + if rctx.Sshb == "1" || rctx.Endpoint == models.EndpointHybrid { + return result, nil + } + if rctx.Endpoint == models.EndpointOWS2S { + return result, nil + } + defer func() { moduleCtx.ModuleContext["rctx"] = rctx m.metricEngine.RecordPublisherResponseTimeStats(rctx.PubIDStr, int(time.Since(time.Unix(rctx.StartTime, 0)).Milliseconds())) diff --git a/modules/pubmatic/openwrap/beforevalidationhook.go b/modules/pubmatic/openwrap/beforevalidationhook.go index 4776c372bea..3256cda3a29 100644 --- a/modules/pubmatic/openwrap/beforevalidationhook.go +++ b/modules/pubmatic/openwrap/beforevalidationhook.go @@ -7,6 +7,7 @@ import ( "fmt" "net/url" "strconv" + "strings" "github.com/buger/jsonparser" "github.com/prebid/openrtb/v19/openrtb2" @@ -46,6 +47,18 @@ func (m OpenWrap) handleBeforeValidationHook( } }() + //Do not execute the module for requests processed in SSHB(8001) + if rCtx.Sshb == "1" { + result.Reject = false + return result, nil + } + + if rCtx.Endpoint == models.EndpointHybrid { + //TODO: Add bidder params fix + result.Reject = false + return result, nil + } + pubID, err := getPubID(*payload.BidRequest) if err != nil { result.NbrCode = nbr.InvalidPublisherID @@ -154,6 +167,19 @@ func (m OpenWrap) handleBeforeValidationHook( var isAdPodImpression bool imp := payload.BidRequest.Imp[i] + impExt := &models.ImpExtension{} + if len(imp.Ext) != 0 { + err := json.Unmarshal(imp.Ext, impExt) + if err != nil { + result.NbrCode = nbr.InternalError + err = errors.New("failed to parse imp.ext: " + imp.ID) + result.Errors = append(result.Errors, err.Error()) + return result, err + } + } + if rCtx.Endpoint == models.EndpointOWS2S { + imp.TagID = getTagID(imp, impExt) + } if imp.TagID == "" { result.NbrCode = nbr.InvalidImpressionTagID err = errors.New("tagid missing for imp: " + imp.ID) @@ -184,17 +210,6 @@ func (m OpenWrap) handleBeforeValidationHook( } } - impExt := &models.ImpExtension{} - if len(imp.Ext) != 0 { - err := json.Unmarshal(imp.Ext, impExt) - if err != nil { - result.NbrCode = nbr.InternalError - err = errors.New("failed to parse imp.ext: " + imp.ID) - result.Errors = append(result.Errors, err.Error()) - return result, err - } - } - div := "" if impExt.Wrapper != nil { div = impExt.Wrapper.Div @@ -439,7 +454,7 @@ func (m *OpenWrap) applyProfileChanges(rctx models.RequestCtx, bidRequest *openr } if cur, ok := rctx.PartnerConfigMap[models.VersionLevelConfigID][models.AdServerCurrency]; ok { - bidRequest.Cur = []string{cur} + bidRequest.Cur = append(bidRequest.Cur, cur) } if bidRequest.TMax == 0 { bidRequest.TMax = rctx.TMax @@ -797,7 +812,6 @@ func (m OpenWrap) setTimeout(rCtx models.RequestCtx) int64 { // if ssauction flag is not set and platform is dislay, then by default send all bids // if ssauction flag is not set and platform is in-app, then check if profile setting sendAllBids is set to 1 func isSendAllBids(rctx models.RequestCtx) bool { - //if ssauction is set to 0 in the request if rctx.SSAuction == 0 { return true @@ -844,3 +858,16 @@ func getPubID(bidRequest openrtb2.BidRequest) (pubID int, err error) { } return pubID, err } + +func getTagID(imp openrtb2.Imp, impExt *models.ImpExtension) string { + //priority for tagId is imp.ext.gpid > imp.TagID > imp.ext.data.pbadslot + if impExt.Gpid != "" { + if idx := strings.Index(impExt.Gpid, "#"); idx != -1 { + return impExt.Gpid[:idx] + } + return impExt.Gpid + } else if imp.TagID != "" { + return imp.TagID + } + return impExt.Data.PbAdslot +} diff --git a/modules/pubmatic/openwrap/beforevalidationhook_test.go b/modules/pubmatic/openwrap/beforevalidationhook_test.go index 62c056b8746..e6922046ce0 100644 --- a/modules/pubmatic/openwrap/beforevalidationhook_test.go +++ b/modules/pubmatic/openwrap/beforevalidationhook_test.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "errors" - "fmt" "net/http" "testing" @@ -95,7 +94,7 @@ func getTestBidRequest(isSite bool) *openrtb2.BidRequest { }, } } - testReq.Cur = []string{} + testReq.Cur = []string{"EUR"} testReq.WLang = []string{"english", "hindi"} testReq.Device = &openrtb2.Device{ DeviceType: 1, @@ -830,7 +829,7 @@ func TestOpenWrap_applyProfileChanges(t *testing.T) { want: &openrtb2.BidRequest{ ID: "testID", Test: 1, - Cur: []string{"USD"}, + Cur: []string{"EUR", "USD"}, TMax: 500, Source: &openrtb2.Source{ TID: "testID", @@ -893,7 +892,7 @@ func TestOpenWrap_applyProfileChanges(t *testing.T) { want: &openrtb2.BidRequest{ ID: "testID", Test: 1, - Cur: []string{"USD"}, + Cur: []string{"EUR", "USD"}, TMax: 500, Source: &openrtb2.Source{ TID: "testID", @@ -1589,6 +1588,22 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { isRequestNotRejected bool wantErr bool }{ + { + name: "request_with_sshb=1", + args: args{ + ctx: context.Background(), + moduleCtx: hookstage.ModuleInvocationContext{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + Sshb: "1", + }, + }, + }, + }, + want: hookstage.HookResult[hookstage.BeforeValidationRequestPayload]{ + Reject: false, + }, + }, { name: "empty_module_context", args: args{ @@ -1625,6 +1640,23 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { }, wantErr: false, }, + { + name: "hybrid_request_module_should_not_reject_request_and_return_without_executing_module", + args: args{ + ctx: context.Background(), + moduleCtx: hookstage.ModuleInvocationContext{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + Endpoint: models.EndpointHybrid, + }, + }, + }, + }, + want: hookstage.HookResult[hookstage.BeforeValidationRequestPayload]{ + Reject: false, + }, + wantErr: false, + }, { name: "Invalid_PubID_in_request", args: args{ @@ -1841,7 +1873,7 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { wantErr: false, }, { - name: "TagID_not_prsent_in_imp", + name: "TagID_not_present_in_imp", args: args{ ctx: context.Background(), moduleCtx: hookstage.ModuleInvocationContext{ @@ -1884,6 +1916,54 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { }, wantErr: true, }, + { + name: "TagID_not_present_in_imp_and_not_found_for_client_request", + args: args{ + ctx: context.Background(), + moduleCtx: hookstage.ModuleInvocationContext{ + ModuleContext: hookstage.ModuleContext{ + "rctx": func() models.RequestCtx { + testRctx := rctx + testRctx.Endpoint = models.EndpointOWS2S + return testRctx + }(), + }, + }, + bidrequest: json.RawMessage(`{"id":"123-456-789","imp":[{"id":"123","banner":{"format":[{"w":728,"h":90},{"w":300,"h":250}],"w":700,"h":900},"video":{"mimes":["video/mp4","video/mpeg"],"w":640,"h":480},"ext":{"wrapper":{"div":"div"},"bidder":{"pubmatic":{"keywords":[{"key":"pmzoneid","value":["val1","val2"]}]}},"prebid":{}}}],"site":{"domain":"test.com","page":"www.test.com","publisher":{"id":"5890"}},"device":{"ua":"Mozilla/5.0(X11;Linuxx86_64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/52.0.2743.82Safari/537.36","ip":"123.145.167.10"},"user":{"id":"119208432","buyeruid":"1rwe432","yob":1980,"gender":"F","geo":{"country":"US","region":"CA","metro":"90001","city":"Alamo"}},"wseat":["Wseat_0","Wseat_1"],"bseat":["Bseat_0","Bseat_1"],"cur":["cur_0","cur_1"],"wlang":["Wlang_0","Wlang_1"],"bcat":["bcat_0","bcat_1"],"badv":["badv_0","badv_1"],"bapp":["bapp_0","bapp_1"],"source":{"ext":{"omidpn":"MyIntegrationPartner","omidpv":"7.1"}},"ext":{"prebid":{},"wrapper":{"test":123,"profileid":123,"versionid":1,"wiid":"test_display_wiid"}}}`), + }, + fields: fields{ + cache: mockCache, + metricEngine: mockEngine, + }, + setup: func() { + mockCache.EXPECT().GetPartnerConfigMap(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(map[int]map[string]string{ + 2: { + models.PARTNER_ID: "2", + models.PREBID_PARTNER_NAME: "appnexus", + models.BidderCode: "appnexus", + models.SERVER_SIDE_FLAG: "1", + models.KEY_GEN_PATTERN: "_AU_@_W_x_H_", + models.TIMEOUT: "200", + }, + -1: { + models.DisplayVersionID: "1", + models.PLATFORM_KEY: models.PLATFORM_APP, + }, + }, nil) + mockCache.EXPECT().GetAdunitConfigFromCache(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&adunitconfig.AdUnitConfig{}) + //prometheus metrics + mockEngine.EXPECT().RecordPublisherProfileRequests("5890", "1234") + mockEngine.EXPECT().RecordBadRequests(models.EndpointOWS2S, getPubmaticErrorCode(nbr.InvalidImpressionTagID)) + mockEngine.EXPECT().RecordNobidErrPrebidServerRequests("5890", nbr.InvalidImpressionTagID) + mockEngine.EXPECT().RecordPublisherRequests(models.EndpointOWS2S, "5890", rctx.Platform) + }, + want: hookstage.HookResult[hookstage.BeforeValidationRequestPayload]{ + Reject: true, + NbrCode: nbr.InvalidImpressionTagID, + Errors: []string{"tagid missing for imp: 123"}, + }, + wantErr: true, + }, { name: "invalid_impExt", args: args{ @@ -2198,7 +2278,6 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { assert.NotEmpty(t, tt.want.DebugMessages) return } - fmt.Println(got.DebugMessages) if (err != nil) != tt.wantErr { assert.Equal(t, tt.wantErr, err != nil) return @@ -2207,3 +2286,132 @@ func TestOpenWrap_handleBeforeValidationHook(t *testing.T) { }) } } + +func TestGetTagID(t *testing.T) { + type args struct { + imp openrtb2.Imp + impExt *models.ImpExtension + } + tests := []struct { + name string + args args + want string + }{ + { + name: "tagId_not_found", + args: args{ + imp: openrtb2.Imp{}, + impExt: &models.ImpExtension{}, + }, + want: "", + }, + { + name: "tagId_present_in_gpid", + args: args{ + imp: openrtb2.Imp{}, + impExt: &models.ImpExtension{ + Gpid: "/7578294/adunit1", + }, + }, + want: "/7578294/adunit1", + }, + { + name: "tagId_set_by_publisher_on_page", + args: args{ + imp: openrtb2.Imp{ + TagID: "/7578294/adunit1", + }, + impExt: &models.ImpExtension{}, + }, + want: "/7578294/adunit1", + }, + { + name: "tagId_present_in_pbadslot", + args: args{ + imp: openrtb2.Imp{}, + impExt: &models.ImpExtension{ + Data: openrtb_ext.ExtImpData{ + PbAdslot: "/7578294/adunit1", + }, + }, + }, + want: "/7578294/adunit1", + }, + { + name: "tagId_present_in_pbadslot_and_gpid", + args: args{ + imp: openrtb2.Imp{}, + impExt: &models.ImpExtension{ + Gpid: "/7578294/adunit123", + Data: openrtb_ext.ExtImpData{ + PbAdslot: "/7578294/adunit", + }, + }, + }, + want: "/7578294/adunit123", + }, + { + name: "tagId_present_in_imp.TagId_and_gpid", + args: args{ + imp: openrtb2.Imp{ + TagID: "/7578294/adunit", + }, + impExt: &models.ImpExtension{ + Gpid: "/7578294/adunit123", + }, + }, + want: "/7578294/adunit123", + }, + { + name: "tagId_present_in_imp.TagId_and_pbadslot", + args: args{ + imp: openrtb2.Imp{ + TagID: "/7578294/adunit123", + }, + impExt: &models.ImpExtension{ + Data: openrtb_ext.ExtImpData{ + PbAdslot: "/7578294/adunit", + }, + }, + }, + want: "/7578294/adunit123", + }, + { + name: "tagId_present_in_imp.TagId_and_pbadslot_and_gpid", + args: args{ + imp: openrtb2.Imp{ + TagID: "/7578294/adunit", + }, + impExt: &models.ImpExtension{ + Gpid: "/7578294/adunit123", + Data: openrtb_ext.ExtImpData{ + PbAdslot: "/7578294/adunit12345", + }, + }, + }, + want: "/7578294/adunit123", + }, + { + name: "GpId_contains_'#'", + args: args{ + imp: openrtb2.Imp{ + TagID: "/7578294/adunit", + }, + impExt: &models.ImpExtension{ + Gpid: "/43743431/DMDemo#Div1", + Data: openrtb_ext.ExtImpData{ + PbAdslot: "/7578294/adunit12345", + }, + }, + }, + want: "/43743431/DMDemo", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := getTagID(tt.args.imp, tt.args.impExt); got != tt.want { + t.Errorf("getTagID() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/modules/pubmatic/openwrap/entrypointhook.go b/modules/pubmatic/openwrap/entrypointhook.go index 87ed5813699..a4c25a460f6 100644 --- a/modules/pubmatic/openwrap/entrypointhook.go +++ b/modules/pubmatic/openwrap/entrypointhook.go @@ -5,6 +5,7 @@ import ( "strconv" "time" + "github.com/buger/jsonparser" "github.com/prebid/prebid-server/config" "github.com/prebid/prebid-server/hooks/hookexecution" "github.com/prebid/prebid-server/hooks/hookstage" @@ -30,25 +31,47 @@ func (m OpenWrap) handleEntrypointHook( _ context.Context, miCtx hookstage.ModuleInvocationContext, payload hookstage.EntrypointPayload, -) (hookstage.HookResult[hookstage.EntrypointPayload], error) { - result := hookstage.HookResult[hookstage.EntrypointPayload]{} +) (result hookstage.HookResult[hookstage.EntrypointPayload], err error) { queryParams := payload.Request.URL.Query() - if queryParams.Get("sshb") != "1" { - return result, nil - } + source := queryParams.Get("source") //source query param to identify /openrtb2/auction type - var pubid int + rCtx := models.RequestCtx{} var endpoint string - var err error + var pubid int var requestExtWrapper models.RequestExtWrapper + defer func() { + if result.Reject { + m.metricEngine.RecordBadRequests(endpoint, getPubmaticErrorCode(result.NbrCode)) + } else { + result.ModuleContext = make(hookstage.ModuleContext) + result.ModuleContext["rctx"] = rCtx + } + }() + + rCtx.Sshb = queryParams.Get("sshb") + //Do not execute the module for requests processed in SSHB(8001) + if queryParams.Get("sshb") == "1" { + return result, nil + } + switch payload.Request.URL.Path { + // Direct call to 8000 port case hookexecution.EndpointAuction: - if !models.IsHybrid(payload.Body) { // new hybrid api should not execute module + switch source { + case "pbjs": + endpoint = models.EndpointOWS2S + requestExtWrapper, err = models.GetRequestExtWrapper(payload.Body) + case "inapp": + requestExtWrapper, err = models.GetRequestExtWrapper(payload.Body, "ext", "wrapper") + endpoint = models.EndpointV25 + default: + rCtx.Endpoint = models.EndpointHybrid return result, nil } - requestExtWrapper, err = models.GetRequestExtWrapper(payload.Body) + // call to 8001 port and here via reverse proxy case OpenWrapAuction: // legacy hybrid api should not execute module - m.metricEngine.RecordPBSAuctionRequestsStats() + // m.metricEngine.RecordPBSAuctionRequestsStats() //TODO: uncomment after hybrid call through module + rCtx.Endpoint = models.EndpointHybrid return result, nil case OpenWrapV25: requestExtWrapper, err = models.GetRequestExtWrapper(payload.Body, "ext", "wrapper") @@ -72,12 +95,6 @@ func (m OpenWrap) handleEntrypointHook( // we should return from here } - defer func() { - if result.Reject { - m.metricEngine.RecordBadRequests(endpoint, getPubmaticErrorCode(result.NbrCode)) - } - }() - // init default for all modules result.Reject = true @@ -93,9 +110,10 @@ func (m OpenWrap) handleEntrypointHook( return result, err } - rCtx := models.RequestCtx{ + requestDebug, _ := jsonparser.GetBoolean(payload.Body, "ext", "prebid", "debug") + rCtx = models.RequestCtx{ StartTime: time.Now().Unix(), - Debug: queryParams.Get(models.Debug) == "1", + Debug: queryParams.Get(models.Debug) == "1" || requestDebug, UA: payload.Request.Header.Get("User-Agent"), ProfileID: requestExtWrapper.ProfileId, DisplayID: requestExtWrapper.VersionId, @@ -138,9 +156,6 @@ func (m OpenWrap) handleEntrypointHook( rCtx.PubID = pubid } - result.ModuleContext = make(hookstage.ModuleContext) - result.ModuleContext["rctx"] = rCtx - result.Reject = false return result, nil } diff --git a/modules/pubmatic/openwrap/entrypointhook_test.go b/modules/pubmatic/openwrap/entrypointhook_test.go index 2f64e6a3639..a763e1f6618 100644 --- a/modules/pubmatic/openwrap/entrypointhook_test.go +++ b/modules/pubmatic/openwrap/entrypointhook_test.go @@ -39,13 +39,13 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { wantErr error }{ { - name: "sshb absent", + name: "request with sshb=1 should not execute entrypointhook", args: args{ in0: context.Background(), miCtx: hookstage.ModuleInvocationContext{}, payload: hookstage.EntrypointPayload{ Request: func() *http.Request { - r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?debug=1", nil) + r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?sshb=1", nil) if err != nil { panic(err) } @@ -58,10 +58,16 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { }, setup: func(mme *mock_metrics.MockMetricsEngine) {}, }, - want: hookstage.HookResult[hookstage.EntrypointPayload]{}, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + Sshb: "1", + }, + }, + }, }, { - name: "valid /openrtb/2.5 request", + name: "valid /openrtb2/2.5 request(reverseProxy through SSHB(8001->8000))", fields: fields{ cfg: config.Config{ Tracker: config.Tracker{ @@ -76,7 +82,7 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { miCtx: hookstage.ModuleInvocationContext{}, payload: hookstage.EntrypointPayload{ Request: func() *http.Request { - r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?debug=1&sshb=1", nil) + r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?debug=1&sshb=2", nil) if err != nil { panic(err) } @@ -124,7 +130,7 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { wantErr: nil, }, { - name: "valid /openrtb/2.5 request with wiid set and no cookies", + name: "valid /openrtb/2.5 request with wiid set and no cookies(reverseProxy through SSHB(8001->8000)", fields: fields{ cfg: config.Config{ Tracker: config.Tracker{ @@ -139,7 +145,7 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { miCtx: hookstage.ModuleInvocationContext{}, payload: hookstage.EntrypointPayload{ Request: func() *http.Request { - r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?debug=1&sshb=1", nil) + r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?debug=1&sshb=2", nil) if err != nil { panic(err) } @@ -178,7 +184,7 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { wantErr: nil, }, { - name: "/openrtb/2.5 request without profileid", + name: "/openrtb/2.5 request without profileid(reverseProxy through SSHB(8001->8000)", fields: fields{ cfg: config.Config{}, cache: nil, @@ -188,7 +194,7 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { miCtx: hookstage.ModuleInvocationContext{}, payload: hookstage.EntrypointPayload{ Request: func() *http.Request { - r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?&sshb=1", nil) + r, err := http.NewRequest("POST", "http://localhost/openrtb/2.5?&sshb=2", nil) if err != nil { panic(err) } @@ -207,6 +213,280 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { }, wantErr: nil, }, + { + name: "Valid /openrtb2/auction?source=pbjs request(ows2s)", + fields: fields{ + cfg: config.Config{}, + cache: nil, + }, + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/openrtb2/auction?source=pbjs&debug=1", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8L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43MTk1OTQ1NjZaIn19LCJiZGF5IjoiMjAyMi0wNS0xN1QwNjo0ODozOC4wMTc5ODgyMDZaIn0=; KRTBCOOKIE_153=1923-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&19420-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&22979-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&23462-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse; KRTBCOOKIE_57=22776-41928985301451193&KRTB&23339-41928985301451193; KRTBCOOKIE_27=16735-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&16736-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"imp":[{"tagid":"/43743431/DMDemo","ext":{"prebid":{"bidder":{"pubmatic":{"publisherId":"5890"}},"adunitcode":"div-gpt-ad-1460505748561-0"}},"id":"div-gpt-ad-1460505748561-0","banner":{"topframe":1,"format":[{"w":300,"h":250}]}}],"site":{"domain":"localhost:9999","publisher":{"domain":"localhost:9999","id":"5890"},"page":"http://localhost:9999/integrationExamples/gpt/owServer_example.html"},"device":{"w":1792,"h":446,"dnt":0,"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","language":"en","sua":{"source":1,"platform":{"brand":"macOS"},"browsers":[{"brand":"Google Chrome","version":["117"]},{"brand":"Not;A=Brand","version":["8"]},{"brand":"Chromium","version":["117"]}],"mobile":0}},"ext":{"prebid":{"auctiontimestamp":1697191822565,"targeting":{"includewinners":true,"includebidderkeys":true},"bidderparams":{"pubmatic":{"publisherId":"5890","wrapper":{"profileid":43563,"versionid":1}}},"channel":{"name":"pbjs","version":"v8.7.0-pre"},"createtids":false}},"id":"5bdd7da5-1166-40fe-a9cb-3bf3c3164cd3","test":0,"tmax":3000}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) {}, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + ProfileID: 43563, + PubID: 0, + PubIDStr: "", + DisplayID: 1, + SSAuction: -1, + Debug: true, + UA: "go-test", + IP: "127.0.0.1", + IsCTVRequest: false, + UidCookie: &http.Cookie{ + Name: "uids", + Value: `eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OTo0My4zODg4Nzk5NVoifSwiYWRmIjp7InVpZCI6IjgwNDQ2MDgzMzM3Nzg4MzkwNzgiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxMS4wMzMwNTQ3MjdaIn0sImFka2VybmVsIjp7InVpZCI6IkE5MTYzNTAwNzE0OTkyOTMyOTkwIiwiZXhwaXJlcyI6IjIwMjItMDYtMjRUMDU6NTk6MDkuMzczMzg1NjYyWiJ9LCJhZGtlcm5lbEFkbiI6eyJ1aWQiOiJBOTE2MzUwMDcxNDk5MjkzMjk5MCIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjEzLjQzNDkyNTg5NloifSwiYWRtaXhlciI6eyJ1aWQiOiIzNjZhMTdiMTJmMjI0ZDMwOGYzZTNiOGRhOGMzYzhhMCIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjA5LjU5MjkxNDgwMVoifSwiYWRueHMiOnsidWlkIjoiNDE5Mjg5ODUzMDE0NTExOTMiLCJleHBpcmVzIjoiMjAyMy0wMS0xOFQwOTo1MzowOC44MjU0NDI2NzZaIn0sImFqYSI6eyJ1aWQiOiJzMnN1aWQ2RGVmMFl0bjJveGQ1a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YTg3LTJkYTQtOWNjNC05NjFmZDExM2JlY2UiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxNS43MTk1OTQ1NjZaIn19LCJiZGF5IjoiMjAyMi0wNS0xN1QwNjo0ODozOC4wMTc5ODgyMDZaIn0=`, + }, + KADUSERCookie: &http.Cookie{ + Name: "KADUSERCOOKIE", + Value: `7D75D25F-FAC9-443D-B2D1-B17FEE11E027`, + }, + OriginCookie: "go-test", + Aliases: make(map[string]string), + ImpBidCtx: make(map[string]models.ImpCtx), + PrebidBidderCode: make(map[string]string), + BidderResponseTimeMillis: make(map[string]int), + ProfileIDStr: "43563", + Endpoint: models.EndpointOWS2S, + MetricsEngine: mockEngine, + SeatNonBids: make(map[string][]openrtb_ext.NonBid), + }, + }, + }, + wantErr: nil, + }, + { + name: "Valid /openrtb2/auction?source=pbjs request(ows2s) debug set from request body instead of queryparam", + fields: fields{ + cfg: config.Config{}, + cache: nil, + }, + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/openrtb2/auction?source=pbjs", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&22987-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23025-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23386-CAESEMih0bN7ISRdZT8xX8LXzEw; KRTBCOOKIE_377=6810-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&22918-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&23031-59dc50c9-d658-44ce-b442-5a1f344d97c0; uids=eyJ0ZW1wV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B&23462-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse; KRTBCOOKIE_57=22776-41928985301451193&KRTB&23339-41928985301451193; KRTBCOOKIE_27=16735-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&16736-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"imp":[{"tagid":"/43743431/DMDemo","ext":{"prebid":{"bidder":{"pubmatic":{"publisherId":"5890"}},"adunitcode":"div-gpt-ad-1460505748561-0"}},"id":"div-gpt-ad-1460505748561-0","banner":{"topframe":1,"format":[{"w":300,"h":250}]}}],"site":{"domain":"localhost:9999","publisher":{"domain":"localhost:9999","id":"5890"},"page":"http://localhost:9999/integrationExamples/gpt/owServer_example.html"},"device":{"w":1792,"h":446,"dnt":0,"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","language":"en","sua":{"source":1,"platform":{"brand":"macOS"},"browsers":[{"brand":"Google Chrome","version":["117"]},{"brand":"Not;A=Brand","version":["8"]},{"brand":"Chromium","version":["117"]}],"mobile":0}},"ext":{"prebid":{"auctiontimestamp":1697191822565,"targeting":{"includewinners":true,"includebidderkeys":true},"bidderparams":{"pubmatic":{"publisherId":"5890","wrapper":{"profileid":43563,"versionid":1}}},"channel":{"name":"pbjs","version":"v8.7.0-pre"},"createtids":false,"debug":true}},"id":"5bdd7da5-1166-40fe-a9cb-3bf3c3164cd3","test":0,"tmax":3000}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) {}, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + ProfileID: 43563, + PubID: 0, + PubIDStr: "", + DisplayID: 1, + SSAuction: -1, +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ginCookie: "go-test", + Aliases: make(map[string]string), + ImpBidCtx: make(map[string]models.ImpCtx), + PrebidBidderCode: make(map[string]string), + BidderResponseTimeMillis: make(map[string]int), + ProfileIDStr: "43563", + Endpoint: models.EndpointOWS2S, + MetricsEngine: mockEngine, + SeatNonBids: make(map[string][]openrtb_ext.NonBid), + }, + }, + }, + wantErr: nil, + }, + { + name: "/openrtb2/auction?source=pbjs request(ows2s) without profileid", + fields: fields{ + cfg: config.Config{}, + cache: nil, + }, + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/openrtb2/auction?source=pbjs&debug=1", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&22987-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23025-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23386-CAESEMih0bN7ISRdZT8xX8LXzEw; KRTBCOOKIE_377=6810-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&22918-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&23031-59dc50c9-d658-44ce-b442-5a1f344d97c0; uids=eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OTo0My4zODg4Nzk5NVoifSwiYWRmIjp7InVpZCI6IjgwNDQ2MDgzMzM3Nzg4MzkwNzgiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxMS4wMzMwNTQ3MjdaIn0sImFka2VybmVsIjp7InVp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NWUiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxMi45ODk1MjM1NzNaIn0sInlpZWxkbGFiIjp7InVpZCI6IjY5NzE0ZDlmLWZiMDAtNGE1Zi04MTljLTRiZTE5MTM2YTMyNSIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjExLjMwMzAyNjYxNVoifSwieWllbGRtbyI6eyJ1aWQiOiJnOTZjMmY3MTlmMTU1MWIzMWY2MyIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjEwLjExMDUyODYwOVoifSwieWllbGRvbmUiOnsidWlkIjoiMmE0MmZiZDMtMmM3MC00ZWI5LWIxYmQtMDQ2OTY2NTBkOTQ4IiwiZXhwaXJlcyI6IjIwMjItMDYtMjRUMDU6NTk6MTAuMzE4MzMzOTM5WiJ9LCJ6ZXJvY2xpY2tmcmF1ZCI6eyJ1aWQiOiJiOTk5NThmZS0yYTg3LTJkYTQtOWNjNC05NjFmZDExM2JlY2UiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxNS43MTk1OTQ1NjZaIn19LCJiZGF5IjoiMjAyMi0wNS0xN1QwNjo0ODozOC4wMTc5ODgyMDZaIn0=; KRTBCOOKIE_153=1923-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&19420-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&22979-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&23462-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse; KRTBCOOKIE_57=22776-41928985301451193&KRTB&23339-41928985301451193; KRTBCOOKIE_27=16735-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&16736-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"imp":[{"tagid":"/43743431/DMDemo","ext":{"prebid":{"bidder":{"pubmatic":{"publisherId":"5890"}},"adunitcode":"div-gpt-ad-1460505748561-0"}},"id":"div-gpt-ad-1460505748561-0","banner":{"topframe":1,"format":[{"w":300,"h":250}]}}],"site":{"domain":"localhost:9999","publisher":{"domain":"localhost:9999","id":"5890"},"page":"http://localhost:9999/integrationExamples/gpt/owServer_example.html"},"device":{"w":1792,"h":446,"dnt":0,"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","language":"en","sua":{"source":1,"platform":{"brand":"macOS"},"browsers":[{"brand":"Google Chrome","version":["117"]},{"brand":"Not;A=Brand","version":["8"]},{"brand":"Chromium","version":["117"]}],"mobile":0}},"ext":{"prebid":{"auctiontimestamp":1697191822565,"targeting":{"includewinners":true,"includebidderkeys":true},"bidderparams":{"pubmatic":{"publisherId":"5890","wrapper":{}}},"channel":{"name":"pbjs","version":"v8.7.0-pre"},"createtids":false}},"id":"5bdd7da5-1166-40fe-a9cb-3bf3c3164cd3","test":0,"tmax":3000}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) { + mme.EXPECT().RecordBadRequests(gomock.Any(), 700) + }, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + Reject: true, + NbrCode: nbr.InvalidProfileID, + Errors: []string{"ErrMissingProfileID"}, + }, + wantErr: nil, + }, + { + name: "/openrtb2/auction without source=pbjs/inapp. new hybrid endpoint should not execute module", + fields: fields{ + cfg: config.Config{}, + cache: nil, + }, + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/openrtb2/auction?debug=1", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&22987-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23025-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23386-CAESEMih0bN7ISRdZT8xX8LXzEw; KRTBCOOKIE_377=6810-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&22918-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&23031-59dc50c9-d658-44ce-b442-5a1f344d97c0; uids=eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OTo0My4zODg4Nzk5NVoifSwiYWRmIjp7InVpZCI6IjgwNDQ2MDgzMzM3Nzg4MzkwNzgiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxMS4wMzMwNTQ3MjdaIn0sImFka2VybmVsIjp7InVpZCI6IkE5MTYzNTAwNzE0OTkyOTMyOTkwIiwiZXhwaXJlcyI6IjIwMjItMDYtMjRUMDU6NTk6MDkuMzczMzg1NjYyWiJ9LCJhZGtlcm5lbEFkbiI6eyJ1aWQiOiJBOTE2MzUwMDcxNDk5MjkzMjk5MCIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjEzLjQzNDkyNTg5NloifSwiYWRtaXhlciI6eyJ1aWQiOiIzNjZhMTdiMTJmMjI0ZDMwOGYzZTNiOGRhOGMzYzhhMCIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjA5LjU5MjkxNDgwMVoifSwiYWRueHMiOnsidWlkIjoiNDE5Mjg5ODUzMDE0NTExOTMiLCJleHBpcmVzIjoiMjAyMy0wMS0xOFQwOTo1MzowOC44MjU0NDI2NzZaIn0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6ZXJvY2xpY2tmcmF1ZCI6eyJ1aWQiOiJiOTk5NThmZS0yYTg3LTJkYTQtOWNjNC05NjFmZDExM2JlY2UiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxNS43MTk1OTQ1NjZaIn19LCJiZGF5IjoiMjAyMi0wNS0xN1QwNjo0ODozOC4wMTc5ODgyMDZaIn0=; KRTBCOOKIE_153=1923-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&19420-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&22979-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse&KRTB&23462-LZw-Ny-bMjI2m2Q8IpsrNnnIYzw2yjdnLJsrdYse; KRTBCOOKIE_57=22776-41928985301451193&KRTB&23339-41928985301451193; KRTBCOOKIE_27=16735-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&16736-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"imp":[{"tagid":"/43743431/DMDemo","ext":{"prebid":{"bidder":{"pubmatic":{"publisherId":"5890"}},"adunitcode":"div-gpt-ad-1460505748561-0"}},"id":"div-gpt-ad-1460505748561-0","banner":{"topframe":1,"format":[{"w":300,"h":250}]}}],"site":{"domain":"localhost:9999","publisher":{"domain":"localhost:9999","id":"5890"},"page":"http://localhost:9999/integrationExamples/gpt/owServer_example.html"},"device":{"w":1792,"h":446,"dnt":0,"ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","language":"en","sua":{"source":1,"platform":{"brand":"macOS"},"browsers":[{"brand":"Google Chrome","version":["117"]},{"brand":"Not;A=Brand","version":["8"]},{"brand":"Chromium","version":["117"]}],"mobile":0}},"ext":{"prebid":{"auctiontimestamp":1697191822565,"targeting":{"includewinners":true,"includebidderkeys":true},"bidderparams":{"pubmatic":{"publisherId":"5890","wrapper":{}}},"channel":{"name":"pbjs","version":"v8.7.0-pre"},"createtids":false}},"id":"5bdd7da5-1166-40fe-a9cb-3bf3c3164cd3","test":0,"tmax":3000}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) {}, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + Endpoint: models.EndpointHybrid, + }, + }, + }, + wantErr: nil, + }, + { + name: "hybrid api pbs/openrtb2/auction should not execute entrypointhook", + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/pbs/openrtb2/auction", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&22987-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23025-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23386-CAESEMih0bN7ISRdZT8xX8LXzEw; KRTBCOOKIE_377=6810-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&22918-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&23031-59dc50c9-d658-44ce-b442-5a1f344d97c0; uids=eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OTo0My4zODg4Nzk5NVoifSwiYWRmIjp7InVpZCI6IjgwNDQ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uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"ext":{"wrapper":{"profileid":5890,"versionid":1}}}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) {}, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + Endpoint: models.EndpointHybrid, + }, + }, + }, + wantErr: nil, + }, + { + name: "valid /openrtb2/auction?source=inapp request directly on port 8000", + fields: fields{ + cfg: config.Config{ + Tracker: config.Tracker{ + Endpoint: "t.pubmatic.com", + VideoErrorTrackerEndpoint: "t.pubmatic.com/error", + }, + }, + cache: nil, + }, + args: args{ + in0: context.Background(), + miCtx: hookstage.ModuleInvocationContext{}, + payload: hookstage.EntrypointPayload{ + Request: func() *http.Request { + r, err := http.NewRequest("POST", "http://localhost/openrtb2/auction?source=inapp&debug=1", nil) + if err != nil { + panic(err) + } + r.Header.Add("User-Agent", "go-test") + r.Header.Add("SOURCE_IP", "127.0.0.1") + r.Header.Add("Cookie", `KADUSERCOOKIE=7D75D25F-FAC9-443D-B2D1-B17FEE11E027; DPSync3=1684886400%3A248%7C1685491200%3A245_226_201; KRTBCOOKIE_80=16514-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&22987-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23025-CAESEMih0bN7ISRdZT8xX8LXzEw&KRTB&23386-CAESEMih0bN7ISRdZT8xX8LXzEw; KRTBCOOKIE_377=6810-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&22918-59dc50c9-d658-44ce-b442-5a1f344d97c0&KRTB&23031-59dc50c9-d658-44ce-b442-5a1f344d97c0; uids=eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleH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41928985301451193&KRTB&23339-41928985301451193; KRTBCOOKIE_27=16735-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&16736-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23019-uid:3cab6283-4546-4500-a7b6-40ef605fe745&KRTB&23114-uid:3cab6283-4546-4500-a7b6-40ef605fe745; KRTBCOOKIE_18=22947-1978557989514665832; KRTBCOOKIE_466=16530-4fc36250-d852-459c-8772-7356de17ab97; KRTBCOOKIE_391=22924-8044608333778839078&KRTB&23263-8044608333778839078&KRTB&23481-8044608333778839078; KRTBCOOKIE_1310=23431-b81c3g7dr67i&KRTB&23446-b81c3g7dr67i&KRTB&23465-b81c3g7dr67i; KRTBCOOKIE_1290=23368-vkf3yv9lbbl; KRTBCOOKIE_22=14911-4554572065121110164&KRTB&23150-4554572065121110164; KRTBCOOKIE_860=16335-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23334-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23417-YGAqDU1zUTdjyAFxCoe3kctlNPo&KRTB&23426-YGAqDU1zUTdjyAFxCoe3kctlNPo; KRTBCOOKIE_904=16787-KwJwE7NkCZClNJRysN2iYg; KRTBCOOKIE_1159=23138-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23328-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23427-5545f53f3d6e4ec199d8ed627ff026f3&KRTB&23445-5545f53f3d6e4ec199d8ed627ff026f3; KRTBCOOKIE_32=11175-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22713-AQEI_1QecY2ESAIjEW6KAQEBAQE&KRTB&22715-AQEI_1QecY2ESAIjEW6KAQEBAQE; SyncRTB3=1685577600%3A35%7C1685491200%3A107_21_71_56_204_247_165_231_233_179_22_209_54_254_238_96_99_220_7_214_13_3_8_234_176_46_5%7C1684886400%3A2_223_15%7C1689465600%3A69%7C1685145600%3A63; KRTBCOOKIE_107=1471-uid:EK38R0PM1NQR0H5&KRTB&23421-uid:EK38R0PM1NQR0H5; KRTBCOOKIE_594=17105-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004&KRTB&17107-RX-447a6332-530e-456a-97f4-3f0fd1ed48c9-004; SPugT=1684310122; chkChromeAb67Sec=133; KRTBCOOKIE_699=22727-AAFy2k7FBosAAEasbJoXnw; PugT=1684310473; origin=go-test`) + return r + }(), + Body: []byte(`{"ext":{"wrapper":{"profileid":5890,"versionid":1}}}`), + }, + setup: func(mme *mock_metrics.MockMetricsEngine) {}, + }, + want: hookstage.HookResult[hookstage.EntrypointPayload]{ + ModuleContext: hookstage.ModuleContext{ + "rctx": models.RequestCtx{ + ProfileID: 5890, + DisplayID: 1, + SSAuction: -1, + Debug: true, + UA: "go-test", + IP: "127.0.0.1", + IsCTVRequest: false, + TrackerEndpoint: "t.pubmatic.com", + VideoErrorTrackerEndpoint: "t.pubmatic.com/error", + UidCookie: &http.Cookie{ + Name: "uids", + Value: `eyJ0ZW1wVUlEcyI6eyIzM2Fjcm9zcyI6eyJ1aWQiOiIxMTkxNzkxMDk5Nzc2NjEiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OTo0My4zODg4Nzk5NVoifSwiYWRmIjp7InVpZCI6IjgwNDQ2MDgzMzM3Nzg4MzkwNzgiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxMS4wMzMwNTQ3MjdaIn0sImFka2VybmVsIjp7InVpZCI6IkE5MTYzNTAwNzE0OTkyOTMyOTkwIiwiZXhwaXJlcyI6IjIwMjItMDYtMjRUMDU6NTk6MDkuMzczMzg1NjYyWiJ9LCJhZGtlcm5lbEFkbiI6eyJ1aWQiOiJBOTE2MzUwMDcxNDk5MjkzMjk5MCIsImV4cGlyZXMiOiIyMDIyLTA2LTI0VDA1OjU5OjEzLjQzNDkyNTg5NloifSwiYWRtaXhlciI6eyJ1aWQiOiIzNjZhMTdiMTJmMjI0ZDMwOGYzZTNiOGRhOGMzYzhhMCIsImV4cGlyZXMiOiIyM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oifSwieWllbGRvbmUiOnsidWlkIjoiMmE0MmZiZDMtMmM3MC00ZWI5LWIxYmQtMDQ2OTY2NTBkOTQ4IiwiZXhwaXJlcyI6IjIwMjItMDYtMjRUMDU6NTk6MTAuMzE4MzMzOTM5WiJ9LCJ6ZXJvY2xpY2tmcmF1ZCI6eyJ1aWQiOiJiOTk5NThmZS0yYTg3LTJkYTQtOWNjNC05NjFmZDExM2JlY2UiLCJleHBpcmVzIjoiMjAyMi0wNi0yNFQwNTo1OToxNS43MTk1OTQ1NjZaIn19LCJiZGF5IjoiMjAyMi0wNS0xN1QwNjo0ODozOC4wMTc5ODgyMDZaIn0=`, + }, + KADUSERCookie: &http.Cookie{ + Name: "KADUSERCOOKIE", + Value: `7D75D25F-FAC9-443D-B2D1-B17FEE11E027`, + }, + OriginCookie: "go-test", + Aliases: make(map[string]string), + ImpBidCtx: make(map[string]models.ImpCtx), + PrebidBidderCode: make(map[string]string), + BidderResponseTimeMillis: make(map[string]int), + ProfileIDStr: "5890", + Endpoint: models.EndpointV25, + MetricsEngine: mockEngine, + SeatNonBids: make(map[string][]openrtb_ext.NonBid), + }, + }, + }, + wantErr: nil, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -223,6 +503,10 @@ func TestOpenWrap_handleEntrypointHook(t *testing.T) { if tt.want.ModuleContext != nil { // validate runtime values individually and reset them gotRctx := got.ModuleContext["rctx"].(models.RequestCtx) + if gotRctx.Endpoint == models.EndpointHybrid || gotRctx.Sshb == "1" { + assert.Equal(t, got, tt.want) + return + } assert.NotEmpty(t, gotRctx.StartTime) gotRctx.StartTime = 0 diff --git a/modules/pubmatic/openwrap/models/constants.go b/modules/pubmatic/openwrap/models/constants.go index 9f2f962cc85..58f67e9cfb5 100755 --- a/modules/pubmatic/openwrap/models/constants.go +++ b/modules/pubmatic/openwrap/models/constants.go @@ -408,7 +408,9 @@ const ( EndpointJson = "json" EndpointORTB = "ortb" EndpointVAST = "vast" + EndpointOWS2S = "ows2s" EndPointCTV = "ctv" + EndpointHybrid = "hybrid" Openwrap = "openwrap" ImpTypeBanner = "banner" ImpTypeVideo = "video" diff --git a/modules/pubmatic/openwrap/models/openwrap.go b/modules/pubmatic/openwrap/models/openwrap.go index d33107f5469..04ee42d3cbf 100644 --- a/modules/pubmatic/openwrap/models/openwrap.go +++ b/modules/pubmatic/openwrap/models/openwrap.go @@ -78,7 +78,8 @@ type RequestCtx struct { Endpoint string PubIDStr, ProfileIDStr string // TODO: remove this once we completely move away from header-bidding MetricsEngine metrics.MetricsEngine - ReturnAllBidStatus bool // ReturnAllBidStatus stores the value of request.ext.prebid.returnallbidstatus + ReturnAllBidStatus bool // ReturnAllBidStatus stores the value of request.ext.prebid.returnallbidstatus + Sshb string //Sshb query param to identify that the request executed heder-bidding or not, sshb=1(executed HB(8001)), sshb=2(reverse proxy set from HB(8001->8000)), sshb=""(direct request(8000)). } type OwBid struct { diff --git a/modules/pubmatic/openwrap/models/request.go b/modules/pubmatic/openwrap/models/request.go index 43a5f2c800e..e8f454e8e15 100644 --- a/modules/pubmatic/openwrap/models/request.go +++ b/modules/pubmatic/openwrap/models/request.go @@ -41,8 +41,9 @@ type ImpExtension struct { Bidder map[string]*BidderExtension `json:"bidder,omitempty"` SKAdnetwork json.RawMessage `json:"skadn,omitempty"` - Data json.RawMessage `json:"data,omitempty"` + Data openrtb_ext.ExtImpData `json:"data,omitempty"` Prebid openrtb_ext.ExtImpPrebid `json:"prebid,omitempty"` + Gpid string `json:"gpid,omitempty"` } // BidderExtension - Bidder specific items