Skip to content

Add identity providers for ID5, LiveIntent, LiveRamp, ConnectID and UID2 - #1488

Open
dhruv8sh wants to merge 115 commits into
feat/s2s-eid-collection-corefrom
feat/s2s-eid-vendors
Open

dhruv8sh wants to merge 115 commits into
feat/s2s-eid-collection-corefrom
feat/s2s-eid-vendors

Conversation

@dhruv8sh

@dhruv8sh dhruv8sh commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1487.

Summary

  • Adds server-side identity providers for ID5, LiveIntent, LiveRamp, Yahoo ConnectID, UID2, Prebid SharedID, Criteo and Unified ID (TDID). Each one plugs into the S2S EID collection framework from Collect server-side identity provider EIDs in a single page-load write #1487.
  • Adds a Lockr cookie capability, so a provider can take its ID from a Lockr-managed first-party cookie.
  • Adds the framework hooks the providers need. They could move into Collect server-side identity provider EIDs in a single page-load write #1487 if reviewers prefer:
    • providers can read their own first-party cookies, including every duplicate of a cookie name for opt-out checks
    • provider builds get the configured provider ID
    • lookups can read cookies and build an EID ext
    • providers can name sources they exclude where GDPR applies
    • a failed lookup logs its HTTP status

Per vendor

Provider Source Lockr capability
ID5 ID5 first-party cookie (including encoded cookies), else the /gs/v2 fetch API with an RFC 3339 ts and gpp_sid as an array; carries linkType and keeps ext; a universal_uid of 0 is an opt-out Yes
LiveIntent Lookup API that sends the LiveIntent first-party cookie; partner IDs are marked; needs a did- distributor ID; segments only when non-empty No
LiveRamp First-party envelope cookie (_lr_env, or the bare envelope Prebid stores in idl_env); with an endpoint, placement_id and custom_id_namespace, a visitor without a cookie is looked up server side by Custom ID Yes
ConnectID Yahoo's connectId first-party cookie; no server call No
UID2 First-party token cookie; with an endpoint, the token is refreshed server side before it expires Yes
SharedID Prebid _sharedid / _pubcid cookie as an atype 1 EID; honours _pubcid_optout; with generate = true (default off), generates a UUID stored only in the row No
Criteo cto_bidid cookie, stored verbatim as the atype 1 EID Prebid sends No
Unified ID TDID from the pbjs-unifiedid cookie, with rtiPartner ext and adserver.org inserter/matcher, mm 4 No

Consent and cookie handling

  • UID2 is excluded where GDPR applies, based on the visitor's detected jurisdiction. UID2 is not looked up there, UID2 IDs LiveIntent resolves are dropped, and UID2 IDs already stored in the row are removed.
  • A vendor cookie fills only the sources it covers; the provider's other due sources are still looked up, and the two results are merged.
  • The lookup rate limit is checked only once a request is built, so cookie-only providers use no budget.
  • Cookie readers try each value in turn, skipping empty values and IDs that have already expired; opt-out checks look at every duplicate of a cookie.
  • Cookie-supplied expiry is bounded, and vendor cookie opt-outs remove stored IDs.

Known limitations

  • ConnectID and SharedID opt-outs kept in localStorage are invisible to the server. A leftover connectId cookie is still read until it expires, and SharedID generation should be enabled only where the opt-out lives in the _pubcid_optout cookie.
  • LiveRamp server-side lookup needs Custom ID enabled on the placement and the publisher's namespace; it has not been tested against LiveRamp yet.
  • Logged-in and hashed-email inputs are not used by any provider.
  • Capturing Lockr responses is not supported.

The plans list the remaining unported reference behaviours.

Changes

Area Change
crates/trusted-server-identity-providers/src/{id5,liveintent,liveramp,connectid,uid2,sharedid,criteo,unifiedid}.rs Provider implementations and tests
crates/trusted-server-identity-providers/src/common.rs Shared helpers: cookie name lists, Lockr cookie capability, parsing
crates/trusted-server-core/src/ec/provider.rs, ec/coordinator/ Framework hooks for own-cookie reading, provider ID, EID ext, cookies in lookups, GDPR source exclusion, cookie/lookup merging, and HTTP status logging
crates/trusted-server-core/src/settings.rs, adapter-fastly/src/app.rs Passes the provider ID and registers providers
trusted-server.example.toml Example provider config, using example.com hosts except LiveIntent's fixed attribute sources
docs/guide/configuration.md, docs/guide/api-reference.md Provider configuration docs
docs/superpowers/plans/2026-11-02-identity-provider-*.md One plan per provider plus the Lockr capability

Closes

Part of #1567 and #1245; #1489 closes #1567. SID-5 (a stored SharedID wins over a cookie read) is delivered higher in the stack by #1624 (#1593).

Spec

The spec is in #1487. This PR adds only plans, no new spec.

