Repository navigation
Use applicable GPP sections from the CMP instead of header sections - #1722
ChristianPavilonis wants to merge 15 commits into
Conversation
PR #1714 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. The merge is textually clean. crates/trusted-server-core/src/ec/consent_update.rs (merged clean, failed to compile): the chain's consent-update snapshot test reads the decoded US opt-out through the old GppConsent.us_sale_opt_out field, which #1714 renames to us_opt_out. The resolution renames that one test reader. The test's opt-out snapshot sets sale opt-out, so its expectation is unchanged.
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.
- Drop regs.gpp and regs.gpp_sid in the Prebid Server and Standard profiles when regs.gdpr = 1 outside a US-state jurisdiction and the governing sections exclude TCF EU section 2. PBS-Go treats a non-empty gpp_sid as authoritative and would otherwise skip per-vendor TCF enforcement. US-state requests and APS keep forwarding GPP. - Share gpp::resolve_gpp_section_ids between proxy and decode mode so proxy mode drops stray sentinels (for example [-1, 7] -> [7]). - Log at info when an explicit __gpp_sid shares no section with the decoded __gpp header. - Keep a single GPP_SECTION_ID_TCF_EU_V2 constant and clarify the gpp_section_ids doc comment. - Record the Option B decision in the spec and plan.
dhruv8sh
left a comment
There was a problem hiding this comment.
Summary
This PR makes the CMP's __gpp_sid (applicableSections) decide which GPP sections are governing. -1 and 0 sentinels are kept, EU TCF and US opt-out decoding are limited to the applicable sections, and regs.gpp/regs.gpp_sid are left out of non-APS OpenRTB requests when GDPR applies but the governing sections exclude TCF (to avoid PBS-Go's GetGDPR override). The u16→i32 type change reaches every consumer. Classification, resolution and the proxy-vs-decode normalisation match each other. The new tests cover the sentinel matrix, disjoint stale-cookie cases, proxy mode and the PBS conflict case. One small docs inaccuracy, below.
Non-blocking
📝 note
- Osano doc says
[0]avoids the header fallback, but the server falls back to the header for[0]. See inline atdocs/guide/integrations/osano.md:27.
👍 praise
- Fail-closed handling of a stale or disjoint
__gpp_sidunder a GDPR geo. Thelog::info!mismatch diagnostic inresolve_gpp_section_idsand the tests inconsent/mod.rsthat pin down the behaviour make this easy to reason about.
| | `euconsent-v2` | TCF string from `__tcfapi` | | ||
| | `_ts_consent_src` | Ownership marker set to `osano` | | ||
|
|
||
| When Osano reports `applicableSections` as `[-1]` (no section applies) or `[0]` (undetermined), the mirror writes `__gpp_sid=-1` or `__gpp_sid=0` so Trusted Server can apply the CMP's governing-section decision rather than falling back to the GPP header. When `applicableSections` is empty or absent, `__gpp_sid` is cleared. |
There was a problem hiding this comment.
📝 note: This sentence says both [-1] and [0] let Trusted Server "apply the CMP's governing-section decision rather than falling back to the GPP header". That's only true for -1. classify_applicable_sections maps [0] to GppApplicability::FallbackToHeader, so a 0 cookie does fall back to the decoded __gpp header sections. It is only forwarded as [0] when there is no decodable header. Suggested wording:
| When Osano reports `applicableSections` as `[-1]` (no section applies) or `[0]` (undetermined), the mirror writes `__gpp_sid=-1` or `__gpp_sid=0` so Trusted Server can apply the CMP's governing-section decision rather than falling back to the GPP header. When `applicableSections` is empty or absent, `__gpp_sid` is cleared. | |
| When Osano reports `applicableSections` as `[-1]` (no section applies) or `[0]` (undetermined), the mirror writes `__gpp_sid=-1` or `__gpp_sid=0`. Trusted Server treats `-1` as the CMP's explicit decision that no GPP section governs, and treats `0` like an absent list, falling back to the section IDs in the GPP header. When `applicableSections` is empty or absent, `__gpp_sid` is cleared. |
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.
prk-Jr
left a comment
There was a problem hiding this comment.
Reviewed 68dca95df5ceb2f489dbd2617e5e2d8d503751ab against ab5c24f73f84bd226fe3c16cfe215a86f56d9b5b.
One blocking privacy-signal regression: the US exemption uses configured privacy-state membership, so country-only US geolocation loses applicable GPP signals. See inline.
Local verification used Rust 1.98.1 and Node 24.20.0: 137 consent tests, 50 GPP-related tests, and 49 browser tests passed. Six independent broken controls failed at the intended assertions. Relevant hosted Rust, adapter, parity, JS, clippy, and release-build checks passed for the reviewed pairing. The new US regression probe failed on the reviewed implementation and passed when restoring previous forwarding behavior.
The reproduction exercised native production consent processing and request serialization using Cloudflare's source-established country-only geolocation shape. Expiration checking was disabled for the static TCF fixture. No live Worker, CMP, or PBS deployment was exercised. The existing Osano [0] documentation finding is already reported and is not duplicated here.
| gdpr: Option<bool>, | ||
| ) -> (Option<String>, Option<Vec<i32>>) { | ||
| if gdpr == Some(true) | ||
| && !matches!(ctx.jurisdiction, jurisdiction::Jurisdiction::UsState(_)) |
There was a problem hiding this comment.
🔧 [P1] Preserve US privacy signals when geolocation lacks a state
Jurisdiction::UsState represents membership in the configured privacy-state list, rather than all US traffic. Cloudflare's CloudflareGeo::lookup always supplies region: None, so its US requests become NonRegulated and miss this exemption.
I reproduced the consequence through production consent processing and request builders with real encoded cookies: standalone TCF grants Purpose 1, allowing the auction; GPP section 7 explicitly asserts sale opt-out; Standard and Prebid serialize only {"gdpr":1,"ext":{"gdpr":1}}, dropping both GPP fields. APS preserves them. This also reproduces with Prebid's openrtb_only mode, where no Cookie fallback exists. Restoring the previous forwarding behavior makes the same preservation assertion pass.
This regression removes the US opt-out signal needed downstream. Actual downstream enforcement was not exercised; the probe used native shared code with Cloudflare's actual geolocation shape and expiration checking disabled for its static fixture.
Proposed correction: retain country-level US provenance through the consent context and forwarding subsets, and use it for the US exemption while preserving the intended EU safeguard. Add coverage for US country-only geo and configured-state exclusions. Apply manually: this requires a coordinated change across files and cannot be expressed as a single inline suggestion.
…tegration chain
The new head of #1714 brings the US GPP opt-out fields work and, through its base chain, the rest of the identity stack, including the Sourcepoint consent capture from #1535. crates/trusted-server-core/src/consent/gpp.rs: #1714 renamed the US decoder to decode_us_opt_out and widened it to sale, sharing, targeted-advertising, known-child and GPC refusals. #1722 limited TCF and US decoding to the sections the CMP says apply. The resolution keeps the #1714 decoder and its rules, adds the #1722 applicable_ids filter and GppApplicability match, and points the #1722 tests at the renamed us_opt_out field. docs/guide/integrations/sourcepoint.md: #1535 replaced the section with the GPP API consent-capture guide. #1722 documented how __gpp_sid mirrors -1 and 0. The resolution keeps the #1535 guide, adds the #1722 __gpp_sid rules to it, and states the section ID range that /_ts/consent accepts. Semantic fixes, so the chain applies one applicableSections rule. The IAB GPP CMP API reports [-1] when no section applies and 0 during stub or load. #1722 accepts -1..=65535, but the #1535 code, which merged clean, still rejected IDs below 1: - sourcepoint/gpp_capture.ts and sourcepoint/index.ts accept -1 and 0 on the GPP API path and when seeding consent sync from the mirror. - POST /_ts/consent (ec/consent_update.rs) and the snapshot validation in ec/app/route.rs accept -1..=65535. Their tests now accept [-1] and [0] and reject [-2]. - trusted-server-identity-providers joins and forwards the i32 section IDs that #1722 introduced.
The new head of #1622 brings the EC route consent script, which moves the GPP API capture to shared/gpp_capture.ts and adds the Prebid consent queue. #1722 merges it directly because it also builds on #1714, and the release candidate never carries a resolution of its own. crates/trusted-server-js/lib/src/shared/gpp_capture.ts: #1622 moved the capture here and added the shared isApplicableGppSection check for 1..=65535. #1722 had widened the inline check to -1..=65535. The resolution keeps the #1622 helper, widens it to -1..=65535, and documents the -1 and 0 values. crates/trusted-server-js/lib/src/integrations/sourcepoint/index.ts: #1622 switched the mirror writer to isApplicableGppSection, and #1722 used its local isValidGppSectionId. The resolution uses the shared helper throughout the module and drops the local copy, so one function holds the rule. crates/trusted-server-js/lib/test/integrations/sourcepoint/gpp_cookie_bridge.test.ts: git paired the old Sourcepoint capture test with this new #1622 file. The resolution takes the #1622 file as is. The #1722 test changes move to test/shared/gpp_capture.test.ts, where #1622 put the capture tests. Semantic fixes for the same applicableSections rule: - test/shared/gpp_capture.test.ts: a ready [-1] reading is a decision that no section applies, not an unavailable read. [0] is accepted and [-2] is rejected. - prebid/ec_route.ts comment and prebid consent_queue tests: the queue sends [-1] and [0], which the EC route accepts, and drops [-2].
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.
|
Round 17 identity realignment:
This PR now joins the identity chain. Its base is now The two merges also apply this PR's
Because of the #1714 merge, this PR's diff against #1622 also shows #1714's changes until that line merges. The SharedID Each merge message says what it carries and how any conflict was resolved. |
Prebid.js hashes the GPP handler as [applicableSections, gppString] with the CMP's list as reported. The `_cst` companion hashed the resolved governing list instead, so `__gpp_sid=0` with a decodable header, or a list mixing a sentinel with sections, produced a hash Prebid treats as a consent change. Hash `applicable_sections` verbatim and keep the header's sections only when `__gpp_sid` is absent. Expected values come from Prebid.js 10.26's own cyrb53Hash. Fixes #1735.
|
Added Prebid.js hashes the GPP consent handler as
|
…ntegration chain
|
Merged #1614's Trusted Server owns the This merge takes #1622's new head ( Checks on this head: no conflict markers; |
Summary
Previously, Trusted Server picked which sections of a Global Privacy Platform (GPP) string apply by reading every section listed in the GPP header, and only read the
__gpp_sidcookie when decoding failed. Because a single GPP string can hold sections for multiple regions (for example, both European Union Transparency & Consent Framework (TCF) section 2 and US National section 7), US readers with__gpp_sid=7were still treated as GDPR traffic, had all US sections combined instead of only the active one, and forwarded the full header list in OpenRTBregs.gpp_sid. Meanwhile, parsing__gpp_sidas unsigned integers dropped the Consent Management Platform (CMP) sentinel-1("no section applies"), and the Osano browser mirror stripped-1before writing the cookie.__gpp_sidcookie (applicableSections) as the governing section list for EU TCF applicability, US opt-out evaluation, and OpenRTBregs.gpp_sidforwarding, falling back to the decoded GPP header only when__gpp_sidis absent or[0].-1..=65535) end-to-end so[-1]explicitly disables GPP rules (letting geolocation decide with no GPP signal) and forwardsregs.gpp_sid: [-1].mainto preserve-1and0in__gpp_sid, and remove Sourcepoint's fallback that copied header section IDs fromconsentStringsinto__gpp_sid.regs.gppandregs.gpp_sidin the Prebid Server and Standard OpenRTB profiles whenregs.gdpr = 1outside a US-state jurisdiction and the governing sections exclude TCF section 2, so Prebid Server keeps per-vendor TCF enforcement (see the PBS-Go decision below).Scope
This PR targets
mainand covers the shared Rust consent/OpenRTB pipeline, the two GPP browser mirrors onmain(Osano and Sourcepoint), their integration guides, and the design spec and implementation plan.GppConsentkeeps its optional boolean US opt-out shape andus_sale_opt_out_from_section,allows_ec_creation, andhas_explicit_ec_withdrawalremain untouched.rc/identity: Four touchpoints cited in Choose the governing GPP sections from the CMP's applicable sections #1686 only exist onrc/identity(shared/gpp_capture.ts,ec/consent_update.rs,ec/app/route.rs, andec/sharedid.rs_cstconsent hashing) and are left for a small follow-up once this lands and merges intorc/identity. Storing rawapplicable_sectionsonConsentContextpreparesmainfor that SharedID_csthash parity work.Design decisions
gpp_sidconflict: Option B, scoped to non-US jurisdictions. PBS-Gogdpr.GetGDPRreturns "GDPR does not apply" whenever a non-emptyregs.gpp_sidlacks2, ignoringregs.gdpr = 1and skipping per-vendor TCF enforcement, which only PBS performs. With the Osano mirror now writing__gpp_sid=-1, an EU visitor with a standaloneeuconsent-v2could reach PBS asgdpr=1, gpp_sid=[-1].regs.gppandregs.gpp_sid(top-level andregs.ext) whenregs.gdpr = 1, the jurisdiction is notUsState, andgpp_section_idsis non-empty without2.regs.gppis dropped too because PBS-GoGetConsentprefers a GPP-embedded TCF section overuser.consent.euconsent-v2setsgdpr_appliesfor US visitors whose CMP uses TCF in the US. There the CMP-declared US section (for example[7]) governs, and PBS-Go correctly applies US rules, soUsStaterequests keep GPP.__gpp_sidwith the same resolver as decode mode (for example[-1, 7]→[7],[-1, 0]→ none);[-1],[0], and positive lists are unchanged.__gpp_sid: when an explicit__gpp_sidshares no section with the decoded__gppheader, the mismatch is logged atinfo.[2, 7]and__gpp_sid=7, existingbuild_regsemitsregs.gdpr = Some(false)(0, not1) for known US jurisdictions rather than omittingregs.gdpr(Noneremains reserved for unknown jurisdiction).__gpp_sid=0and__gppdecodes a valid header (for example[2, 7]),regs.gpp_sidforwards the header fallback[2, 7]whileConsentContext.applicable_sectionsretainsSome([0]). (In proxy mode or when__gppdoes not decode,[0]is forwarded as received.)Changes
crates/trusted-server-core/src/consent/types.rsConsentContext.applicable_sections(Option<Vec<i32>>), switchedgpp_section_idstoOption<Vec<i32>>, and updatedis_empty()and doc comments.crates/trusted-server-core/src/consent/gpp.rs__gpp_sidasi32in-1..=65535, addedGppApplicabilityclassification, scoped decoding viadecode_gpp_string_with_applicability, the sharedresolve_gpp_section_idsresolver (with the stale-cookieinfolog),gpp_sid_excludes_tcf_eu, and unit tests.crates/trusted-server-core/src/consent/mod.rs__gpp_sidonce inbuild_context_from_signals, scoped GPP decoding andgdpr_appliesto governing sections, normalized proxy mode with the shared resolver, addedregs_gpp_fields(PBS-Go Option B), and added pipeline tests.crates/trusted-server-core/src/openrtb.rsRegsExt.gpp_sidfromOption<Vec<u16>>toOption<Vec<i32>>and added-1serialization coverage.crates/trusted-server-core/src/integrations/prebid.rsOption<Vec<i32>>inbuild_regsviaregs_gpp_fields, allowed-1tokens in comma/whitespace__gpp_sidcookie normalization, and added regression tests (including GDPR/US-state Option B coverage).crates/trusted-server-core/src/auction/openrtb.rsbuild_regshelpers to passVec<i32>directly; Prebid and Standard useregs_gpp_fields.crates/trusted-server-core/src/auction/openrtb/tests.rsgpp_sid: [-1], GDPR + non-TCFgpp_sid, and US-state TCF +[7]coverage across Standard, Prebid Server, and APS OpenRTB profiles.crates/trusted-server-core/src/integrations/aps.rsbuild_regsparity helper forOption<Vec<i32>>.crates/trusted-server-js/lib/src/integrations/osano/index.tsshouldWriteGppSidto write-1and0sentinels (valid integers in-1..=65535) instead of stripping-1.crates/trusted-server-js/lib/test/integrations/osano/index.test.ts-1and0write__gpp_sidwhile empty or missing lists clear it.crates/trusted-server-js/lib/src/integrations/sourcepoint/index.tsapplicableSectionsintegers in-1..=65535on both payload shapes and removed thesectionIdsFromConsentStringsheader-ID fallback.crates/trusted-server-js/lib/test/integrations/sourcepoint/index.test.ts-1,0, out-of-range filtering, and clearing__gpp_sidwhen onlyconsentStringsexist.docs/guide/integrations/osano.md__gpp_sidmirroring for-1and0sentinels and clearing on empty/absent lists.docs/guide/integrations/sourcepoint.md-1/0handling, and clearing__gpp_sidwhenapplicableSectionsis absent.docs/superpowers/specs/2026-12-01-1686-gpp-applicable-sections-design.mddocs/superpowers/plans/2026-12-01-1686-gpp-applicable-sections.mdCloses
Part of #1686 (remaining four
rc/identity-only items will close #1686 in a follow-up once this merges intorc/identity).Spec
Spec: docs/superpowers/specs/2026-12-01-1686-gpp-applicable-sections-design.md
Test plan
cargo test-fastly && cargo test-axum(see note below:cargo test-axumpassed and both Fastly WASM test binaries compiled cleanly, while local Viceroy execution is blocked by hostviceroy 0.17.0vs pinned0.22.0)cargo clippy-fastly && cargo clippy-axum(plus all other clippy aliases:cloudflare,cloudflare-wasm,spin-native,spin-wasm,cli,codegen, andtemplate_build_digest)cargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest run(80 files, 3,303 tests passed, 0 type errors)cd crates/trusted-server-js/lib && npm run formatcd docs && npm run format(plus Prettier check on Markdown outsidedocs/)cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1(debug WASM test builds compiled cleanly; CI runs release WASM)fastly compute servetrusted-server-coreunit tests (cargo test -p trusted-server-core --target x86_64-unknown-linux-gnu --lib: 3,416 passed, 0 failed, 2 ignored)cargo test -p trusted-server-core --test template_build_digest,cargo test -p trusted-server-openrtb --target x86_64-unknown-linux-gnu,cargo test-cloudflare,cargo test-spin, andparityintegration tests (29 passed)cd crates/trusted-server-js/lib && npm run build(13 modules)scripts/lint-wasm-clock.shcargo run --manifest-path crates/trusted-server-cli/Cargo.toml --target x86_64-unknown-linux-gnu --bin ts -- dev lint domains --changed-vs origin/maincargo fmt --all -- --check;clippy-fastly,clippy-axum,clippy-cloudflare,clippy-cloudflare-wasm,clippy-spin-native,clippy-spin-wasm; nativetrusted-server-coreunit tests (3,421 passed, 0 failed, 2 ignored);cargo test-axum,cargo test-cloudflare,cargo test-spin;parity(29 passed); Prettier check on the spec and plan.cargo test-fastlycompiled but local Viceroy execution is still blocked by hostviceroy 0.17.0.Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)