Skip to content

Commit

Permalink
Fix: setuid endpoint sets cookie when both GDPR and GPP are set (#3165)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishshinde-pubm committed Dec 1, 2023
1 parent a6dea2f commit e2da446
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 0 additions & 1 deletion endpoints/setuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func NewSetUIDEndpoint(cfg *config.Configuration, syncersByBidder map[string]use
handleBadStatus(w, http.StatusBadRequest, metrics.SetUidBadRequest, err, metricsEngine, &so)
return
}
w.Write([]byte("Warning: " + err.Error()))
}

tcf2Cfg := tcf2CfgBuilder(cfg.GDPR.TCF2, account.GDPR)
Expand Down
18 changes: 14 additions & 4 deletions endpoints/setuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,25 @@ func TestSetUIDEndpoint(t *testing.T) {
},
{
uri: "/setuid?bidder=pubmatic&uid=123&gpp_sid=2,4&gpp=DBABMA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA" +
"gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
"&gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
syncersBidderNameToKey: map[string]string{"pubmatic": "pubmatic"},
gdprAllowsHostCookies: true,
existingSyncs: nil,
expectedSyncs: map[string]string{"pubmatic": "123"},
expectedStatusCode: http.StatusOK,
expectedBody: "Warning: 'gpp' value will be used over the one found in the deprecated 'gdpr_consent' field.",
expectedHeaders: map[string]string{"Content-Type": "text/plain; charset=utf-8"},
description: "Sets uid for a bidder allowed by GDPR in GPP, throws warning because GDPR legacy values weren't used",
expectedHeaders: map[string]string{"Content-Type": "text/html", "Content-Length": "0"},
description: "GPP value will be used over the one found in the deprecated GDPR consent field for iframe format",
},
{
uri: "/setuid?f=i&bidder=pubmatic&uid=123&gpp_sid=2,4&gpp=DBABMA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA" +
"&gdpr=1&gdpr_consent=BONciguONcjGKADACHENAOLS1rAHDAFAAEAASABQAMwAeACEAFw",
syncersBidderNameToKey: map[string]string{"pubmatic": "pubmatic"},
gdprAllowsHostCookies: true,
existingSyncs: nil,
expectedSyncs: map[string]string{"pubmatic": "123"},
expectedStatusCode: http.StatusOK,
expectedHeaders: map[string]string{"Content-Type": "image/png", "Content-Length": "86"},
description: "GPP value will be used over the one found in the deprecated GDPR consent field for redirect format",
},
{
uri: "/setuid?bidder=pubmatic&uid=123&gdpr=1&gdpr_consent=malformed",
Expand Down

0 comments on commit e2da446

Please sign in to comment.