Test plan

  • cargo test-fastly && cargo test-fastly-reuse && cargo test-axum && cargo test-cloudflare && cargo test-spin
  • All 8 clippy aliases
  • cargo fmt --all -- --check
  • Parity tests, plus the template_build_digest test and its clippy run
  • scripts/lint-wasm-clock.sh
  • JS vitest, format and lint
  • Docs and markdown prettier
  • ./scripts/test-cli.sh, the node pin guard, docs-proposal scripts, and ts dev lint domains against the base branch
  • Local run against ID5's public test partner: the /gs/v2 fetch returned an ID that was stored in KV and attached to the auction
  • Local run reading a real LiveRamp envelope cookie into KV
  • LiveRamp server-side Custom ID lookup against LiveRamp (pending placement setup)
  • UID2 refresh against the UID2 service

Checklist

  • Changes follow AGENTS.md conventions
  • No unwrap() in production code
  • Uses log macros
  • New code has tests
  • No secrets or credentials committed

@jwrosewell

Copy link
Copy Markdown
Collaborator

@dhruv8sh, the same point as on #1487. Directionally, eight identity vendors as files in one shared crate is not compatible with V2 (the 55 pull requests tracked in #777, merged in order), where each vendor is a module in a folder of its own at identity/<vendor> with its own named maintainer, so each provider owns and maintains its module.

The V2 spec is identifier-modules, with the folder layout in integrations-crate, both in #1342. The associated pull request is #1382 (a module hands core its identifiers, starting with the Prebid EID cookie).

Could you evaluate the V2 spec and #1382 before progressing this pull request?

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Adds eight vendor identity providers and the coordinator hooks they need. Two opt-out handling defects and two UID2 refresh-lifecycle defects need correction before merging.

One inline comment carries a one-click GitHub suggestion. Use Commit suggestion or Add suggestion to batch to apply it. The other fixes need manual changes across files or outside the diff.

Blocking

🔧 wrench

  • UID2 SDK opt-outs leave cached tokens active — see inline at crates/trusted-server-identity-providers/src/uid2.rs:347–349 (suggestion).
  • LiveRamp's 204 opt-out never reaches its parser — see inline at crates/trusted-server-identity-providers/src/liveramp.rs:265–267.
  • Overdue UID2 refresh credentials are permanently discarded — see the body-level finding below.
  • A stale cookie rolls back a refreshed UID2 token — see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:602–610.

Cross-cutting / body-level findings

🔧 wrench — Overdue UID2 refresh credentials are permanently discarded

References: crates/trusted-server-identity-providers/src/uid2.rs:173–176 and crates/trusted-server-core/src/ec/coordinator/validate.rs:151–155.

Two focused reproductions expose the same underlying problem:

  • Importing a still-live identity after refresh_from drops its refresh credentials, so subsequent navigations cannot refresh it.
  • If a refresh times out while the cookie repeats the stored token, validation drops the cookie's already-due refresh state. The cookie result survives the failed lookup and replaces the stored record without refresh credentials; future attempts stop.

Due refresh state must remain usable rather than becoming invalid merely because its scheduled time passed. The proposed validation change is:

        Some(from) if usable => Ok(stored.with_refresh(KvRefresh {
            state: refresh.state.into_owned(),
            from,
        })),

Apply manually — the actual guard is outside a diff hunk; its documentation and existing test expectations also need updating. Retain the existing state-size checks and use the configured lookup rate limit to control retries. If the future-only policy is retained for lookup replies, distinguish cookie ingress instead of discarding its already-due credentials.

Verification

  • Existing provider unit tests: 91 PASS locally.
  • Five focused scratch reproductions confirmed the four findings on the reviewed head. The SDK opt-out regression passes with the suggestion applied in isolation.
  • Exact suggestion bytes pass cargo fmt --all -- --check, all eight clippy aliases, cargo check-fastly, cargo check-axum, cargo check-cloudflare, all four adapter test aliases, cargo test-fastly-reuse, and the cross-adapter parity suite.
  • The initial local Fastly attempt used Viceroy 0.17 and failed on an unsupported host import; rerunning with the repository-pinned Viceroy 0.21.0 passed.
  • Byte-exact post-verification patch comparison: PASS. Scratch changes were discarded; the reviewer worktree is clean at the reviewed head.

Coverage: provider/coordinator implementations were read fully; large supporting files were reviewed through diffs and relevant context rather than exhaustively end-to-end. No live vendor service testing was performed. The prose fix sketches were not applied.

CI Status

No required checks were reported for this branch.

@aram356 aram356 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This adds eight vendor identity providers and the coordinator hooks they need. Four things block it. The coordinator's cookie path rewrites unchanged IDs while another source is due, which also loses refresh state. Criteo's ID differs from what Prebid sends. LiveRamp's server lookup cannot parse the v2 reply. And ID5's gpp_sid type needs an answer. This round does not repeat the four findings of the earlier review at this head; where a finding here extends one of them, the comment says so.

