Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
0f955e9
Remove invalid user EIDs and UIDs from bid request
Pubmatic-Supriya-Patil Aug 28, 2024
9352604
Merge branch 'master' of github.com:Pubmatic-Supriya-Patil/prebid-ser…
Pubmatic-Supriya-Patil Dec 2, 2024
541cbed
Merge branch 'master' of github.com:Pubmatic-Supriya-Patil/prebid-ser…
Pubmatic-Supriya-Patil Jan 13, 2025
22e6b21
Removed redundant check for uid.id validation
Pubmatic-Supriya-Patil Jan 14, 2025
db31c94
Merge branch 'master' of github.com:Pubmatic-Supriya-Patil/prebid-ser…
Pubmatic-Supriya-Patil Jan 16, 2025
0f45f16
Merge branch 'master' of github.com:Pubmatic-Supriya-Patil/prebid-ser…
Pubmatic-Supriya-Patil Feb 4, 2025
5514eae
Refactor EID validation to issue warnings for missing source field in…
Pubmatic-Supriya-Patil Feb 4, 2025
74d9c26
Remove validation for empty UIDs in user EIDs
Pubmatic-Supriya-Patil Feb 28, 2025
5d56a61
Merge branch 'prebid:master' into Fix_3859
Pubmatic-Supriya-Patil Feb 28, 2025
5c45e53
Merge branch 'prebid:master' into Fix_3859
Pubmatic-Supriya-Patil Mar 4, 2025
4dcd6c9
Update EID validation to remove entries with empty UIDs and add new t…
Pubmatic-Supriya-Patil Mar 7, 2025
675bd31
Merge branch 'Fix_3859' of github.com:Pubmatic-Supriya-Patil/prebid-s…
Pubmatic-Supriya-Patil Mar 7, 2025
f6eea3c
Move user-eids-uids-empty.json to valid-whole folder
Pubmatic-Supriya-Patil Mar 19, 2025
ff59f36
Merge branch 'prebid:master' into Fix_3859
Pubmatic-Supriya-Patil Mar 19, 2025
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
59 changes: 50 additions & 9 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1277,23 +1277,64 @@ func (deps *endpointDeps) validateUser(req *openrtb_ext.RequestWrapper, aliases
}

// Check Universal User ID
for eidIndex, eid := range req.User.EIDs {
if len(req.User.EIDs) > 0 {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick; Please remove the leading empty line.

validEids, eidErrors := validateEIDs(req.User.EIDs)

if len(eidErrors) > 0 {
errL = append(errL, eidErrors...)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely fine to keep this logic here for now. We want to separate validation from fixing in the future. We can refactor this new logic along with the rest later. Thoughts @bsardo?

req.User.EIDs = validEids
}

return errL
}

func validateEIDs(eids []openrtb2.EID) ([]openrtb2.EID, []error) {
var errorsList []error
validEIDs := make([]openrtb2.EID, 0, len(eids))

for eidIndex, eid := range eids {
if eid.Source == "" {
return append(errL, fmt.Errorf("request.user.eids[%d] missing required field: \"source\"", eidIndex))
errorsList = append(errorsList, &errortypes.Warning{
Message: fmt.Sprintf("request.user.eids[%d] removed due to missing source", eidIndex),
WarningCode: errortypes.InvalidUserEIDsWarningCode,
})
continue
}
validUIDs, uidErrors := validateUIDs(eid.UIDs, eidIndex)
errorsList = append(errorsList, uidErrors...)

if len(eid.UIDs) == 0 {
return append(errL, fmt.Errorf("request.user.eids[%d].uids must contain at least one element or be undefined", eidIndex))
if len(validUIDs) > 0 {
eid.UIDs = validUIDs
validEIDs = append(validEIDs, eid)
} else {
errorsList = append(errorsList, &errortypes.Warning{
Message: fmt.Sprintf("request.user.eids[%d] (source: %s) removed due to empty uids", eidIndex, eid.Source),
WarningCode: errortypes.InvalidUserEIDsWarningCode,
})
}
}

for uidIndex, uid := range eid.UIDs {
if uid.ID == "" {
return append(errL, fmt.Errorf("request.user.eids[%d].uids[%d] missing required field: \"id\"", eidIndex, uidIndex))
}
return validEIDs, errorsList
}

func validateUIDs(uids []openrtb2.UID, eidIndex int) ([]openrtb2.UID, []error) {
var validUIDs []openrtb2.UID
var uidErrors []error

for uidIndex, uid := range uids {
if uid.ID != "" {
validUIDs = append(validUIDs, uid)
} else {
uidErrors = append(uidErrors, &errortypes.Warning{
Message: fmt.Sprintf("request.user.eids[%d].uids[%d] removed due to empty ids", eidIndex, uidIndex),
WarningCode: errortypes.InvalidUserUIDsWarningCode,
})
}
}

return errL
return validUIDs, uidErrors
}

func validateRegs(req *openrtb_ext.RequestWrapper, gpp gpplib.GppContainer) []error {
Expand Down
Loading
Loading