You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep a server-reported opt-out when the browser sends an unchanged cookie #1602
Follow-up from PR #1488 (review by prk-Jr, thread).
Description
Reviewer's finding (P1): "Any usable cookie is treated as proof of opting back in. A UID2 server refresh, however, never rewrites the browser cookie. A two-navigation reproduction first refreshes a due identity, receives a server opt-out, clears the source and persists opt-out memory. The next navigation sends the same unchanged cookie: this branch produces Found with OptOutMemory::Forget, allowing the cleared token to return without a new vendor lookup."
In crates/trusted-server-core/src/ec/coordinator/mod.rs (~lines 590-596, CookieRead::Found branch), any usable cookie sets opted_back_in and OptOutMemory::Forget, which clears the remembered opt-out the server recorded.
Reproduction
Navigation 1: a due UID2 identity is refreshed server-side; the vendor answers with an opt-out. The source is cleared and opt-out memory is persisted.
Navigation 2: the browser sends the same, unchanged pre-opt-out cookie.
The coordinator treats the cookie as an opt-back-in, forgets the opt-out and restores the cleared token.
Expected behavior
A server-reported opt-out stays in force until there is evidence of a genuinely new ID. Legitimate opt-back-in (a freshly issued cookie ID) still clears the memory.
Possible approaches (both change the stored per-visitor record):
Store a fingerprint of the cookie value seen at opt-out time in the opt-out record, and only forget the opt-out when the cookie differs.
Compare the cookie's issue time with the recorded opt-out time, and only forget the opt-out for a cookie issued after it.
Done when
An unchanged pre-opt-out cookie no longer clears a server-reported opt-out.
A cookie carrying a genuinely new ID still clears it.
A two-navigation lifecycle regression test covers both cases.
Affected area
Core (Edge Cookies, GDPR)
Code: crates/trusted-server-core/src/ec/coordinator/mod.rs (cookie read / remembered opt-out handling), opt-out record in the KV row types.
Activity