4 of the inline comments below carry a one-click GitHub suggestion. Use Commit suggestion, or Add suggestion to batch for several at once. The other comments describe the fix in prose, because it touches several files or lines outside the diff.

Blocking

🔧 wrench

  • Cookie IDs that repeat the held UIDs are rewritten while another source is due (a KV write on every navigation, and refresh state lost after a failed refresh): see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:599-612
  • The Criteo bid ID is stored percent-encoded, but Prebid sends it decoded: see inline at crates/trusted-server-identity-providers/src/criteo.rs:92-102
  • The LiveRamp Custom ID lookup cannot parse a v2 envelope reply (also atype and gpp_sid): see inline at crates/trusted-server-identity-providers/src/liveramp.rs:272-273

❓ question

  • Does /gs/v2 take gpp_sid as an array?: see inline at crates/trusted-server-identity-providers/src/id5.rs:182-183

Non-blocking

♻️ refactor

  • The Lockr capability reads nothing with its defaults: see inline at crates/trusted-server-identity-providers/src/common.rs:284-287
  • Say which client settings put the token in a cookie (UID2 and ID5; suggestion): see inline at trusted-server.example.toml:243-247
  • Send IPv6 addresses as ipv6 (ID5): see inline at crates/trusted-server-identity-providers/src/id5.rs:360-364
  • Match Prebid's ConnectID validity rules: see inline at crates/trusted-server-identity-providers/src/connectid.rs:108-118
  • Prebid sends the resolved Trade Desk ID as atype 1 (suggestion): see inline at crates/trusted-server-identity-providers/src/liveintent.rs:355-372
  • Compare more than the UID strings: see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:832-854
  • Providers now read the clock: see inline at crates/trusted-server-identity-providers/src/common.rs:337-339
  • Plans and docs that contradict the code: see the body-level finding below

🤔 thinking

  • Cookie and consent-derived opt-outs now get the 30-day lockout: see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:560-565
  • A placeholder ID reads as "no ID", not as an opt-out: see inline at crates/trusted-server-identity-providers/src/common.rs:153-159
  • Structure of this PR: see the body-level finding below

⛏ nitpick

  • exclude_sources keeps the pre-exclusion kept count (suggestion): see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:770-772
  • Where GDPR applies, UID2 is skipped for region, not consent (suggestion): see inline at crates/trusted-server-identity-providers/src/uid2.rs:34-35

🌱 seedling

  • A generated SharedID changes every 30 days: see inline at crates/trusted-server-identity-providers/src/sharedid.rs:131-142
  • Smaller gaps: see the body-level finding below

Cross-cutting / body-level findings

♻️ Plans and docs that contradict the code

The plans say "Status: Implemented", but several statements no longer match the code:

  • 2026-11-02-identity-provider-uid2.md, "Stored ID": the token "is refreshed only when the cookies no longer yield a usable token". Since 25f35720b, it is also refreshed while the cookie repeats it.
  • 2026-11-02-identity-provider-uid2.md, risk note: "a server refresh spends the SDK cookie's refresh token ... the browser SDK's own refresh of that identity may then fail". A refresh token is not spent. The operator's UIDOperatorService.refreshIdentity has no replay check, and the UID2 token docs say "Refreshing a UID2 token does not invalidate/expire the original or previous UID2 token". The server refresh and the SDK refresh both succeed and fork into two token chains. Combined with the stale-cookie rollback from the earlier review, that can repeat the refresh about every other navigation until the cookie's identity_expires, bounded only by rate_limit_per_hour (inferred).
  • 2026-11-02-identity-provider-liveramp.md: the goal and architecture still say "no server call" and "build_request always fails", and "Stored ID" documents 200 {"envelope"} (see the LiveRamp comment).
  • 2026-11-02-identity-provider-id5.md: an opted-out universal_uid of 0 "is reported as LookupOutcome::NoMatch". The code reports OptedOut.
  • 2026-11-02-identity-provider-connectid.md: "The provider reads no clock". is_expired reads it.
  • 2026-11-02-identity-provider-liveintent.md: "The Expires header becomes ProviderExpiry::At". The code produces After(Expires - Date).
  • 2026-11-02-identity-provider-criteo.md, criteo.rs:4-6 and the example config: "still percent-encoded" (see the Criteo comment).
  • docs/guide/configuration.md:836: allowed_domains is marked required, but cookie-only kinds without an endpoint do not need it, and the field has #[serde(default)].

🤔 Structure of this PR

jwrosewell's question on this PR about the V2 layout (one module per vendor under identity/<vendor>, each with its own maintainer; #1342 and #1382) is still unanswered. Independent of that answer, this PR combines framework changes with eight vendors in 7.2k lines. The description offers to move the framework hooks into #1487. Doing that, and landing the vendors as separate PRs, would let each vendor's fidelity be reviewed and verified against its own service on its own.

