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

Oo 1 #131

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Prev Previous commit
⚡ Validate User.ID
agolovev committed Aug 9, 2024
commit 9874c9525d25adbed55ce9b13a4d9d0c55f990b3
6 changes: 6 additions & 0 deletions bidrequest.go
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ var (
ErrInvalidReqMultiInv = errors.New("openrtb: request has multiple inventory sources") // has site and app
ErrInvalidSitePage = errors.New("openrtb: request hasn't site.page or site.domain")
ErrInvalidDeviceIP = errors.New("openrtb: request has invalid device.ip || device.ipv6")
ErrInvalidUserID = errors.New("openrtb: request has invalid user.id")
)

// BidRequest is the top-level bid request object contains a globally unique bid request or auction ID. This "id"
@@ -63,5 +64,10 @@ func (req *BidRequest) Validate() error {
return err
}
}

if req.User == nil || len(req.User.ID) == 0 {
return ErrInvalidUserID
}

return nil
}