Repository navigation
Read the Prebid EID cookie in the Prebid crate - #1382
Open
jwrosewell wants to merge 38 commits into
Open
jwrosewell wants to merge 38 commits into
jwrosewell wants to merge 38 commits into
Conversation
Core parsed the `ts-eids` cookie the Prebid page script persists the browser's identifiers in, in both shapes the script has written and with the size limit the script applies, so core knew one vendor's cookie and the Prebid crate did not own the cookie its own script writes. Core now declares `IdentifierModule`, in `ec::identifiers`, through which a module hands core the identifiers it learned for a request. A registration offers one with `with_identifier_module`, the registry hands every running registration's module to each request's services, and core asks them once, when it reads the Edge Cookie state, where the request's evidence is in hand. The answers are carried on the `EcContext` to response finalization, which offers them to the identity graph after the request body's own EIDs as the cookie was, and to the auction, which forwards them when the body carries none. With no Edge Cookie module selected nothing can hold or forward an identifier, so none are asked. The Prebid crate owns the cookie's name, its two shapes, its size limit and the parser in `eids.rs`, and `PrebidEids` is the first identifier module, registered from the Prebid builder. `COOKIE_EIDS` leaves core, the Fastly adapter no longer extracts the cookie before routing, and `ec_finalize_response` no longer takes its value. The template cache's identity rule refuses a key cookie under the public prefix instead of naming the Edge Cookie and the EIDs cookie, because every cookie under the prefix is one reader's own state. The `sharedId` cookie stays in core. It is not the cookie this change is about, and folding it into what a module hands core would forward it in bid requests, where today it reaches the identity graph alone.
# Conflicts: # CHANGELOG.md
…and what stops loading Review round 1 found that core asks the identifier modules on every read of the Edge Cookie state, so the Prebid cookie is decoded on requests that never use it, that the four adapters and their untested wiring were not described, that the template cache rule now refuses key cookies that loaded before, and that the opening gave the script's size limit where core accepts 8 KiB and the script writes 3072 bytes. The design now states each, adds the adapter table, the joins with no test and the open questions, and records the review round. One sentence of the Edge Cookies guide and one cell of the integration guide now say when the modules are asked.
Round 2 approved the design with no blocking issues. The design now says that a cookie in the shape the script writes today is tried as the legacy shape first, that the request body drops an entry whose source name is over 255 bytes and does not cut it, and which requests are answered before the modules are asked, being closed paths on every adapter and the script bundle on Axum, Cloudflare and Spin. The header names the fork and Tech Lab draft pull requests and the pull request that holds every design document of the stack. The paragraph of the integration guide on identifier modules now names the `[ec] module` condition and the client information and geo that the call carries.
This was referenced Oct 17, 2026
The two debug lines for an EID that gives no partner update printed the EID's source, which is what the reader's cookie or request body carried. The line for an EID with no partner now says only that one was skipped, and the line for an EID with no valid uid names the partner by its configured domain. A test captures both lines at debug level, so the test log helper now keeps lines at a level its caller chooses, and logged_by still keeps warnings and above.
Two test modules answered the name they were built with, read from their own field, while every real identifier module answers a constant. A module's name is what core passes to its call and logs when the module contributes nothing, so a name held in the module made those log lines look as if they printed data the module was handed. The module the identifier tests use now answers one constant name, which no test checks, and the registry tests use an enum of their two named modules.
13 of 17 tasks
jwrosewell
marked this pull request as ready for review
October 19, 2026 20:24
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
crates/trusted-server-core/srccrates/auction/prebiddocs/superpowersdocs/guidecrates/trusted-server-adapter-fastly/srcCHANGELOG.mdcrates/trusted-server-adapter-axum/srccrates/trusted-server-adapter-cloudflare/srccrates/trusted-server-adapter-spin/srcCloses
Closes #1337
Spec
Spec: identifier-modules
Test plan
CI on this pull request at e3ec48c passed all 29 checks.
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest runcd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveChecklist
unwrap()in production code (clippy deniesunwrap_usedin CI)logmacros as AGENTS.md asks (notprintln!)On top of the Flight rewriter series (#1381). Issue: #1337.
What this adds
What changes.
The Prebid crate reads the cookie its script writes. Core's parser of the
ts-eidscookie, with the cookie's name, its two shapes and its size limit, leavescrates/trusted-server-core/src/ec/prebid_eids.rsforcrates/auction/prebid/src/eids.rs, and core declares one interface through which a module hands core the identifiers it learned for a request.How it works.
IdentifierModulein core'sec/identifiers.rshas the shape of the prefix, geo and device interfaces: an id, the permissions it requires, andidentifiers(call)answering the identifiers for a request or that the call was withheld. A registration offers one throughwith_identifier_module, the registry claims each id once, and the request's services carry the modules beside the geo, Edge Cookie and device modules on every adapter.eidsunder the public prefix, the 8 KiB raw limit and both shapes are the crate's, and both Prebid builders register the module. Core names no cookie.Why
Every vendor's code leaves core and core keeps the interface. The identity graph is core's, and the cookie that feeds it from one vendor's script is the vendor's. The shared id cookie stays in core because it is not that cookie, has three other readers, and would otherwise be forwarded in bid requests where today it reaches the identity graph alone.
What breaks
A subresource request now decodes the cookie where before only navigations and the auction endpoints did, with persistence gated exactly as before. The template cache's identity rule is by prefix rather than by name, so a document keyed on another prefixed cookie is refused.
trusted_server_core::ec::prebid_eidsand the Fastly adapter's pre-routing cookie extraction are gone.The commits
What is not in this pull request
The
Eidtype andec/eids.rsstay where they are for the OpenRTB series, which moves the protocol's types out of core.