🌱 Smaller gaps

  • validate.rs:171 clamps absolute expiries to 30 days but leaves ProviderExpiry::After unbounded in core. Every provider here bounds it itself, so this is defense in depth.
  • The adapter's joining of multiple Cookie headers into RequestCookies (crates/trusted-server-adapter-fastly/src/app.rs:433-439) has no test, and the adapter tests pass RequestCookies::default().
  • id5.rs defines the same "0" twice, as OPTED_OUT_UID (line 71) and OPT_OUT_UID (line 415).

Verification

  • Every changed file was read at 25f35720b. Vendor behaviour was checked against Prebid.js master modules, LiveRamp's ATS Envelope API docs, ID5's Prebid Server Java module, uid2-web-integrations and uid2-operator. No live vendor calls were made.
  • The coordinator findings were reproduced with probe tests that run dispatch, collect and plan_write. The fix proposed at mod.rs:599-612 makes both blocking probes pass, and all existing ec:: tests and the 91 provider tests still pass (native run). The Criteo and ID5 ipv6 prose fixes were compiled and tested in a scratch tree; the other prose sketches were not applied.
  • Each suggestion was applied on its own at this head, and its patch was byte-identical before and after the checks:
    • liveintent.rs (TDID atype): cargo fmt --check, clippy-fastly, check-fastly, check-axum, check-cloudflare, test-fastly.
    • coordinator/mod.rs (kept count): cargo fmt --check, clippy-fastly, clippy-axum, clippy-cloudflare, clippy-cloudflare-wasm, clippy-spin-native, clippy-spin-wasm, clippy-cli, the three check-* aliases, test-fastly, test-fastly-reuse, test-axum, test-cloudflare, test-spin, and the parity suite.
    • uid2.rs (module doc): cargo fmt --check, clippy-fastly.
    • trusted-server.example.toml: every added line is a comment.
    • All four together: cargo fmt --check, clippy-fastly, native core and provider tests.

CI Status

  • CI Node pin guard: PASS
  • CLAUDE.md symlink guard: PASS
  • HTML EOF runtime (Fastly): PASS
  • browser integration tests: PASS
  • cargo check (cloudflare native + wasm32-unknown-unknown): PASS
  • cargo check/build/test (spin native + wasm32-wasip1): PASS
  • cargo fmt: PASS
  • cargo test: PASS
  • cargo test (axum native): PASS
  • cargo test (cross-adapter parity): PASS
  • cargo test (ts CLI, native) (macos-latest): PASS
  • cargo test (ts CLI, native) (ubuntu-latest): PASS
  • docs-proposal scripts: PASS
  • format-docs: PASS
  • format-typescript: PASS
  • integration tests: PASS
  • integration tests (Fastly EC lifecycle): PASS
  • prepare integration artifacts: PASS
  • trace runtime and browser acceptance: PASS
  • ts dev lint domains (changed lines): PASS
  • vitest: PASS
  • worker-deadlines (cloudflare): PASS
  • worker-deadlines (spin): PASS

No required checks are configured for this base branch.

Comment on lines +284 to +287
reader.lockr = names
.into_iter()
.filter(|name| !reader.own.contains(name))
.collect();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ refactor: The Lockr capability reads nothing with its defaults

with_lockr drops Lockr names that are already in own, and every Lockr default equals that kind's own default: id5id for ID5, _lr_env for LiveRamp (own default ["_lr_env", "idl_env"]) and __uid2_advertising_token for UID2. So [settings.lockr] enabled = true with the defaults reads no extra cookie. Neither do the three Lockr tables in trusted-server.example.toml, which repeat the own names. An operator who turns Lockr on sees no change.

With custom names, [settings.lockr].cookie_names behaves exactly like appending those names to cookie_names: same parser, same order, read before any lookup. The only difference is a debug log line. That is a trait, a settings type, reads_lockr, gating tests, a plan and docs, with no behaviour beyond cookie_names.

Suggest removing the capability and documenting "add the Lockr key to cookie_names" until there is Lockr-specific behaviour, for example provenance through inserter, or the revoke-consent opt-out the Lockr plan lists as not ported. If it stays, the example tables should use a key that differs from the own cookies, and the docs should say the default Lockr keys are already read as own cookies.

@dhruv8sh dhruv8sh Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capability stays, and f68083c changes it:

  • The example tables now use Lockr keys that differ from the vendors' own cookies. The docs say the default Lockr keys are already read as own cookies, so enabling the capability with the defaults reads nothing extra.
  • Lockr-specific behaviour: Lockr cookies are not read where GDPR applies. Prebid's lockrAIMIdSystem stops when gdprApplies is true, so a Lockr cookie on such a request is a leftover, not a current delivery. Own cookies are still read there.

inserter provenance and revoke-consent are not ported. Lockr's storage holds neither: per the Prebid module, it stores the raw advertising_token under the configured key_name, and its own keys are localStorage only. Both exist only in Lockr API responses, which the framework does not capture. The plan records this.

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This round covers areas the two earlier reviews at this head did not reach: the auction read path, untrusted response handling in the providers, and the CLI's provider validation. It found two new blocking problems. UID2 IDs that the GDPR exclusion removes can still reach bidders. A large LiveIntent segments list drops LiveIntent's own ID. The earlier findings are not repeated here.

Blocking

🔧 wrench

  • UIDs the GDPR exclusion removes are still sent to bidders: see inline at crates/trusted-server-core/src/ec/coordinator/mod.rs:361
  • A large LiveIntent segments list drops nonId: see inline at crates/trusted-server-identity-providers/src/liveintent.rs:337-346

Non-blocking

🤔 thinking

  • ID5 never sends back the previous signature: see inline at crates/trusted-server-identity-providers/src/id5.rs:21

⛏ nitpick

  • ID5 percent-decodes the fetch reply before the opt-out check: see inline at crates/trusted-server-identity-providers/src/id5.rs:390
  • RequestCookies Debug prints the whole Cookie header: see inline at crates/trusted-server-core/src/ec/provider.rs:168

Verification

  • The findings were reproduced with probe tests in a scratch tree at 25f35720b: an auction-read probe for the GDPR finding, plus probes for the LiveIntent ext size and the ID5 reply decoding. The ID5 signature point is not checked against ID5's docs or a live call.
  • cargo test -p trusted-server-core --lib ec:: (native): 523 passed.
  • Checked and found sound: CheckedAppConfig (no provider reads secrets at build, so validating before secrets resolve is safe); checking the rate limit only once a request is built; cookie and lookup merging; an unknown jurisdiction failing closed; endpoint: None (every request is still checked against allowed_domains); UID2 refresh decryption and its panic paths; response size caps; and identifiers going only to the configured endpoint.
  • No live vendor calls were made. The fixes are prose sketches and were not applied.

CI Status

All 23 checks PASS at 25f35720b, including cargo test, cargo fmt, cross-adapter parity, axum/cloudflare/spin, ts CLI (macOS and Ubuntu), integration and browser integration tests, Fastly EC lifecycle, vitest and the format jobs. No required checks are configured for this base branch.

@dhruv8sh

dhruv8sh commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Re: review 5814450927 (ChristianPavilonis)

Fixed in 5c0bca7. Validation now keeps refresh state whose from has passed, so the source stays due. This covers a live identity imported after refresh_from and a held record after a failed refresh. The size and empty-state checks are unchanged, and rate_limit_per_hour bounds the retries. The validate test now expects due state to be kept.

Re: review 5821978901 (aram356)

Plans and docs: fixed in 7b60dd6, with the UID2 risk note rewritten in 8f575ad. Token chains: a server refresh and an SDK refresh do fork, as you describe. Since 7667acf an older cookie no longer rolls the refreshed token back, and since 5c0bca7 a failed refresh keeps the state. Once the SDK refreshes, its newer cookie token replaces the stored one, so the row follows the SDK chain again instead of alternating on every navigation. What remains is one server refresh per refresh_from interval while the SDK has not refreshed, bounded by rate_limit_per_hour. Operators running the SDK with useCookie: true can leave endpoint unset. The UID2 plan states this risk.

Structure: No. We are keeping this as a stack instead: #1487 holds the framework and this PR the vendors. The coordinator hooks that only the vendors use (cookie reads, refresh freshness, Lockr) stay here, next to the code that needs them.

Smaller gaps:

  • 89e0e17 clamps ProviderExpiry::After to 30 days in validation.
  • 579932d adds a Fastly adapter test that several Cookie headers are joined and read by providers.
  • OPT_OUT_UID / OPTED_OUT_UID in id5.rs are now one constant (7b60dd6).
  • allowed_domains is now optional in the guide table, needed only with endpoint.

@dhruv8sh
dhruv8sh added this pull request to stack #1563 November 12, 2026 13:08
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Add an optional IdentityProvider::read_request_cookies step that runs for providers with due sources before any lookup. Cookie IDs pass the same consent gates, validation and write plan as lookup results and replace the lookup. The provider endpoint becomes optional so cookie-only kinds need none; lookup kinds reject a missing endpoint.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Takes #1487's new head 4944050, which carries #1506's repin of EdgeZero to
rc/identity at 459bd27d (42e0c46): PR 275 at 0e2a58ae, the stack's test
fixes and EdgeZero 536's bounded record update, RecordHandle::update.

