Repository navigation
Conversation
…ations When Prebid stores SharedID in a cookie, a consented navigation sets that cookie from the record if the request has none or a different value, and keeps Prebid's <name>_cst consent-hash companion consistent. Unchanged cookies get no Set-Cookie. A denied EC consent or _pubcid_optout expires both cookies, and with TCF Purpose 4 denied the browser's cookie is left alone. Creation is always on with cookie storage: a consented navigation from a reader with no SharedID and no _pubcid_optout gets a random UUID inside the navigation's single page-load write, so it adds no KV write. The sharedid identity provider generates by default with cookie storage (an explicit generate setting is honoured, and it is forced off when Prebid keeps SharedID in local storage only); without that provider the UUID joins browser ingest under the pubcid.org partner. A stored SharedID wins over a different cookie value on both paths: providers can opt into keeps_stored_uids, and the sharedid provider does. Write-back runs after the page-load write, never writes the record, and reads it once when the request has not. Closes #1593 Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
4102c32 to
593cb67
Compare
|
For #1532's rename of the native Geo profile variable to No file in this PR uses the old name after the merge, so it only takes the rename from #1566. The merge had no conflicts. Correction: through #1566, this merge also carries five #1540 commits that #1566 had not merged before (CloudFront forwarding authentication, AWS ingress and Terraform demo prerequisites, the example deployment gate and the deployment guide). It is not only the rename. |
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids from the Prebid config into the auction EIDs, and a99dd66, a62601b, d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30 days from the UTC day start and pass the request time into finalize. They arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623, #1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540 and #1566, with #1536's, #1535's and #1566's moves of their finalize calls onto FinalizeRequest. It also brings d5276ee, which publishes the native AWS runtime files without GNU mv -T, and Christian's merge 5597d3e of #1538 into #1540, which #1566's merge now carries. The base now also carries the Axum serving line (#1613, #1616, #1617, #1615, #1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which decodes the Spin discovery document with Response::json, and #1627's merge of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI. EC finalize docs: a conflict is the ec_finalize_response doc, where this PR described the SharedID argument and #1489 replaced the argument list with FinalizeRequest. The function doc keeps #1489's pointer to FinalizeRequest, and this PR's write-back sentence moves to the FinalizeRequest sharedid field, next to #1628's opt-out sentence, as #1662 words it. EC finalize tests: run_write_back, the helper of this PR's SharedID write-back tests, still used the old finalize arguments. It now passes a FinalizeRequest at the fixed test request time NOW and seeds its live row at NOW_SECS, the same change #1662 makes to this helper. It also brings b2d4bfd from #1488, which records the known UID hashes on lookup results with a setter, so the provider IDs the write planner logs are not derived from them. The base now also carries #1506's repin of EdgeZero to rc/identity at d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly 0.13.3, url 2.5.9 and Viceroy 0.22.0. The base now also carries #1627's 4d0c1a2, which renames the generic runtime KV store to trusted_server_runtime_kv, and #1488's a610152 and 9104fd3, which add hashed-email intake for the LiveRamp and ID5 identity providers. Boxed identity provider: this PR forwards `keeps_stored_uids` and #1488 forwards `hashed_email_path` at the end of the `Box<P>` IdentityProvider impl. The merge keeps both.
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids from the Prebid config into the auction EIDs, and a99dd66, a62601b, d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30 days from the UTC day start and pass the request time into finalize. They arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623, #1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540, #1566, #1624, #1641, #1642 and #1646, with #1646's move of the request time into IdentityApp::finalize. It also brings d5276ee, which publishes the native AWS runtime files without GNU mv -T, and Christian's merge 5597d3e of #1538 into #1540, through #1566's merge. The base now also carries the Axum serving line (#1613, #1616, #1617, #1615, #1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which decodes the Spin discovery document with Response::json, and #1627's merge of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI. This PR already carries #1646's head 461aa0d, so the merge adds only #1646's new merge 166944769 of #1642 and the chain below it, including the identity conformance check that now strips the mirrored UID's exp. It also brings b2d4bfd from #1488, which records the known UID hashes on lookup results with a setter, so the provider IDs the write planner logs are not derived from them. Restacking on the Axum serving line conflicts in the Axum startup tests, where #1617 waits for /ready, since liveness stays up after a caught initialization failure, and this PR rewrites the wait to retry a port collision and to require the child's own ready lifecycle event. Axum startup tests: wait_ready keeps this PR's collision retry and lifecycle check, then probes #1617's /ready and returns the /health response once the child is ready. The fixture drains each child's output through this PR's log readers, so #1617's assert_serves_failure_router reaps the stopped child and reads those captured logs instead of collecting the pipes, which the readers already own. The base now also carries #1506's repin of EdgeZero to rc/identity at d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly 0.13.3, url 2.5.9 and Viceroy 0.22.0. This PR now stacks on #1661 instead of #1646, so rc/identity can take both as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661 (refusing EC creation when a trusted JA4 contradicts the User-Agent). Fastly identity conformance fixture: #1661 records each scenario's runtime TLS JA4 through a RuntimeTlsJa4 middleware in place of derived device signals, takes the User-Agent from the scenario and drops the browser flag. This PR adds geo consent requests with their own trusted client IP settings and no browser device signals. The merge assembles the conformance app with #1661's middleware and keeps this PR's geo_configured flag and producer_settings. It sends the scenario's User-Agent unless the API request supplies one, and inserts the scenario's JA4 only for requests without a geo consent exchange, because this PR derived device signals only for those. The base now also carries #1627's 4d0c1a2, which renames the generic runtime KV store to trusted_server_runtime_kv, #1488's a610152 and 9104fd3, which add hashed-email intake for the LiveRamp and ID5 identity providers, #1646's aa31559, which gates identity writes for rejected clients, and #1626's d07f789, which withholds a mirrored UID while another source owner is opted out. Fastly conformance JA4: the rebuilt #1661 merge supplies a trusted Python JA4 behind the Chrome User-Agent for #1646's known non-browser API requests, and this PR inserts the scenario's JA4 only without a geo consent exchange, with its producer_settings. The merge keeps both: a known non-browser request gets the Python JA4, any other request the scenario's JA4 unless it is a geo consent exchange. This PR's head moves to e8015ca, its clean merge of #1646's aa31559, which the base already carries, so it adds no change beyond the base. Axum lib.rs: the base now carries #1636, through #1626's merge of it, whose after_response_drain_tests module sits where this PR adds its geo_conformance module. The crate keeps both test modules.
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids from the Prebid config into the auction EIDs, and a99dd66, a62601b, d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30 days from the UTC day start and pass the request time into finalize. They arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623, #1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540, #1566, #1624, #1641, #1642 and #1646, with #1646's move of the request time into IdentityApp::finalize. It also brings d5276ee, which publishes the native AWS runtime files without GNU mv -T, and Christian's merge 5597d3e of #1538 into #1540, through #1566's merge. The base now also carries the Axum serving line (#1613, #1616, #1617, #1615, #1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which decodes the Spin discovery document with Response::json, and #1627's merge of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI. The merge also brings the 12 #1646 commits this PR lacked, from 48a43ae to 461aa0d: dhruv8sh's page-phase lookup and /auction EID work (48a43ae, 82fe088, 1d0a74f, 838586e and his chain merges a061c01, ecf16e8, e1d23a0, edcf4c5 and 9a020e1), the merge 9cad928 of #1641 into #1642, and prk-Jr's "Merge providers-awaited into shared identity" (4ffbaf8) and "Restore Fastly auction browser gating" (461aa0d). Edge cookies guide: a conflict is the request lifecycle paragraph. The merge takes #1646's sentences on positive identity cookies, core expiries and /auction body EIDs, and keeps this PR's closing sentences on the default ec.sliding_refresh = false flow and sliding renewal. Fastly adapter tests: 82fe088 from #1646 removed the navigation-lookups thread-local and the page-lookups argument of apply_edgezero_ec_finalize, since the handler now collects page lookups onto the EC context. This PR's sliding_ec_renews_held_publisher_identity_before_terminal_privacy test drops its two take_navigation_lookups calls and passes no page lookups to finalize. Its configuration has no record store or providers, so no lookups were collected before either, and its assertions are unchanged. It also brings b2d4bfd from #1488, which records the known UID hashes on lookup results with a setter, so the provider IDs the write planner logs are not derived from them. The base now also carries #1506's repin of EdgeZero to rc/identity at d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly 0.13.3, url 2.5.9 and Viceroy 0.22.0. This PR now stacks on #1661 instead of #1646, so rc/identity can take both as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661 (refusing EC creation when a trusted JA4 contradicts the User-Agent). Cloudflare route tests: both PRs add a test at the end of the file. The merge keeps both, this PR's sliding_ec_configuration_preserves_unsupported_platform_responses and #1661's ec_route_creates_no_record_whatever_the_bot_management_ja4. Fastly sliding EC test: #1617, which now sits below this PR, answers GET /health through the router's probe hook as an operational response, which carries no EC state. This PR's sliding_ec_renews_held_publisher_identity_before_terminal_privacy routes /health through the router and expected EC state on every path but the unsupported EC route, so it now also accepts the liveness probe without EC state. Its check that /health issues no renewal cookie is unchanged. The base now also carries #1627's 4d0c1a2, which renames the generic runtime KV store to trusted_server_runtime_kv, #1488's a610152 and 9104fd3, which add hashed-email intake for the LiveRamp and ID5 identity providers, #1646's aa31559, which gates identity writes for rejected clients, and #1626's d07f789, which withholds a mirrored UID while another source owner is opted out. Settings: this PR's MaxAgeDays and #1488's HashedEmailSource are both added before Ec in settings.rs; the merge keeps both. This PR's head moves to fbe5670, its merge of #1646's aa31559, which models admitted clients in the core sliding tests, finalizes them with the store gate and adds refused_client_gets_no_renewal_or_record_io, and adds the proposal's review log. Taken as the change from the old head 668d501, the new head would replay #1646 commits the base already carries in rebuilt form. The merge takes only fbe5670's own resolution, the change from a plain merge of 668d501 and aa31559 to fbe5670: the sliding tests and the proposal apply cleanly, and its Fastly sliding test port is the one this merge already made.
…1622 into rc/identity #1622 (244ca26) now carries the whole chain, each PR merging the one below it: - #1506 (c197404) repins EdgeZero to rc/identity at d063a8e7, which carries EdgeZero main's Fastly SDK 0.13.3 upgrade through every EdgeZero PR here, and merges Trusted Server main's upgrade (#1671): fastly 0.13.3, url 2.5.9 and Viceroy 0.22.0. - #1614, #1525, #1526, #1487 and #1488 take it in turn. #1488 also adds b2d4bfd, which records known UID hashes with a setter. - #1489, the identity spine (#1639, #1640, #1612, #1628 and #1623), #1531 and #1532. - The Axum serving line: #1613, #1616, #1617, #1615, #1635, #1637 and #1627, chained, with #1627's b958107 decoding the Spin discovery document with Response::json and #1627's merge of #1625, which brings #1625's Wrangler pin into the chain. - The held line on #1627: #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540, #1566, #1624, #1641, #1642 and #1646. #1646 keeps its own shared after-response runner in ec::app::lookups. - #1636 (72096cd) on #1646 (b5a5f62), draining Axum after-response identity tasks on SIGTERM through #1646's shared runner. - The EC route line on #1636: #1626 (067531e), which merges #1636, the draft #1656, #1661, #1662 and #1622, and through #1622's merge of it, #1620's round-6 head. Each conflict was resolved in the PR that sits higher. This merge is clean. Since the last update the chain also takes #1488's hashed-email intake (a610152 and 9104fd3) and its POST, body and header options for the status call (f063a76), #1627's split of the generic runtime KV store into trusted_server_runtime_kv (4d0c1a2), #1646's gate on identity writes for rejected clients (aa31559) its native container test of the failure router (4f4c036) and that test's header check on an ordinary route (71a573a), #1626's withholding of a mirrored UID while another source owner is opted out (d07f789), and #1617's description of the Axum startup failure router (6d174a8) and of the startup failures that still exit before listening (4c07cad). #1636 no longer sits in the Axum serving line; it arrives through #1626, which merges it on top of #1646. Its new head adopts #1646's after-response runner in place of the one rc/identity took with cf1102c. Cloudflare guide: #1627's merge of #1625 now keeps both #1625's tool version clause and #1627's TRUSTED_SERVER_RUNTIME_KV binding in the smoke paragraph, and fixes #1625's smoke script test for #1617's Python floor and Worker build, and #1537's merge fixes its ts stub for #1537's storage template step, so this merge needs no resolution.
|
For the identity integration branch (#1608), I pushed
|
|
For the identity integration branch (#1608), I pushed |
prk-Jr
left a comment
There was a problem hiding this comment.
Reviewed the PR's own change (593cb67de) against the merge base with feat/axum-identity-providers (7d2eda90f). The later commits are merges of #1566.
The write-back mechanics look right. decide_write_back covers the WB-3 matrix. I checked cyrb53, the handler order (TCF, USP, GPP, COPPA "0") and the hash >>> 8 byte encoding against Prebid's consentHandler.ts and getConsentHash(). The _cst value is URL-encoded on write, and Prebid's getCookie decodes it. keeps_stored_uids is applied after the existing freshness filter and recounts correctly.
Requesting changes for one blocking issue.
Blocking
1. SharedID creation turns on before the localStorage opt-out is visible to the server (SID-2)
Prebid's sharedIdSystem treats a reader as opted out when _pubcid_optout is in either the cookie or localStorage (hasOptedOut() reads both, whatever the configured storage type). The server only sees the cookie. Copying a localStorage opt-out into the cookie is T20 (#1599), which this PR leaves open.
This PR turns creation on by default for every deployment with cookie storage, on two paths:
with_prebid_sharedid_cookiedefaultsgenerate = truefor thesharedidprovider.created_sharedid_updatealways creates for browser ingest, with no setting to turn it off.
Scenario: a reader opted out through localStorage only, with Purposes 1 and 4 granted, opens a page. The server creates a UUID, stores it under pubcid.org, sets _pubcid and _pubcid_cst, and server-side bid requests then carry that ID. Prebid on the page sees the opt-out and suppresses the ID client-side, so the server ends up sending an identifier the reader declined. Before this PR, generation was off by default for exactly this reason. The provider module doc still says so: sharedid.rs lines 22-24, "Generation is off by default: Prebid may keep its opt-out in localStorage, which the server cannot see".
Minimal fix, either of:
- Keep creation opt-in until T20 lands. Leave the provider's
generatedefault off, and gatecreated_sharedid_updatebehind the same setting or an explicit one. - Stack this PR on T20, so the cookie copy of a localStorage opt-out exists before creation turns on by default.
Write-back of an existing stored value doesn't have this problem in the same way, so it can stay as it is.
Non-blocking
2. Stale provider module doc. In crates/trusted-server-identity-providers/src/sharedid.rs, lines 17-18 say "when Prebid later writes a different one, the cookie's ID replaces the generated one". keeps_stored_uids now makes the stored ID win. Lines 22-24 still say generation is off by default.
3. Docs describe write-back for every adapter. edge-cookies.md says a consented navigation writes the cookie back and creates a SharedID. Only the Fastly adapter builds SharedIdRequest::for_write_back. Axum's NativeEcRequest::read still uses from_request, so on Axum write_back is None and there is no creation, write-back or expiry. That matches the issue's scope ("verified on Fastly", Axum in #1581), but the guide should say it is Fastly-only for now.
Verification
cargo test -p trusted-server-core --lib sharedid(host target): 65 passed.cargo test -p trusted-server-core --lib coordinator: 100 passed.cargo test -p trusted-server-identity-providers sharedid: 13 passed.- Checked Prebid's
sharedIdSystem.ts(opt-out read),consentHandler.tsanduserIdgetConsentHash()/setValueInCookiein the repo's pinnedprebid.js. - CI at
bce4943cf: everything passes exceptlocal-provider-image. It fails with the sameinvalid-envelope must not listenassertion inscripts/test-native-container.mjson #1566's head, and this PR touches no startup or container code, so it is pre-existing and unrelated. - Not run: the full CI gate list, Viceroy tests, or a runtime check against a live Prebid page.
| config | ||
| .settings | ||
| .entry(sharedid::GENERATE_SETTING) | ||
| .or_insert(serde_json::Value::Bool(true)); |
There was a problem hiding this comment.
Blocking (see the review body). Defaulting generate to true here means a reader who opted out of SharedID through localStorage _pubcid_optout, which Prebid honours but the server can't see until T20, gets a SharedID created, stored and sent server-side. Please keep this opt-in until T20 lands.
| // A reader with no SharedID anywhere gets one in this write. | ||
| if navigation && let Some(created) = created_sharedid_update(sharedid, registry) { |
There was a problem hiding this comment.
Blocking, same root cause. Browser-ingest creation has no setting at all, so the localStorage opt-out gap affects every cookie-storage deployment, even one without a sharedid provider. Please gate this behind the provider's setting or an explicit one until T20 makes the opt-out visible here.
| //! response writes that cookie back from the row; when Prebid later writes a | ||
| //! different one, the cookie's ID replaces the generated one. When Prebid |
There was a problem hiding this comment.
Non-blocking: with keeps_stored_uids, a different cookie no longer replaces the stored ID; the stored ID wins and is written back. Lines 22-24 below also still say generation is off by default.
|
|
||
| The SharedID cookie follows a similar path but is written directly by Prebid's SharedID module rather than by TSJS. The server reads the cookie named by the `storage.name` of the `sharedId` entry in [`integrations.prebid.managed_user_ids`](./configuration.md), and reads the legacy `sharedId` cookie when no such entry has storage settings. With `storage.type = "html5"` there is no cookie to read. The ID is stored under the `pubcid.org` partner, the source Prebid sends it under, or under a `sharedid.org` partner when only that one is configured. A record that still holds it under `sharedid.org` is moved to `pubcid.org` on its next write, keeping any SharedID already stored under `pubcid.org`. Bidders receive it once, as source `pubcid.org` with `atype` 1, whichever of the record, the cookies or the `/auction` body carried it. A `_pubcid_optout` cookie keeps the SharedID out of the record and out of bid requests. | ||
|
|
||
| When Prebid stores the SharedID in a cookie (`storage.type` `cookie` or `cookie&html5`), a consented top-level navigation writes that cookie back from the EC record if the request carries none or a different value, so the stored SharedID wins. The cookie uses Prebid's `storage.name` and the EC cookie domain, is not `HttpOnly`, and is `Secure; SameSite=Lax` for one year. The response also keeps Prebid's `<name>_cst` consent-hash companion consistent, so Prebid does not rewrite the cookie from script; an unchanged cookie and companion get no `Set-Cookie`. Creation is always on with cookie storage: a consented navigation from a reader with no SharedID and no `_pubcid_optout` gets a random UUID, stored in the same navigation's page-load write (by the `sharedid` identity provider when one is configured, otherwise as a browser-ingested ID), so it adds no KV write. A stored SharedID always wins over a different cookie value, on both paths. With TCF Purpose 4 denied the cookies are left alone; with EC consent denied or `_pubcid_optout` present both are expired. |
There was a problem hiding this comment.
Non-blocking: only the Fastly adapter uses SharedIdRequest::for_write_back. Axum still builds from_request, so it does no creation, write-back or expiry yet. Please say this is Fastly-only for now (Axum follows in #1581).
|
For the identity integration branch (#1608), I pushed |
|
For the identity integration branch (#1608), I pushed Takes #1566's new head baa2e43, which carries #1506's repin of EdgeZero to rc/identity at 1619078a (8edc50e), a revert that removes IABTechLab/edgezero#522 (portable Fastly record providers) and IABTechLab/edgezero#524 (outbound mTLS client identities). The merge is clean. |
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Reviewed PR #1624 at 5ab4e6b3e against its live feat/axum-identity-providers base at baa2e4354. The blockers are in the new consent and opt-out paths, compatibility with Prebid's cookies, and preserving the stored ID across provider configurations. The cleanup comments are marked non-blocking.
All 78 existing focused SharedID tests passed. Fourteen additional Rust probes reproduced the reported behavior through core finalization or the provider coordinator and write planner. Prebid 10.26.0 and cookie-jar checks reproduced the script rewrite and domain mismatch using the server's actual header values. These were not full Fastly or Safari runs.
| /// Without a cookie to write back to, this reads what | ||
| /// [`Self::from_request`] reads. | ||
| #[must_use] | ||
| pub fn for_write_back<B>(storage: &SharedIdStorage, req: &Request<B>) -> Self { |
There was a problem hiding this comment.
R1. Read opt-out across all Cookie fields
A consented request with _pubcid_optout=1 in its second Cookie field still minted a UUID, persisted it, and returned it in Set-Cookie. from_request calls extract_cookie_value, which reads only the first field. The provider joins the fields but treats _pubcid_optout= as absent, while core treats it as present. Use one opt-out presence rule across all fields for both paths.
| .kv_snapshot() | ||
| .entry_for(&ec_id) | ||
| .filter(|entry| entry.consent.ok); | ||
| let stored = entry.and_then(|entry| stored_sharedid(entry, &source)); |
There was a problem hiding this comment.
R2. Honor the source's vendor-consent gate on write-back
With Purposes 1 and 4 granted and the configured vendor denied, the test UID was absent from ordinary EID output but present in the new JavaScript-readable cookie. Check the selected source's existing consent policy before setting either cookie. Deletion should remain independent of that policy.
| ec_context.set_after_response_permit(after_response); | ||
| } | ||
| // Write-back reads the row as the page-load write left it. | ||
| if navigation { |
There was a problem hiding this comment.
R3. Don't write back from a snapshot after losing the conditional write
In the reproduced race, the withdrawal tombstone stayed in KV, but the losing navigation still returned the pre-withdrawal ID. A failed CAS leaves the old Present snapshot intact. Distinguish a known conflict from a no-op and skip value and companion writes on conflict. Cookie expiry can still run, and no KV retry is needed.
| let consent_withdrawn = ec_consent_withdrawn(ec_context.consent()); | ||
|
|
||
| if !consent_allows_ec { | ||
| expire_sharedid_on_denied_consent(settings, sharedid, navigation, response); |
There was a problem hiding this comment.
R4. Expire opted-out browser cookies without requiring an EC record
The opt-out control expired both cookies; the same request expired neither with no graph, EC ID, or registered SharedID partner. EC-denial expiry already happens at this point without those dependencies. Put the request-only opt-out cleanup here too, before record-dependent work.
| .raw_us_privacy | ||
| .as_ref() | ||
| .map_or_else(|| serde_json::Value::Null, |usp| serde_json::json!(usp)); | ||
| let gpp = consent.raw_gpp_string.as_ref().map_or_else( |
There was a problem hiding this comment.
R5. Compute the consent companion from the inputs Prebid actually hashes
For the GPP fixture, Trusted Server hashed the decoded section list and emitted G+tjgQ==; Prebid 10.26.0 hashed the CMP applicability list and expected v1YpWQ==. The no-TC-string case also differed when the CMP explicitly reported gdprApplies=false. Both server hashes triggered Prebid's script-write path. The expected hash prevented it. Carry the CMP hash inputs separately from normalized enforcement data, and treat unavailable inputs as unknown.
| .and_then(|entry| entry.ids.get(source.as_str())) | ||
| .is_some_and(|record| record.has_live_uid(lookup.now)) | ||
| }); | ||
| recount_found(&mut found); |
There was a problem hiding this comment.
R13. Consolidate the cookie precedence checks
Non-blocking. The two flags each filter and recount the same result. When fixing retention, select the precedence policy once and filter/recount once. Preserve the default cookie-wins rule and UID2's expiry-based rule.
| ) | ||
| } | ||
|
|
||
| fn append_set_cookie(response: &mut Response<EdgeBody>, cookie: &str) { |
There was a problem hiding this comment.
R14. Reuse the existing Set-Cookie helper
Non-blocking. ec/cookies.rs:179 already parses, appends, and logs an invalid raw header. Replace these calls with super::cookies::append_cookie and drop the duplicate helper. Keep the SharedID serialization here.
| .or_insert_with(|| serde_json::Value::from(vec![cookie])); | ||
| config | ||
| .settings | ||
| .entry(sharedid::GENERATE_SETTING) |
There was a problem hiding this comment.
R15. Name the provider setup helper after what it does
Non-blocking. with_prebid_sharedid_cookie now defaults generation on with cookie storage and overrides it off for HTML5-only storage. Rename the helper and its callers to apply_prebid_sharedid_storage or equivalent.
| /// configured cookie, and `None` unless Prebid stores it in a cookie, since | ||
| /// Prebid would not read a server-written value from anywhere else. | ||
| #[must_use] | ||
| pub fn write_back_cookie(&self) -> Option<&str> { |
There was a problem hiding this comment.
R16. Keep write-back implementation details private
Non-blocking. This method is only used in this module. GENERATE_SETTING in the provider crate can likewise be pub(super). Keep for_write_back public for adapters and give it the # Examples section required by AGENTS.md.
| pub fn write_back_cookie(&self) -> Option<&str> { | |
| fn write_back_cookie(&self) -> Option<&str> { |
| } | ||
|
|
||
| #[tokio::test(flavor = "current_thread")] | ||
| async fn sharedid_is_not_created_without_consent_storage_or_with_an_opt_out() { |
There was a problem hiding this comment.
R17. Reuse the HTML5-only request fixture
Non-blocking. The HTML5-only request built here is the same as the setup at line 2077. Reuse one fixture and keep the separate behavioral assertions.
Summary
<name>_cstconsent-hash companion consistent, so Prebid does not rewrite the cookie from script, which Safari caps. A_pubcid_optoutcookie or denied EC consent expires both cookies. Denied EID consent (Purpose 4) leaves the browser's cookies alone (SID-2, SID-6)._pubcid_optoutgets a UUID v4, stored in the navigation's single page-load write, so it adds no KV write. Thesharedididentity provider creates it when configured (generatenow defaults to on with cookie storage); otherwise it joins browser ingest under thepubcid.orgpartner. Withhtml5storage only, nothing is created or set.keeps_stored_uids, and thesharedidprovider does, so its cookie no longer replaces a live stored UID.Stacks on #1584's PR (
feat/sharedid-cleanup), which stacks on #1489; review only the commit above it. The SharedID cookie name, opt-out read and canonicalpubcid.orgEID come from that PR.Choices made for this PR
<name>_cstassumes TCF, GPP and USP: the hash is computed the way Prebid computes it with all three consent modules present.Max-Age365 days). It is not taken from Prebid's configuredexpires.generate = falseon thesharedidprovider is honoured.Changes
crates/trusted-server-core/src/ec/sharedid.rs_cstconsent hash, creation of a SharedID for browser ingestcrates/trusted-server-core/src/ec/finalize.rscrates/trusted-server-core/src/ec/provider.rs,ec/coordinator/mod.rskeeps_stored_uidsprovider hook: a live stored UID wins over a cookie UIDcrates/trusted-server-identity-providers/src/lib.rs,src/sharedid.rsgeneratedefaults on with cookie storage and is forced off for local storage; stored ID winscrates/trusted-server-adapter-fastly/src/app.rs<name>_cstcookiedocs/guide/edge-cookies.md,docs/guide/configuration.mdsharedidprovider defaultCloses
Closes #1593
Acceptance criteria, verified on Fastly and in core tests:
Secure; SameSite=Lax, one year._pubcid_optoutgets none.storage.type = html5, the server neither creates nor sets a SharedID.<name>_cstgives noSet-Cookie.<name>_cstre-sets only the companion._pubcid_optout, expires both.Set-Cookieand leaves the browser's cookie alone.extendwith apixelUrlkeeps working alongside it. TheGETthat answerspixelUrlis T19.sharedidprovider.Spec
Spec: server-side identity on every adapter (WB-3, SID-2, SID-5, SID-6, DEC-7); plan task T13.
Test plan
cargo test-fastly && cargo test-fastly-reuse && cargo test-axum && cargo test-cloudflare && cargo test-spincargo clippy-fastly && cargo clippy-axum && cargo clippy-cloudflare && cargo clippy-cloudflare-wasm && cargo clippy-spin-native && cargo clippy-spin-wasm && cargo clippy-cli && cargo clippy-codegencargo fmt --all -- --checkcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serve--test parity,scripts/lint-wasm-clock.sh,ts dev lint domains --changed-vs feat/s2s-eid-collection-providersChecklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)