Skip to content

Core decodes the TCF, GPP and US privacy strings itself #1335

Open

Description

@jwrosewell

One of the removals listed in #777.

What is wrong

crates/trusted-server-core/src/consent extracts the consent strings from cookies and headers, decodes each (TCF v2, GPP with its sections, the US privacy string) and builds the request's consent context from them, which with its settings is 3,863 lines of core. The permission signal crates for those standards (crates/permission-signal/tcf, gpp and us-privacy) exist and are selected by name, yet the decoding they are named for is core's, and the auction, the mock ad server and the Cloudflare adapter read core's decoders directly.

A standard is a vendor's thing as much as a product is. Core keeps the interface a permission signal implements and what a signal means to a request, and nothing of how one standard spells it.

What changes

  • Each decoder moves to the crate named for its standard. The TCF decoding goes to crates/permission-signal/tcf, the GPP decoding to crates/permission-signal/gpp, the US privacy string to crates/permission-signal/us-privacy. Each reads its own string from the request and answers through the permission signal interface core declares.
  • Core keeps the neutral types. The request's consent context, the permission state it resolves to and the source a signal came from stay in core as the interface every signal module fills. Nothing in core names a standard.
  • Readers read the interface. The auction, the mock ad server and the adapters read the request's resolved state, never a standard's decoded fields. Where a demand implementation needs a string in a standard's own form, the crate for that standard supplies it to the crate that asks, as one vendor crate may depend on another where no released package offers the functionality.

Why

The permission model (#1045) made how a permission becomes held the business of modules outside core. Decoding the strings those modules are named for inside core left the model half done, and left core carrying every change the standards make.

What breaks

A deployment that selects a permission signal module keeps the same settings. A deployment that read core's decoders in code of its own reads the resolved state, or depends on the crate of the standard it wants.

Where it is

A series on the stack, as a draft on the fork, jwrosewell#37, on top of the Prebid cookie series (fork pull request 36).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions