-
Notifications
You must be signed in to change notification settings - Fork 764
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
Refactor: Removed unused GDPR return value #1839
Changes from all commits
4ca32a0
1bebc71
20c207d
9a52fb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,19 +63,19 @@ func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, | |
PublisherID string, | ||
gdprSignal Signal, | ||
consent string, | ||
weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { | ||
weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { | ||
if _, ok := p.cfg.NonStandardPublisherMap[PublisherID]; ok { | ||
return true, true, true, nil | ||
return true, true, nil | ||
} | ||
|
||
gdprSignal = p.normalizeGDPR(gdprSignal) | ||
|
||
if gdprSignal == SignalNo { | ||
return true, true, true, nil | ||
return true, true, nil | ||
} | ||
|
||
if consent == "" && gdprSignal == SignalYes { | ||
return false, false, false, nil | ||
return false, false, nil | ||
} | ||
|
||
if id, ok := p.vendorIDs[bidder]; ok { | ||
|
@@ -85,8 +85,8 @@ func (p *permissionsImpl) PersonalInfoAllowed(ctx context.Context, | |
return p.defaultVendorPermissions() | ||
} | ||
|
||
func (p *permissionsImpl) defaultVendorPermissions() (allowPI bool, allowGeo bool, allowID bool, err error) { | ||
return false, false, false, nil | ||
func (p *permissionsImpl) defaultVendorPermissions() (allowGeo bool, allowID bool, err error) { | ||
return false, false, nil | ||
} | ||
|
||
func (p *permissionsImpl) normalizeGDPR(gdprSignal Signal) Signal { | ||
|
@@ -135,35 +135,34 @@ func (p *permissionsImpl) allowSync(ctx context.Context, vendorID uint16, consen | |
return false, nil | ||
} | ||
|
||
func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { | ||
func (p *permissionsImpl) allowPI(ctx context.Context, vendorID uint16, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { | ||
parsedConsent, vendor, err := p.parseVendor(ctx, vendorID, consent) | ||
if err != nil { | ||
return false, false, false, err | ||
return false, false, err | ||
} | ||
|
||
if vendor == nil { | ||
return false, false, false, nil | ||
return false, false, nil | ||
} | ||
|
||
if parsedConsent.Version() == 2 { | ||
if p.cfg.TCF2.Enabled { | ||
return p.allowPITCF2(parsedConsent, vendor, vendorID, weakVendorEnforcement) | ||
} | ||
if (vendor.Purpose(consentconstants.InfoStorageAccess) || vendor.LegitimateInterest(consentconstants.InfoStorageAccess) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.InfoStorageAccess) && (vendor.Purpose(consentconstants.PersonalizationProfile) || vendor.LegitimateInterest(consentconstants.PersonalizationProfile) || weakVendorEnforcement) && parsedConsent.PurposeAllowed(consentconstants.PersonalizationProfile) && (parsedConsent.VendorConsent(vendorID) || weakVendorEnforcement) { | ||
return true, true, true, nil | ||
return true, true, nil | ||
} | ||
} else { | ||
if (vendor.Purpose(tcf1constants.InfoStorageAccess) || vendor.LegitimateInterest(tcf1constants.InfoStorageAccess)) && parsedConsent.PurposeAllowed(tcf1constants.InfoStorageAccess) && (vendor.Purpose(tcf1constants.AdSelectionDeliveryReporting) || vendor.LegitimateInterest(tcf1constants.AdSelectionDeliveryReporting)) && parsedConsent.PurposeAllowed(tcf1constants.AdSelectionDeliveryReporting) && parsedConsent.VendorConsent(vendorID) { | ||
return true, true, true, nil | ||
return true, true, nil | ||
} | ||
} | ||
return false, false, false, nil | ||
return false, false, nil | ||
} | ||
|
||
func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16, weakVendorEnforcement bool) (allowPI bool, allowGeo bool, allowID bool, err error) { | ||
func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor api.Vendor, vendorID uint16, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { | ||
consent, ok := parsedConsent.(tcf2.ConsentMetadata) | ||
err = nil | ||
allowPI = false | ||
allowGeo = false | ||
allowID = false | ||
if !ok { | ||
|
@@ -181,17 +180,7 @@ func (p *permissionsImpl) allowPITCF2(parsedConsent api.VendorConsents, vendor a | |
break | ||
} | ||
} | ||
// Set to true so any purpose check can flip it to false | ||
allowPI = true | ||
if p.cfg.TCF2.Purpose1.Enabled { | ||
allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.InfoStorageAccess, weakVendorEnforcement) | ||
} | ||
if p.cfg.TCF2.Purpose2.Enabled { | ||
allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.BasicAdserving, weakVendorEnforcement) | ||
} | ||
if p.cfg.TCF2.Purpose7.Enabled { | ||
allowPI = allowPI && p.checkPurpose(consent, vendor, vendorID, consentconstants.AdPerformance, weakVendorEnforcement) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we remove these checks? Is this outdated logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is outdated as I don't see this logic anywhere in the TCF 2.0 spec. Either that or we have a bug because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic was added as part of TCF 2.0 about a year ago. I'm wondering if the requirements were misunderstood or have changed since this logic was added. From the spec:
Also from the spec:
I was planning to add this logic under a separate PR. @hhhjort thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have both AllowID and AllowPI. So lines 177-182 take care of AllowID for point 19 from the spec quoted above. AllowPI is to flag other non-geo personal information, like age or gender, for screening or not. The valid uses cases for these other pieces of info were considered more limited, and thus only available for a limited selection of purposes. |
||
|
||
return | ||
} | ||
|
||
|
@@ -265,8 +254,8 @@ func (a AlwaysAllow) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.B | |
return true, nil | ||
} | ||
|
||
func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { | ||
return true, true, true, nil | ||
func (a AlwaysAllow) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { | ||
return true, true, nil | ||
} | ||
|
||
// Exporting to allow for easy test setups | ||
|
@@ -280,6 +269,6 @@ func (a AlwaysFail) BidderSyncAllowed(ctx context.Context, bidder openrtb_ext.Bi | |
return false, nil | ||
} | ||
|
||
func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (bool, bool, bool, error) { | ||
return false, false, false, nil | ||
func (a AlwaysFail) PersonalInfoAllowed(ctx context.Context, bidder openrtb_ext.BidderName, PublisherID string, gdprSignal Signal, consent string, weakVendorEnforcement bool) (allowGeo bool, allowID bool, err error) { | ||
return false, false, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This looks a lot cleaner.