Skip to content

Apply pull-sync consent checks to identify - #1710

Open
prk-Jr wants to merge 12 commits into
feat/1598-ec-route-fastlyfrom
fix/1694-identify-consent-rule
Open

prk-Jr wants to merge 12 commits into
feat/1598-ec-route-fastlyfrom
fix/1694-identify-consent-rule

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Apply the pull-sync purpose-consent rule to GET /_ts/api/v1/identify (fixes #1694). Identity disclosure requires both existing consent helpers and a live stored record. Purpose refusal, withdrawal tombstones and missing records return 403 {"consent":"denied"} without identities; failed record reads return 503 {"error":"kv_unavailable"}. Preserve authenticated full-consent success and no-active-EC 204 after consent checks.

The current base is feat/1598-ec-route-fastly. On this identity chain, Fastly and configured Axum use the shared async identity application. Cloudflare and Spin answer unsupported identify storage locally. Legacy partner vendor-consent enforcement remains deferred to #1684; both identify and the coordinator's legacy vendor-policy population now carry a TODO. Configured provider vendor-policy checks already exist.

Changes

  • Apply both purpose-consent checks and stop disclosure for absent, withdrawn or unreadable records.
  • Centralize identical denial responses and flatten the live-record path while retaining UID eligibility policies, cache/CORS headers, and cluster-evaluation behavior.
  • Retain degraded: false in successful responses for compatibility and document why it is constant.
  • Update the API/setup/Fastly guides and add supersession notes to historical design documents.
  • Cover refusal, tombstone, missing-record and read-error withholding, unchanged tombstone state, and the full positive response payload.

The missing-record response deliberately follows #1694's specified contract. It does not distinguish a missing row from consent denial; cross-POP visibility timing has not been measured by this change.

Verification

Local checks passed for commit 978b7305b838669e872f77e3af005e8583117452:

  • Identify tests: 28 passed before and after the review cleanup; full success payload and all withholding paths covered.
  • All eight Clippy aliases and all five adapter test aliases passed, including both Fastly sandbox modes.
  • Cross-adapter parity: 40 passed. Native build-digest tests/lint, CLI tests, coordinator tests and core conformance checks passed.
  • Axum and Fastly conformance tests exercised routed identify and returned the distinct partner UID written by batch sync.
  • JS build and all 3,379 JS tests passed; Rust, JS, docs and Markdown formatting passed.
  • URL-host lint, clock/environment/executor lints, and required script gates passed. The managed pre-commit domain hook remained enabled.
  • Fresh production builds passed. Real deadline fixtures passed under Viceroy, Cloudflare and Spin; all four production startup smoke scripts passed locally.
  • Core documentation built successfully, with 31 warnings in unchanged files.

Tools matched this branch: Rust 1.98.1, Node 24.20.0, Viceroy 0.22.0, Fastly CLI 16.0.0, Spin 4.1.0 and Wrangler 4.83.0. The Cloudflare build used lockfile-matched wasm-bindgen 0.2.126 and worker-build 0.8.5.

All 34 hosted checks passed for this exact commit against base 8f96b3512111c159aecd6d8a5b57ee77d0b404c1. Local runtime evidence uses fictional local fixtures; no external partner, cross-POP timing or deployment is claimed.

Closes

Closes #1694

@prk-Jr prk-Jr self-assigned this Nov 30, 2026
@prk-Jr
prk-Jr marked this pull request as ready for review December 1, 2026 10:35

@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.

Reviewed d9f93a055 against main (ab5c24f73).

Approving so I'm not the one holding this up, on the understanding that you'll work through the inline comments before merging. No behavioral problems found. The fix matches #1694, and all four withheld cases have tests that pass. The comments are maintenance and style.

Things to be aware of, not blocking:

  • A missing record now returns 403 {"consent":"denied"}. If a fresh row is briefly invisible after create_if_absent (cross-POP KV consistency), a consenting reader gets a consent-denied answer instead of the old 200. The issue asks for this behavior; I just couldn't tell how often the race happens.
  • A Purpose-4 refusal without an EC cookie now gets 403 instead of 204, because the consent gate runs before the ec_value check. That matches pull sync and finalize.

Checks: cargo test -p trusted-server-core --lib ec::identify::tests (18 passed), rustfmt and prettier on the changed files. I didn't run Viceroy or the integration suite.

@dhruv8sh dhruv8sh 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 PR applies pull sync's consent gate to /_ts/api/v1/identify. Identify now needs both EC consent (Purpose 1) and EID-persistence consent (Purposes 1 and 4), checked through the same allows_eid_persistence helper that build_pull_sync_context and gate_eid_updates_by_consent use. It also stops disclosing the EC for tombstoned or missing records (403) and for KV read failures (503). The change is small and correct, and the tests cover each withholding path plus the success shape. There are no blocking issues. The comments below are non-blocking design points.

1 of the inline comments below carries a one-click GitHub suggestion — use Commit suggestion to apply it as a commit on the PR branch. The remaining comments describe the point in prose.

Non-blocking

🤔 thinking / ♻ refactor / 🏕 camp site

  • A missing KV record returns {"consent":"denied"}, which mislabels the cause and may hit KV propagation lag — see inline at crates/trusted-server-core/src/ec/identify.rs:123
  • degraded is now always false — see inline at crates/trusted-server-core/src/ec/identify.rs:155
  • The tombstone branch returns early, so the else is redundant — see inline at crates/trusted-server-core/src/ec/identify.rs:98

👍 praise

  • Thorough tests for the withholding paths, including the check that a tombstone is not refreshed — see inline at crates/trusted-server-core/src/ec/identify.rs:702

PR #1710 moves from main onto PR #1662's branch, the top of the identity chain trunk. PR #1662's head brings the identity integration chain as of round 12 wave A, including the async record-backed identify handler. #1710's head also carries main's ab5c24f (#1501), which the chain does not have yet, so its two conflicts with the chain are resolved here the way wave B resolves them on PR #1506.

crates/trusted-server-core/src/ec/identify.rs: #1710 requires both ec_consent_granted and allows_eid_persistence, returns 403 {"consent":"denied"} for a tombstone or a missing record, returns 503 {"error":"kv_unavailable"} for a failed read, and sends degraded false. The chain made identify async, reads the record with its generation, and extracts the partner EID through provider ownership and vendor consent checks. The resolution keeps the chain's async handler and EID extraction and adds #1710's consent gate and the three early returns on the chain's kv.get match arms. Since every arm but a live record now returns, eid is declared without an initializer and set in the live arm, which keeps clippy's unused-assignment lint clean. In the tests, #1710's helpers and five tests are ported to the chain's async graph API and KvPartnerId::single. They replace the chain's handle_identify_kv_failure_sets_degraded_true, which pinned the 200 degraded response that #1710 intentionally removes. The other chain identify tests keep Purposes 1 and 4 or non-regulated consent and are unchanged.

crates/trusted-server-core/src/auction/mod.rs: main's ab5c24f moved the APS provider fixture into aps_provider_map and added a js_asset_proxy ordering test, and the chain added allow_insecure_http to ProviderConfig. The resolution calls aps_provider_map and adds allow_insecure_http: false inside it.

CHANGELOG.md: main's ab5c24f and the chain each added entries at the top of Changed. The resolution keeps main's #1501 entry first, as wave B does on PR #1506, then the chain's entries.
PR #1662'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.

CHANGELOG.md: #1710 already carried main's ab5c24f and kept its entry first in Changed, then the chain's entries. Wave B kept the same main entry first and rewrote the EdgeZero pin entry for 8a73c097, placing it second. The resolution takes wave B's placement and text, so CHANGELOG.md now matches PR #1662's head exactly.
@aram356
aram356 changed the base branch from main to feat/1598-ec-route-fastly December 1, 2026 23:14
aram356 added a commit that referenced this pull request Dec 1, 2026
One octopus merge of the round 12 tips into rc/identity c3e3366. It is a single octopus because the RC already holds every sibling's old head, so each tip's new head merges in alongside the others rather than as a chain of merges. The tree is the automatic merge of the RC and all tips, with no resolution: every tip pair, their union and the merge into the RC are clean.

Tips, in parent order after the RC:

- PR #1503 at 4225024
- PR #1653 at 4bd4903
- PR #1654 at 95cf3e8
- PR #1655 at 05c509d
- PR #1622 at afe5217
- PR #1660 at c1a05d7
- PR #1666 at 108b122
- PR #1659 at 5fb8190
- PR #1709 at 6d152f6
- PR #1710 at dcceeee
- PR #1713 at cae7801
- PR #1557 at 302e972

PR #1659 sits above PR #1718, so it carries PR #1714, PR #1717 and PR #1718.
@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 d9f93a055 to dcceeee98:

The base moved from main to feat/1598-ec-route-fastly. The consent gate and the 403/403/503 early returns now sit on the chain's async kv.get arms; the five tests are ported to the async API and replace handle_identify_kv_failure_sets_degraded_true.

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

PR #1662's new head brings #1535's owner fix that keeps mirrored GPP consent through transient CMP not-ready states (#1678), #1535's move of the consent-update test host to publisher.example.com for the URL-host lint and #1540's allow-domain marks on the deployment guide's reference links. The merge is clean.
aram356 added a commit that referenced this pull request Dec 2, 2026
It brings #1535's owner fix that keeps mirrored GPP consent through transient CMP not-ready states (#1678), #1535's and #1540's URL-host lint fixes, and #1622's move of the new GPP bridge tests into its split test file, carried up to every tip: #1653, #1654, #1655, #1622, #1660, #1666, #1659, #1709, #1710, #1713 and #1557. #1503 is already contained. The octopus tree is the conflict-free union of the tips.
PR #1662'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.
aram356 added a commit that referenced this pull request Dec 2, 2026
It brings #1710's cascade merge of #1506's auction endpoint test host fix.
PR #1662's new head brings #1662's consent-string comment on the EC route fixture, plus #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, #1625's shared Wrangler installer for CI, #1639's pull reserve boundary check and wording, #1613's conformance doc alignment, #1616's certificate policy and pull-sync fixture corrections, #1617's preserved startup diagnostics and hardened runtime checks, #1635's complete startup evidence in native fixtures, #1637's shared readable non-Unicode Geo fixture, #1627's Spin store reads and retained runtime coverage, #1535's Sourcepoint consent mirror deduplication and consent update coverage, #1636's stronger after-response body and drain checks, #1626's enforcement of stored and carried provider opt-outs, #1656's strict browser gate wording and #1661's grouped QUIC JA4 fixture. 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 added a commit that referenced this pull request Dec 3, 2026
PR #1503 at 1d51b78: Add ts ec show and ts ec eids admin diagnostic commands
PR #1653 at f217902: Clarify and verify the Axum local config handoff
PR #1654 at e4e68bb: Verify pending record writes drain within shutdown grace
PR #1655 at 7d0cdb2: Configure EC lifetime and renew it on eligible visits (DEC-13)
PR #1659 at bd707f2: Verify geo consent paths on Axum and Fastly
PR #1660 at 87c52cd: Retry an after-response write that loses its CAS
PR #1666 at b1d7062: Verify identity gates and provider deadlines on Axum
PR #1710 at 3d33359: Apply pull-sync consent checks to identify
PR #1557 at 3982143: Carry Sourcepoint TCF consent to Trusted Server
PR #1667 at f9ac6bb: Present a client certificate on auction providers that set mtls
PR #1607 at b3a0b09: Send the resolved client IP to the publisher origin
PR #1709 at 635f06a: Keep the EC out of bid request IDs and gate user.id on EID consent
PR #1713 at e5f4d05: Apply consent rules to first-party click redirects
PR #1622 at dd2ee39: Report CMP consent to the EC route and merge its answer into Prebid
@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 d34d438ed to 3d3335943:

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

Carries #1533's Axum startup-test port fix (779e446) and nothing
else. Owner commits pushed to other chain PRs since round 15 come in
with the next round.
@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Cascade of #1533's Axum startup-test port fix (779e44673): b37a13004 merges it into this PR. There were no conflicts and nothing else changed. The fix moves free_loopback_port in crates/trusted-server-adapter-axum/tests/routes.rs below the ephemeral port range, and #1533's note has the details. Owner commits pushed to other chain PRs since round 15 come in with the next round. rc/identity is now 62f8e41e2.

@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Merged #1627's runtime KV removal (7c2b84f45) into this branch as 22aa5437b, on top of b37a13004.

At the maintainer's request, that commit removes the generic runtime KV store trusted_server_runtime_kv. Nothing reads or writes it, and the managed Fastly deploy made every service provision and pay for it. edgezero.toml and the Fastly Hooks::stores() now declare only trusted_server_kv, and RuntimeServices::kv_store() is unavailable on every adapter.

Only that commit was merged, not the base branch's new head. Conflicts were resolved in edgezero.toml, the Fastly Hooks::stores() in app.rs, fastly.toml, the Viceroy template, the integration tests' config.rs, trusted-server.example.toml, docs/guide/architecture.md and docs/guide/edgezero.md. Only trusted_server_kv stays declared, this branch's record-store comment and local seeds are kept, and the runtime-KV lines are dropped. The Axum README and docs/guide/axum-dev.md keep this branch's Axum wording.

Checks on this head: no reference to the removed store remains and cargo fmt --check passes; clippy-fastly, clippy-axum, clippy-cloudflare and clippy-spin-native pass. rc/identity (b9dc3153e) passed the full CI gate list with the removal.

PR #1662's new head brings #1487's change that strips `ts-eids` from publisher-origin requests unless the operator opts in and #1646's fix that preserves filter headers through identity finalization. The merge is clean.
aram356 added a commit that referenced this pull request Dec 3, 2026
PR #1503 at 6a8797e: Add ts ec show and ts ec eids admin diagnostic commands
PR #1557 at a435778: Carry Sourcepoint TCF consent to Trusted Server
PR #1607 at 07086f2: Send the resolved client IP to the publisher origin
PR #1627 at 5b7fc3d: Wire declared stores and document unsupported Axum KV
PR #1636 at d838931: Drain Axum after-response identity tasks on SIGTERM
PR #1653 at 5b86d9b: Clarify and verify the Axum local config handoff
PR #1654 at be495b3: Verify pending record writes drain within shutdown grace
PR #1655 at 888c5f1: Configure EC lifetime and renew it on eligible visits (DEC-13)
PR #1659 at 7b1d4a7: Verify geo consent paths on Axum and Fastly
PR #1660 at 64a1baa: Retry an after-response write that loses its CAS
PR #1667 at 1359722: Present a client certificate on auction providers that set mtls
PR #1709 at bc43a3e: Keep the EC out of bid request IDs and gate user.id on EID consent
PR #1710 at dc728a1: Apply pull-sync consent checks to identify
PR #1713 at ffa7597: Apply consent rules to first-party click redirects
PR #1722 at 070e2b0: Use applicable GPP sections from the CMP instead of header sections

PR #1666 at 4720b0b (Verify identity gates and provider deadlines on Axum) arrives through #1659, and PR #1622 at c878e6e (Report CMP consent to the EC route and merge its answer into Prebid) arrives through #1722. Every other chain PR arrives through the tips above. The tree is the conflict-free union of these tips and carries no resolution of its own.
@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 22aa5437b to dc728a1a1:

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

Share the consent and record denial response, and keep live-record
outputs immutable after early returns. Preserve response contracts,
UID eligibility, cache/CORS headers and cluster-error behavior.

Document the retained degraded field and mark legacy pull-sync
vendor-policy population for #1684.
@aram356

aram356 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Merged #1614's /_ts/ local answers (48930c270) into this branch as a51311bb7, on top of 978b7305b.

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 #1662's new head (1e8c9997f), 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; clippy-fastly, clippy-axum, clippy-cloudflare and clippy-spin-native pass. 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

Development

Successfully merging this pull request may close these issues.

Apply the pull-sync consent rule to the identify route

4 participants