Repository navigation
Conversation
The server-side auction and page-bids built the bid request id as ts-<EC>, and every auction path set user.id to the EC whenever EC creation was allowed, which under GDPR is TCF Purpose 1 alone. Prebid Server bidders and APS therefore received the EC with storage consent only. Build the server-side request id as ts-req-<random> and decide user.id in one place, UserInfo::for_auction, which requires the same rule that gates partner EIDs (Purposes 1 and 4). Both auction request builders use it, so the Prebid Server and APS profile bodies inherit the gate.
dhruv8sh
left a comment
There was a problem hiding this comment.
This PR stops bidders from receiving the EC when a reader grants TCF Purpose 1 but refuses Purpose 4. I found no blocking issues.
- Request ID: the bid request
idis now alwaysts-req-<random>. It is no longerts-<EC>. user.id: it now goes through one helper,UserInfo::for_auction. The helper sends the EC only whenallows_eid_persistenceallows it, the same rule that already gates partner EIDs. Both outbound builders use it:convert_tsjs_to_auction_requestandpublisher::build_auction_request.
I searched the other places that build UserInfo directly. They look like test fixtures, not production paths that skip the gate. I couldn't run anything, so I haven't checked the test or CI results.
Tests cover these cases:
- the helper's consent rules, with and without Purpose 4, GDPR without a TCF signal, and outside GDPR;
- an empty EC;
- the
/auctionhandler end to end; - the Prebid Server and APS bid bodies, with a check that the EC appears only in
user.id.
The CHANGELOG notes that anything downstream that matched auctions by the old per-visitor request ID loses that link. That is intended.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Both auction builders now use the existing EID consent rule for user.id and generate request IDs independently of the EC. I verified that the Prebid Server and APS bid-body regressions passed in Fastly CI for this revision. No blocking findings.
|
|
||
| ### Security | ||
|
|
||
| - Bidders no longer receive the EC when a reader grants TCF Purpose 1 but refuses Purpose 4 (#1707). The server-side auction and `/_ts/page-bids` built the bid request `id` as `ts-<EC>`, and every auction path set `user.id` to the EC whenever EC creation was allowed, so Prebid Server bidders and APS received it with storage consent alone. The request `id` is now always `ts-req-<random>`, and `user.id` carries the EC only under the rule that already gates partner EIDs: Purposes 1 and 4 when a TCF signal is present, and no `user.id` when GDPR applies without one (including proxy consent mode with a TC cookie). Anything downstream that correlated auctions by the old per-visitor `ts-<EC>` request ID loses that correlation. |
There was a problem hiding this comment.
Non-blocking: could we scope the EC guarantee here and in docs/guide/edge-cookies.md to the built-in auction paths? Also, only publisher navigation and /_ts/page-bids use ts-req-; /auction keeps its existing UUID.
| - Bidders no longer receive the EC when a reader grants TCF Purpose 1 but refuses Purpose 4 (#1707). The server-side auction and `/_ts/page-bids` built the bid request `id` as `ts-<EC>`, and every auction path set `user.id` to the EC whenever EC creation was allowed, so Prebid Server bidders and APS received it with storage consent alone. The request `id` is now always `ts-req-<random>`, and `user.id` carries the EC only under the rule that already gates partner EIDs: Purposes 1 and 4 when a TCF signal is present, and no `user.id` when GDPR applies without one (including proxy consent mode with a TC cookie). Anything downstream that correlated auctions by the old per-visitor `ts-<EC>` request ID loses that correlation. | |
| - When a reader grants TCF Purpose 1 but refuses Purpose 4, Trusted Server omits the EC from bid requests it builds for publisher navigation, `/_ts/page-bids`, and `/auction` (#1707). Publisher navigation and `/_ts/page-bids` now use `ts-req-<random>` instead of `ts-<EC>`, so downstream consumers can no longer correlate auctions using that per-visitor request ID. `/auction` keeps its random UUID. The EC in `user.id` follows the same consent rule as partner EIDs: when decoded TCF consent is available, it requires Purposes 1 and 4. When GDPR applies without decoded TCF consent, including proxy consent mode with a TC cookie, Trusted Server omits `user.id`. |
dhruv8sh
left a comment
There was a problem hiding this comment.
Summary
This PR stops the EC from leaking into bid request IDs: AuctionRequest.id is now always ts-req-<uuid>. It also moves the user.id decision into one helper, UserInfo::for_auction, which uses the same rule that already gates partner EIDs (allows_eid_persistence: TCF P1+P4, and fail closed under GDPR with no TCF). Both the server-side/page-bids builder (publisher::build_auction_request) and the /auction path (convert_tsjs_to_auction_request) now go through it. The tests are strong: they serialize the whole request or outbound body and assert that the EC hash appears nowhere, or exactly once. They do this through the real /auction handler and the real PBS and APS OpenRTB builders. I checked that nothing in production parsed or stripped the old ts-<EC> request-ID prefix. The ec_allowed / allows_eid_persistence doc links resolve.
Non-blocking
⛏ nitpick
purpose_one_and_four_consentsilently returns P1-only consent if the base fixture ever loses its TCF — see inline atcrates/trusted-server-core/src/test_support.rs:104
👍 praise
- Single choke point for
user.id, with a doc comment that ties it to the EID rule — see inline atcrates/trusted-server-core/src/auction/types.rs:107
Cross-cutting / body-level findings
- 📌 The Testlight integration still sets
user.idfrom thets-eccookie without any consent check.crates/trusted-server-core/src/integrations/testlight.rs:111(viahandleat line 190) puts the EC into the outbound payload'suser.idwithout consultingallows_eid_persistence. Testlight is a test/dev auction proxy, so it is probably out of scope here. But the CHANGELOG entry says "every auction path setuser.idto the EC", which implies all of them are now gated. Consider a follow-up issue that either gates Testlight the same way or scopes the CHANGELOG wording to the server-side auction,/auctionand/_ts/page-bids.
| #[must_use] | ||
| pub fn purpose_one_and_four_consent() -> ConsentContext { | ||
| let mut consent = purpose_one_only_consent(); | ||
| if let Some(tcf) = consent.tcf.as_mut() { |
There was a problem hiding this comment.
⛏ nitpick — If purpose_one_only_consent() ever stops setting tcf, this fixture quietly returns P1-only consent. Every "with Purposes 1 and 4" test would then fail with a confusing user.id mismatch instead of a clear fixture error. Failing loudly makes the fixture's assumption explicit:
| if let Some(tcf) = consent.tcf.as_mut() { | |
| let tcf = consent | |
| .tcf | |
| .as_mut() | |
| .expect("should have TCF consent in purpose_one_only_consent"); | |
| // Purpose 4 is index 3. | |
| tcf.purpose_consents[3] = true; |
| pub eids: Option<Vec<crate::openrtb::Eid>>, | ||
| } | ||
|
|
||
| impl UserInfo { |
There was a problem hiding this comment.
👍 praise — Funnelling both auction builders through UserInfo::for_auction and reusing allows_eid_persistence gives the EC-to-bidders decision one source of truth. The doc comment spells out why Purpose 1 alone isn't enough and asks future editors to keep the two rules together. The table test covers P1+P4, P1-only, GDPR-without-TCF and non-regulated consent, which pins exactly the boundaries that matter.
Summary
/_ts/page-bidsput it in the bid requestidasts-<EC>, and every auction path setuser.idto the EC whenever EC creation was allowed (Purpose 1 alone under GDPR). Prebid Server can clearuser.idfor a bidder, but never touchesid, and APS does not go through Prebid Server.idis now alwaysts-req-<random>, anduser.idcarries the EC only under the rule that already gates partner EIDs (allows_eid_persistence: Purposes 1 and 4). The gate lives in one place,UserInfo::for_auction, used by both auction request builders, so the Prebid Server and APS bodies inherit it.Base
Targets
main, not the identity stack. Main has the same leak (build_auction_requestbuiltts-{ec_id};/auctionsetuser.idonec_allowed()alone), and Fastly and Cloudflare production derive GDPR jurisdiction from geo, so it is live there.Note for the identity stack: #1640 moves this logic into
set_auction_ec_identityand addsbidder_ec_id. When main is next merged up the stack, keepts-req-<random>for the request id and routeuser.idthroughUserInfo::for_auction(or applyallows_eid_persistencearoundbidder_ec_id).Behavior
id=ts-<EC>(server-side auction, page-bids);user.id= EC (all paths)id=ts-req-<random>; nouser.id; EC nowhere in the bodyuser.id= EC;id=ts-req-<random>user.id= EC if EC alloweduser.id(fails closed, as EIDs already do)user.id= ECuser.id(same rule as partner IDs)user.id= ECThe server-side request id is no longer stable per visitor; anything that correlated auctions by
ts-<EC>loses that.Where the EC can reach an outbound bid body
id, server-side auction and page-bids (publisher.rs)id,/auction(formats.rs)user.id, both buildersUserInfo::for_auctionauction/openrtb.rs), mediator, request signingid/user.iduser.ext.eidsgate_eids_by_consent(same rule)integrations/testlight.rs:111)ts-eccookie into the upstreamuser.idwithout any consent check. Proposed as a follow-up.Out of scope: #1685 (may widen the purpose rule; change both rules together via
allows_eid_persistence) and #1704 (Prebid Server-side scrubbing).Changes
crates/trusted-server-core/src/auction/types.rsUserInfo::for_auction, the singleuser.idgate; unit tests for its branchescrates/trusted-server-core/src/publisher.rsbuild_auction_request: random request id, gated user; update tests that expectedts-{ec_id}crates/trusted-server-core/src/auction/formats.rsconvert_tsjs_to_auction_requestuses the gate; Purpose-1-only testcrates/trusted-server-core/src/auction/openrtb/tests.rsopenrtb::build_requestcrates/trusted-server-core/src/auction/endpoints.rs/auctionhandler tests capturing what providers receivecrates/trusted-server-core/src/auction/test_support.rs,crates/trusted-server-core/src/test_support.rsdocs/guide/edge-cookies.mduser.idand the request id is never EC-derivedCHANGELOG.mdCloses
Closes #1707
Spec
Not a feature
Test plan
cargo test -p trusted-server-core --lib(native host): 3395 passed, 0 failed. Hosted CI runs the full gate list on this PR; it was not run locally.cargo clippy-fastlycargo fmt --all -- --checkCHANGELOG.mdanddocs/guide/edge-cookies.mdcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1mainbehavior; negative controls (below)Tests fail first. Before the fix, 6 of the 7 new tests failed; for example, the Purpose-1-only Prebid Server body was
{"id":"ts-<EC>", … "user":{"id":"<EC>"} …}. The body tests build the request with the real server-side builder, route it, build the actual Prebid Server and APS bodies, and assert the EC's hash appears nowhere in the whole serialized JSON.Negative controls. Removing the
allows_eid_persistencefilter fails 5 tests (including both body tests and the/auctionhandler test); restoringts-{ec}as the request id fails 5 tests.Runtime (Fastly wasm under Viceroy 0.22.0, local). Client IP mapped to Germany (jurisdiction GDPR); Prebid Server and APS providers pointed at a local HTTPS capture server;
/auctionand/_ts/page-bidscalled with a fictional EC cookie and a synthetic TCF cookie. Same requests againstmain(db36dc0) and this branch:/auctionPBS + APS/_ts/page-bidsPBS + APSuser.id= ECid=ts-<EC>,user.id= ECuser.id, EC absentid=ts-req-…, nouser.id, EC absentuser.id= ECid=ts-<EC>,user.id= ECuser.id= ECid=ts-req-…,user.id= EC onlyNo captured request header carried the EC. Not runtime-tested: Cloudflare, Spin and Axum (Axum and Spin have no geo source today, so jurisdiction is Unknown and no EC is forwarded there), and any deployed environment.
Independent review. One local review pass against
mainand the issue: no blocking findings. Its optional findings (rustdoc link to a crate-private item, missing CHANGELOG/doc mention) are fixed in this PR; the Testlight gap is listed above as a follow-up.Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)