Skip to content

Commit

Permalink
mask app user's lat and lon (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
shunj-nb authored Jul 14, 2023
1 parent 0ead083 commit 51b0d9b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions pkg/modules/update_bundle/module/hook_raw_auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package update_bundle
import (
"encoding/json"

"github.com/ParticleMedia/msp/pkg/extract"
"github.com/prebid/openrtb/v19/openrtb2"
"github.com/prebid/prebid-server/hooks/hookstage"
"github.com/prebid/prebid-server/openrtb_ext"
Expand All @@ -16,18 +17,31 @@ func handleRawAuctionHook(
req := &openrtb_ext.RequestWrapper{}
req.BidRequest = &openrtb2.BidRequest{}
err := json.Unmarshal(rawjson, req.BidRequest)
if req.User != nil {
if req.User.Ext != nil {
var userExt extract.UserExt
err := json.Unmarshal(req.User.Ext, &userExt)
if err == nil {
//mask app user lat lon
updatedJson, err := json.Marshal(userExt)
if err == nil {
req.User.Ext = updatedJson
}
}
}
}
if err == nil && req.Device != nil {
if req.Device.OS != "" {
// hardcode ios bundle
if req.Device.OS == "iOS" || req.Device.OS == "iPadOS" {
req.App.Bundle = "1132762804"
}
req.RebuildRequest()
resolvedBidReq, err := json.Marshal(req.BidRequest)
return resolvedBidReq, err
}
}
return payload, nil

req.RebuildRequest()
resolvedBidReq, err := json.Marshal(req.BidRequest)
return resolvedBidReq, err
}, hookstage.MutationUpdate, "msp_update_bundle")
return result, nil
}

0 comments on commit 51b0d9b

Please sign in to comment.