The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 8148ac673, a merge of #1487's new head 4944050bc, which brings #1506's repin of EdgeZero to rc/identity at 459bd27d (42e0c46c7): EdgeZero #275 at 0e2a58ae, the EdgeZero stack's test fixes and EdgeZero #536's bounded record update, RecordHandle::update. The merge had no conflicts.

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Follow-up to my earlier change request at 4fd9bd8d9. This PR adds the vendor identity providers and their cookie, refresh and consent hooks. Since that review it has also added: the hashed-email intake for LiveRamp and ID5, forwarding of ortb2.user.ext.eids from the Prebid shim, egress suppression and revocation markers for vendor-cookie opt-outs, and lookups on the navigation that mints the EC. All four earlier blockers are resolved at 8148ac673, and I found no new blocking defect in the delta. Approving.

Earlier findings

  • P1: enabled providers failed CLI validation. Resolved. 149418cf5 removes reject_providers_without_a_kind. f500c5249 leaves the registered-kind check to the provider crate, which builds each provider. 87cb1aa13 makes ProviderlessAppConfig reject enabled providers for non-Fastly push/diff targets. checked_app_config.rs covers success, unknown-kind and adapter cases.
  • P1: identify bypassed the GDPR source exclusion. Resolved. identify.rs:100-102 now also checks partner.excluded_for(...), and a73656f68 adds the request's cookie opt-outs. Broken control: removing the excluded_for term makes handle_identify_withholds_a_source_excluded_where_gdpr_applies fail.
  • P1: an unchanged cookie reversed a server opt-out. Resolved by e5303bf1c. The row now stores opt_out_uids hashes taken at dispatch, and a cookie that repeats only those UIDs no longer forgets the opt-out. Broken control: disabling the repeats_opted_out branch makes an_unchanged_cookie_keeps_a_server_opt_out_until_a_renewed_id_arrives fail.
  • P2: ID5 read the wrong partner's cookie payload. Resolved by 8e308e548. partner_reply selects pbjs[partner_id] for both the ID and the opt-out check, and a cookie without pbjs keeps the legacy single-reply path. There are tests for a shared cookie and for a missing partner.

The opt-out items in the other change request (#1602, #1603, #1604) are also addressed, by e5303bf1c, a73656f68 and 880a308d6. I read each of them for this pass.

Non-blocking

  1. The status call runs on every navigation for a signed-out LiveRamp visitor. See inline at ec/coordinator/mod.rs:1000.
  2. The PR description is stale. The LiveRamp row and the Known limitations still describe the Custom ID lookup (custom_id_namespace) and say no provider uses hashed-email input. The code, guide and plan now use the hashed-email envelope lookup (it=4) and refresh (it=19), and they removed Custom ID. The Consent section also predates the cookie opt-out egress and revocation changes. Reviewers working from the description will get the wrong LiveRamp behaviour.

Verification

  • Pinned head 8148ac6735e3bd747a5f87a79504e1b0666e6a00, base feat/s2s-eid-collection-core at 4944050bc (also the merge base).
  • Ran natively: cargo test -p trusted-server-identity-providers --lib --locked (126 passed) and cargo test -p trusted-server-core --lib --locked -- ec:: auction::endpoints (672 passed). Both broken controls above failed as expected, and both edits were reverted.
  • Read in full: the delta since 4fd9bd8d9 (27 PR commits; the six Merge PR #1487 commits are base sync). That covers the hashed-email settings, the status call and dispatch split, the LiveRamp/ID5 request changes, the Fastly PageIdentityDispatch join, apply_cookie_opt_outs and its egress filters (publisher auction, page-bids, /auction, identify), the revocation write-plan check, and the Prebid shim EID merge.
  • Not re-audited line by line: the unchanged parts of the provider files and plans, which I covered in earlier passes.
  • Not verified at runtime: that the status call overlaps the origin fetch on Fastly. EdgeZero's Fastly batch polls asynchronously, but I did not run it under Viceroy. I made no live vendor or status-endpoint calls.
  • CI on the head: all 25 reported checks pass.

Takes #1487's new head 59161a5, which carries #1506's repin of EdgeZero to
rc/identity at 1619078a (8edc50e), a revert that removes EdgeZero 522
(portable Fastly record providers) and 524 (outbound mTLS client
identities).

The merge is clean.

Cargo.lock is re-resolved after the merge so it passes --locked; only
package sources change.
@aram356

aram356 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed b990702ea.

Takes #1487's new head 59161a5, 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.

Cargo.lock is re-resolved after the merge so it passes --locked; only package sources change.

Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
PR #1487's new head brings the cascaded owner review fixes from #1525 and #1526. The merge is clean.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving so this isn't waiting on me, on the understanding that the comments below get handled before this reaches main.

All 15 of my earlier requests are addressed, and the LiveRamp Custom ID one is moot now that the lookup is gone. The first inline comment (revocation pruning in plan_write) is a real bug that the #1604 fix introduced. I'd want it fixed with a regression test before merge.

Not tied to a line:

  • PR scope. 1f054c698 makes the Prebid shim forward ortb2.user.ext.eids for every Prebid deployment, provider or not. Details inline. Separately, the title lists five vendors and the body lists eight. The body doesn't mention the hashed-email intake ([ec.hashed_email], HashedEmailPath, the status call), still describes the removed LiveRamp Custom ID lookup (custom_id_namespace), and says no provider uses hashed email. Please update both.
  • Open threads. prk-Jr's #1602 thread at coordinator/mod.rs:913 looks fixed and can be resolved. aram356's Lockr thread at common.rs:333 is still open.

Questions:

  • The status call forwards the visitor's whole Cookie header to [ec.hashed_email].endpoint, and validation only requires https and a host. Should that be limited to the publisher domain or an allowlist?
  • Has anyone confirmed the hashed-email status call actually overlaps the origin fetch on Fastly? It's in a join with handle_publisher_request (app.rs:1218-1241), which only helps if EdgeZero's Fastly batch polls asynchronously.
  • A cookie opt-out that removes nothing records no revocation (write_plan.rs:185-199), so a concurrent in-flight lookup can still store an ID for that provider until the next navigation clears it. Egress suppression covers the gap, so I think that's acceptable, but flagging it.

// An opt-out recorded after the lookup was dispatched, which a cookie
// opt-out leaves only as a revocation, supersedes its results. An
// opt-out of its own still applies.
let superseded = entry.revocations.get(&lookup.provider).copied()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] A revocation older than a day discards this provider's results on every navigation

Dispatch copies the row's revocations without pruning (coordinator/mod.rs:814-816). plan_write prunes revocations older than REVOCATION_MEMORY_SECONDS at line 71, before applying lookups. This check then compares the pruned row (None) with the dispatch value (Some(t0)), sees a difference, and drops the result. Pruning alone never causes a write (lines 65-67 and 88-97), so the stale revocation stays in the row and the next navigation does the same thing.

Any opt-out that removed a stored source records a revocation: a vendor cookie opt-out, ID5 "0", a UID2 optout refresh, a LiveRamp 204. Once that revocation is over a day old and the provider is due again (the 30-day opt-out memory lapses, the visitor opts back in, the UID expires), the provider looks up or reads its cookie on every navigation and the result gets thrown away. It only recovers when an unrelated change to the same row lands in the same plan_write. It fails closed, so no privacy issue, but it still spends a vendor request per navigation up to rate_limit_per_hour.

The existing tests all use revocations younger than a day, which is why CI is green. I traced this through the code rather than running it, so a test would settle it: a row with revocations = {P: 1000}, now = 1000 + REVOCATION_MEMORY_SECONDS, and a found lookup dispatched_with({P: 1000}) should plan an update. I expect it returns None today.

Suggested fix: only treat a present, different revocation as superseding, for example

entry.revocations.get(&provider).is_some_and(|now_at| Some(*now_at) != lookups.revocation_at_dispatch(&provider))

or capture the revocations at dispatch after the same pruning at lookup.now. Either way #1604's guarantee holds, because a pruned revocation is older than any lookup in flight.

continue;
}
// The request is built before the rate limit is checked, so a
// provider that makes no lookup spends none of its budget.
let mut request = match registered.provider.build_request(&input) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Cookie-only providers log a warning and record request_error on most navigations

