Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
CCPA Video Bug (prebid#1333)
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxNode authored Jun 8, 2020
1 parent e41c7d4 commit ef4074c
Show file tree
Hide file tree
Showing 14 changed files with 729 additions and 369 deletions.
3 changes: 1 addition & 2 deletions endpoints/openrtb2/amp_auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ func TestAMPPageInfo(t *testing.T) {
}

func TestGDPRConsent(t *testing.T) {
consent := "BONV8oqONXwgmADACHENAO7pqzAAppY"
consent := "BOu5On0Ou5On0ADACHENAO7pqzAAppY"
existingConsent := "BONV8oqONXwgmADACHENAO7pqzAAppY"

digitrust := &openrtb_ext.ExtUserDigiTrust{
ID: "anyDigitrustID",
KeyV: 1,
Expand Down
7 changes: 6 additions & 1 deletion endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ func (deps *endpointDeps) validateRequest(req *openrtb.BidRequest) []error {
}

if err := ccpaPolicy.Validate(); err != nil {
errL = append(errL, &errortypes.Warning{Message: fmt.Sprintf("CCPA value is invalid and will be ignored. (%s)", err.Error())})
errL = append(errL, &errortypes.InvalidPrivacyConsent{Message: fmt.Sprintf("CCPA consent is invalid and will be ignored. (%v)", err)})

ccpaPolicy.Value = ""
if err := ccpaPolicy.Write(req); err != nil {
errL = append(errL, fmt.Errorf("Unable to remove invalid CCPA consent from the request. (%v)", err))
}
}

impIDs := make(map[string]int, len(req.Imp))
Expand Down
12 changes: 7 additions & 5 deletions endpoints/openrtb2/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ func TestCurrencyTrunc(t *testing.T) {
assert.ElementsMatch(t, errL, []error{&expectedError})
}

func TestCCPAInvalidValueWarning(t *testing.T) {
func TestCCPAInvalid(t *testing.T) {
deps := &endpointDeps{
&nobidExchange{},
newParamsValidator(t),
Expand Down Expand Up @@ -943,21 +943,23 @@ func TestCCPAInvalidValueWarning(t *testing.T) {
W: &ui,
H: &ui,
},
Ext: json.RawMessage("{\"appnexus\": {\"placementId\": 5667}}"),
Ext: json.RawMessage(`{"appnexus": {"placementId": 5667}}`),
},
},
Site: &openrtb.Site{
ID: "myID",
},
Regs: &openrtb.Regs{
Ext: json.RawMessage("{\"us_privacy\":\"invalid by length\"}"),
Ext: json.RawMessage(`{"us_privacy":"invalid by length"}`),
},
}

errL := deps.validateRequest(&req)

expectedError := errortypes.Warning{Message: "CCPA value is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)"}
assert.ElementsMatch(t, errL, []error{&expectedError})
expectedWarning := errortypes.InvalidPrivacyConsent{Message: "CCPA consent is invalid and will be ignored. (request.regs.ext.us_privacy must contain 4 characters)"}
assert.ElementsMatch(t, errL, []error{&expectedWarning})

assert.Empty(t, req.Regs.Ext, "Invalid Consent Removed From Request")
}

// nobidExchange is a well-behaved exchange which always bids "no bid".
Expand Down
125 changes: 63 additions & 62 deletions endpoints/openrtb2/sample-requests/video/video_invalid_sample.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
{
"description": "Video endpoint valid request.",
"description": "Video endpoint valid request due to missing pods.",

"requestPayload":
{
"storedrequestid": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"accountid": "555888777",

"site": {
"page": "prebid.com"
},
"user": {
"buyeruids": {
"appnexus": "unique_id_an",
"rubicon": "unique_id_rubi"
"requestPayload": {
"storedrequestid": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"site": {
"page": "prebid.com"
},
"regs": {
"ext": {
"gdpr": 0
}
},
"user": {
"yob": 1991,
"gender": "F",
"keywords": "Hotels, Travelling",
"ext": {
"prebid": {
"buyeruids": {
"appnexus": "unique_id_an",
"rubicon": "unique_id_rubi"
}
}
}
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
"ip": "123.145.167.10",
"devicetype": 1,
"ifa": "AA000DFE74168477C70D291f574D344790E0BB11",
"lmt": 44,
"os": "mac os",
"w": 640,
"h": 480,
"didsha1": "didsha1",
"didmd5": "didmd5",
"dpidsha1": "dpidsha1",
"dpidmd5": "dpidmd5",
"macsha1": "macsha1",
"macmd5": "macmd5"
},
"includebrandcategory": {
"primaryadserver": 1,
"publisher": ""
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"protocols": [
2, 3, 5, 6
]
},
"gdpr": {
"consentrequired": false,
"consentstring": "something"
"content": {
"episode": 6,
"title": "episodeName",
"series": "TvName",
"season": "season3",
"len": 900,
"livestream": 0
},
"yob": 1991,
"gender": "F",
"keywords": "Hotels, Travelling"
},
"device11": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
"ip": "123.145.167.10",
"devicetype": 1,
"dnt": 33,
"ifa": "AA000DFE74168477C70D291f574D344790E0BB11",
"lmt": 44,
"os": "mac os",
"w": 640,
"h": 480,
"didsha1": "didsha1",
"didmd5": "didmd5",
"dpidsha1": "dpidsha1",
"dpidmd5": "dpidmd5",
"macsha1": "macsha1",
"macmd5": "macmd5"
},
"includebrandcategory":{
"primaryadserver": 1,
"publisher": ""
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"protocols": [
2,3,5,6
]
},
"content": {
"episode": 6,
"title": "episodeName",
"series": "TvName",
"season": "season3",
"len": 900,
"livestream": 0
},
"cacheconfig": {
"ttl": 42
"cacheconfig": {
"ttl": 42
}
}
}
}
155 changes: 78 additions & 77 deletions endpoints/openrtb2/sample-requests/video/video_valid_sample.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,86 @@
{
"description": "Video endpoint valid request.",

"requestPayload":
{
"storedrequestid": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"accountid": "555888777",
"podconfig": {
"durationrangesec": [
30
],
"requireexactduration": true,
"pods": [
{
"podid": 1,
"adpoddurationsec": 180,
"configid": "fba10607-0c12-43d1-ad07-b8a513bc75d6"
},
{
"podid": 2,
"adpoddurationsec": 150,
"configid": "8b452b41-2681-4a20-9086-6f16ffad7773"
"requestPayload": {
"storedrequestid": "80ce30c53c16e6ede735f123ef6e32361bfc7b22",
"podconfig": {
"durationrangesec": [
30
],
"requireexactduration": true,
"pods": [{
"podid": 1,
"adpoddurationsec": 180,
"configid": "fba10607-0c12-43d1-ad07-b8a513bc75d6"
},
{
"podid": 2,
"adpoddurationsec": 150,
"configid": "8b452b41-2681-4a20-9086-6f16ffad7773"
}
]
},
"site": {
"page": "prebid.com"
},
"regs": {
"ext": {
"gdpr": 0
}
},
"user": {
"yob": 1991,
"gender": "F",
"keywords": "Hotels, Travelling",
"ext": {
"prebid": {
"buyeruids": {
"appnexus": "unique_id_an",
"rubicon": "unique_id_rubi"
}
}
}
]
},
"site": {
"page": "prebid.com"
},
"user": {
"buyeruids": {
"appnexus": "unique_id_an",
"rubicon": "unique_id_rubi"
},
"gdpr": {
"consentrequired": false,
"consentstring": "something"
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
"ip": "123.145.167.10",
"devicetype": 1,
"ifa": "AA000DFE74168477C70D291f574D344790E0BB11",
"lmt": 44,
"os": "mac os",
"w": 640,
"h": 480,
"didsha1": "didsha1",
"didmd5": "didmd5",
"dpidsha1": "dpidsha1",
"dpidmd5": "dpidmd5",
"macsha1": "macsha1",
"macmd5": "macmd5"
},
"includebrandcategory": {
"primaryadserver": 1,
"publisher": ""
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"protocols": [
2, 3, 5, 6
]
},
"content": {
"episode": 6,
"title": "episodeName",
"series": "TvName",
"season": "season3",
"len": 900,
"livestream": 0
},
"yob": 1991,
"gender": "F",
"keywords": "Hotels, Travelling"
},
"device11": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
"ip": "123.145.167.10",
"devicetype": 1,
"dnt": 33,
"ifa": "AA000DFE74168477C70D291f574D344790E0BB11",
"lmt": 44,
"os": "mac os",
"w": 640,
"h": 480,
"didsha1": "didsha1",
"didmd5": "didmd5",
"dpidsha1": "dpidsha1",
"dpidmd5": "dpidmd5",
"macsha1": "macsha1",
"macmd5": "macmd5"
},
"includebrandcategory":{
"primaryadserver": 1,
"publisher": ""
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"protocols": [
2,3,5,6
]
},
"content": {
"episode": 6,
"title": "episodeName",
"series": "TvName",
"season": "season3",
"len": 900,
"livestream": 0
},
"cacheconfig": {
"ttl": 42
"cacheconfig": {
"ttl": 42
}
}
}
}
Loading

0 comments on commit ef4074c

Please sign in to comment.