Skip to content

Read SharedID from Prebid's configured cookie and send it once as pubcid.org - #1628

Draft
dhruv8sh wants to merge 2 commits into
feat/s2s-eid-collection-providersfrom
feat/sharedid-cleanup
Draft

dhruv8sh wants to merge 2 commits into
feat/s2s-eid-collection-providersfrom
feat/sharedid-cleanup

Conversation

@dhruv8sh

Copy link
Copy Markdown
Collaborator

Summary

  • The server reads SharedID from the cookie Prebid's storage.name names, from the managed sharedId / pubCommonId entry, instead of the hard-wired sharedId cookie (SID-1). Prebid's cookie&html5 storage type counts as cookie storage. With html5 only, no cookie is read.
  • A _pubcid_optout cookie stops SharedID from being read into the record, ingested from ts-eids, sent in auction and server-side ad-stack EIDs, or shown as sendable by /_ts/admin/eids (SID-2, cookie part).
  • SharedID is filed and sent once as {source: "pubcid.org", atype: 1} (SID-3). The legacy cookie path now files under the pubcid.org partner. A record still holding sharedid.org is re-filed on its next real write, and the outbound merge dedupes sharedid.org and pubcid.org as one source.
  • Reading, storing and sending SharedID need EID consent (TCF Purposes 1 and 4) on the legacy path too, including the vendor gate for a client-sent sharedid.org EID (SID-6).
  • The template-cache deny list uses the configured SharedID cookie name, not sharedId (WB-5).

Stacks on #1489 (feat/s2s-eid-collection-providers); review only the two commits above it.

Choices made for this PR

  • The legacy path is retargeted, not removed: it keeps reading the cookie when no sharedid identity provider owns pubcid.org.
  • Settings::sharedid_storage() parses the Prebid config on each call. Fastly resolves it once per sandbox in AppState; the other adapters call it only for /_ts/admin/eids.
  • Re-filing sharedid.org rides along with a write the row already needs, so it adds no KV write.

Changes

File Change
crates/trusted-server-core/src/ec/sharedid.rs New: SharedIdStorage from Prebid's config, SharedIdRequest (cookie value and opt-out), canonical source, re-filing and opt-out filtering helpers
crates/trusted-server-core/src/settings.rs sharedid_storage(); validates the template-cache key cookies against the configured name
crates/trusted-server-core/src/cookies/template_cache_policy.rs, constants.rs Deny the configured SharedID cookie instead of sharedId
crates/trusted-server-core/src/ec/finalize.rs, ec/prebid_eids.rs, ec/write_plan.rs, ec/eids.rs Read the configured cookie, skip it on opt-out, file under pubcid.org atype 1, re-file sharedid.org
crates/trusted-server-core/src/auction/endpoints.rs, publisher.rs One canonical SharedID EID; none for an opted-out reader; vendor gate for legacy client EIDs
crates/trusted-server-core/src/ec/admin.rs Read the configured cookie; report sharedid_opted_out
crates/trusted-server-core/src/integrations/prebid.rs, crates/trusted-server-js/lib/src/integrations/prebid/index.ts Accept and forward cookie&html5
crates/trusted-server-identity-providers/src/lib.rs The sharedid provider reads Prebid's configured cookie name
crates/trusted-server-adapter-* Carry the SharedID cookie name and request state
docs/guide/* Configured cookie name, opt-out and canonical EID

Closes

Closes #1584

Acceptance criteria:

Spec

Spec: server-side identity on every adapter (SID-1, SID-2, SID-3, SID-6, WB-5); plan task T3.

Test plan

  • cargo test-fastly && cargo test-fastly-reuse && cargo test-axum && cargo test-cloudflare && cargo test-spin
  • cargo 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-codegen
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: CLI tests, integration --test parity, scripts/lint-wasm-clock.sh, ts dev lint domains --changed-vs feat/s2s-eid-collection-providers

Checklist

  • Feature PRs: spec linked above, ending in a review log of two or more agent review rounds
  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Prebid treats cookie&html5 as cookie storage plus local storage. SharedID write-back counts it as cookie storage, so the config must accept it and forward it to Prebid unchanged.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…cid.org

The server read a cookie hard-named sharedId and filed it under sharedid.org. It now reads the cookie named by the storage.name of the sharedId managed User ID entry, keeps reading sharedId when no entry has storage, and reads none when Prebid keeps SharedID in local storage only. The admin EIDs echo on every adapter and the template-cache key deny list use the same name.

SharedID is filed under the pubcid.org partner, or under sharedid.org when only that one is configured. A record still holding it under sharedid.org is moved to pubcid.org on its next write, and the stored value wins. Bidders receive it once, as source pubcid.org with atype 1, whether it came from the record, the cookies or the auction body, and a sharedid.org browser EID follows the pubcid.org vendor gate.

A _pubcid_optout cookie keeps SharedID out of the record, the ingestion preview and bid requests. Storing and sending it already needed TCF Purposes 1 and 4; tests now cover SharedID for both.

Closes #1584

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
@dhruv8sh dhruv8sh self-assigned this Nov 18, 2026
@dhruv8sh
dhruv8sh added this pull request to stack #1621 November 18, 2026 16:10
@dhruv8sh
dhruv8sh removed this pull request from stack #1621 November 18, 2026 16:50
@dhruv8sh
dhruv8sh added this pull request to stack #1630 November 18, 2026 16:50
@dhruv8sh
dhruv8sh marked this pull request as draft November 18, 2026 17:01

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SharedID cleanup: legacy path, cross-source dedupe, re-filing, SID-6 gate, template-cache deny list

1 participant