When a visitor has no vendor cookie and no live UID, the source is due and this calls build_request. ConnectID, Criteo, Unified ID and SharedID (without generate) always return Err("... makes no lookup"), and so do UID2 without an endpoint or stored token and LiveRamp without an endpoint. That lands here as a warn! plus LookupStatus::RequestFailed, reported as request_error. That's the common case for these kinds, so every enabled cookie-only provider adds a warning and an error metric to most navigations. The test at line 3840 calls RequestFailed a provider bug, and real build failures get buried in this noise. The spec only allows request_error for LiveRamp after its endpoint is removed (spec lines 1440-1444).

Suggest letting a provider say it makes no lookup for this input, either with build_request returning Result<Option<ProviderRequest>, _> or a makes_lookups(&self) -> bool that defaults to true, and recording Skipped(NotDue) or a new Skipped(NoLookup). Then the four cookie-only modules can drop their stub build_request/parse_response, and RequestFailed keeps meaning a real error. The rate limit is still spent only when a request is built.

* Prebid's client-side bid adapters receive these EIDs, but the User ID Module
* does not own them, so `getUserIdsAsEids()` never returns them.
*/
function readConfiguredOrtb2Eids(): unknown {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shim change is out of scope and affects every Prebid deployment

1f054c698 reads ortb2.user.ext.eids from pbjs.getConfig('ortb2') and merges them into the /auction body and the ts-eids cookie (through line 1965, plus 3112-3125). That runs whether or not any identity provider is configured, so publisher- or SDK-set EIDs that never reached the server before now get stored server side. It also raises the artifact size guard to 53,000. That's a deployment-wide client change inside a provider PR. Please move 1f054c698 into its own PR so it can be reviewed and rolled back on its own.

}

/// Whether a provider of `kind` excludes `source` where GDPR applies.
fn excludes_where_gdpr_applies(kind: &str, source: &str) -> bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind facts live in five string switches, and the GDPR exclusion has two sources of truth

This file matches on the kind string in is_registered_kind, reads_lockr, uses_hashed_email, this function and build, and core special-cases "sharedid" in settings.rs:697-717. Adding a kind means editing all of them in step. The GDPR one is the risky one. The coordinator asks the built provider (IdentityProvider::excluded_where_gdpr_applies in uid2.rs and liveintent.rs), while egress marking asks this switch, including for disabled providers. A new kind that only overrides the trait method would skip a source at collection and still serve its stored UIDs to bidders under GDPR. That split is how the LiveIntent trailing-dot bug happened.

Suggest an associated ProviderKind::excludes_where_gdpr_applies(source) -> bool, defaulting to false, that both the trait method and partner_registry use. Better, one static kind table (KIND, build, GDPR exclusion, default sources) that all of these read. reads_lockr and uses_hashed_email are public but only tests call them, and they repeat the ReadsLockr/UsesHashedEmail impls, so they could be #[cfg(test)] or derived from the table.

///
/// Lockr AIM writes other vendors' IDs into first-party cookies on the
/// publisher domain, under key names configured per publisher in Lockr.
/// Only kinds implementing [`ReadsLockr`] accept this table; the settings

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: rustdoc warnings

cargo doc -p trusted-server-identity-providers --no-deps warns twice: the public LockrSettings and HashedEmailSettings docs link to the crate-private ReadsLockr (here) and UsesHashedEmail (line 234). Plain backticked names fix both. Also, lib.rs:200 is a 136-character doc line in a file wrapped near 80.

};

/// Whether `kind` has a registered implementation.
///

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: stray empty doc line.

Suggested change
///

PR #1487's new head brings wave B: #1506's merge of main ab5c24f (#1501, js_asset_proxy rewriter ordering) and its repin of EdgeZero to rc/identity 8a73c0978806, carried up through the chain. The merge is clean. Cargo.lock changes only the 10 EdgeZero package sources, now at 8a73c097; the codegen crate's nested Cargo.lock is unchanged.
@aram356

aram356 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Round 12 identity realignment: rc/identity is now at db7dce634, and EdgeZero is pinned to its rc/identity at 8a73c097. This branch fast-forwarded from bfdd19b07 to 940339693:

Each merge message says what it carries and how any conflict was resolved.

PR #1487's new head brings #1506's move of the five auction endpoint test requests from test-publisher.com to publisher.example.com, for the URL-host lint. The merge is clean.
PR #1487's new head brings #1506's repin of EdgeZero to rc/identity ef5cbf30, which renames Fastly backends to ez_b31v2_* and moves the yanked pin-project-lite, chacha20 and spin. The merge is clean. Cargo.lock changes only the EdgeZero package sources (now ef5cbf30) and the yanked pin-project-lite, chacha20 and spin; the codegen crate's nested Cargo.lock is unchanged.
@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Round 15 identity realignment: rc/identity is now at 391a08578, and EdgeZero is pinned to its rc/identity at ef5cbf308. This branch fast-forwarded from a750db0b6 to 81172fa2f:

Each merge message says what it carries and how any conflict was resolved.

PR #1487's new head brings its change that strips `ts-eids` from publisher-origin requests unless the operator opts in.

crates/trusted-server-core/src/settings.rs: #1488 adds the optional
`[ec] hashed_email` publisher endpoint to `Ec` and its `Default`, and
#1487 adds the off-by-default `forward_eids_cookie_to_origin` flag in the
same places. The resolution keeps both fields and both defaults.
@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Round 17 identity realignment: rc/identity is now at 0ed862633, and EdgeZero stays pinned to its rc/identity at ef5cbf308. This branch fast-forwarded from 81172fa2f to 5d7ead54f:

In settings.rs this round's link keeps both new Ec fields, this PR's hashed_email and #1487's forward_eids_cookie_to_origin, with both defaults.

Each merge message says what it carries and how any conflict was resolved.

@aram356

aram356 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Merged #1614's /_ts/ local answers (48930c270) into this branch as 723245d1f, on top of 5d7ead54f.

Trusted Server owns the /_ts/ namespace (#1740). A request for /_ts or any /_ts/ path that no route handles now gets a local 404 on Fastly, Axum, Cloudflare and Spin, and never reaches the publisher origin. The path is matched after percent-decoding. Paths outside the namespace, such as /_tsx or /articles/_ts/x, still go to the publisher origin, and every routed /_ts/ path answers as before.

This merge takes #1487's new head (3f6787219), which carries 48930c270 and nothing else new to this branch. It was clean.

Checks on this head: no conflict markers; cargo fmt --all -- --check passes; the merge adds exactly #1614's change to this branch's files; it merges cleanly with every lower head in its stack. rc/identity (e72407155) passed the full CI gate list with the change.

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

7 participants