Skip to content

Honor all decoded US GPP opt-outs - #1714

Open
prk-Jr wants to merge 1 commit into
mainfrom
fix/1695-us-gpp-opt-out-fields
Open

prk-Jr wants to merge 1 commit into
mainfrom
fix/1695-us-gpp-opt-out-fields

Conversation

@prk-Jr

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

Copy link
Copy Markdown
Collaborator

Summary

  • Recognize every supported US GPP sale, sharing, targeted-advertising, known-child and GPC refusal so a non-sale refusal cannot permit EC identity use.
  • Rename the decoded signal to GppConsent.us_opt_out and use it for both EC creation and explicit withdrawal, preserving the API shape for downstream work.
  • Cover generated field-by-field inputs and explain how EC eligibility gates identity forwarding before the separate TCF/GDPR filter.

Changes

File Change
crates/trusted-server-core/src/consent/gpp.rs Aggregate every specified refusal from National v1/v2 and all supported state sections; add generated field-level and preservation regressions.
crates/trusted-server-core/src/consent/types.rs Rename and document the optional decoded US refusal flag.
crates/trusted-server-core/src/consent/mod.rs Migrate both EC decisions and their fixtures to the broader flag.
docs/guide/integrations/prebid.md Describe the broadened US signal enforcement and the existing forwarding gates accurately.

Base: main (db36dc0ecad8c3041bc443fb6487aeae162e3ed3). The GPP decoder is identical on main and rc/identity, and both EC policy functions exist on both. This fix can land independently of the identity integration branch. PR target: main.

A GPP string that refused sharing, targeted advertising, known-child consent, or GPC while leaving sale permitted previously allowed new EC creation and did not count as an EC withdrawal. Rename GppConsent.us_sale_opt_out to us_opt_out and aggregate each supported explicit refusal. Both EC decisions consume ctx.gpp.as_ref().and_then(|gpp| gpp.us_opt_out); preserve the optional shape for downstream consumers.

All opt-out fields below are under core and trigger only on OptOut::OptedOut (1). Child leaves are under core.known_child_sensitive_data_consents and trigger only on Consent::NoConsent (1); where marked scalar, that field itself is the consent value. GPC triggers only when section-level gpc == Some(true).

Section Opt-out fields Known-child fields GPC
7 National v1 sale_opt_out, sharing_opt_out, targeted_advertising_opt_out from_13_to_16, under_13 Yes
7 National v2 sale_opt_out, sharing_opt_out, targeted_advertising_opt_out process_sensitive_data_from_13_to_16, process_sensitive_data_under_13, process_personal_data_from_16_to_17 Yes
8 California v1 sale_opt_out, sharing_opt_out sell_personal_information, share_personal_information Yes
9 Virginia v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Unavailable in section
10 Colorado v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes
11 Utah v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Unavailable in section
12 Connecticut v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16 Yes
13 Florida v1 sale_opt_out, targeted_advertising_opt_out under_13, from_13_to_16, from_16_to_18 Unavailable in section
14 Montana v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16 Yes
15 Oregon v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16 Yes
16 Texas v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes
17 Delaware v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16, sell_personal_data_from_16_to_18, process_personal_data_from_16_to_18 Yes
18 Iowa v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes
19 Nebraska v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes
20 New Hampshire v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16 Yes
21 New Jersey v1 sale_opt_out, targeted_advertising_opt_out process_sensitive_data_from_known_child, sell_personal_data_from_13_to_16, process_personal_data_from_13_to_16, sell_personal_data_from_16_to_17, process_personal_data_from_16_to_17 Yes
22 Tennessee v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes
23 Minnesota v1 sale_opt_out, targeted_advertising_opt_out known_child_sensitive_data_consents (scalar) Yes

Not Applicable scope: the aggregation helpers are changed, but value 0 remains a non-refusal, as does invalid 3 after the dependency maps it to NotApplicable. Tests explicitly preserve this behavior. #1698 remains separate. No changes to general sensitive-data fields, personal/additional consent, notices, MSPA modes, jurisdiction policy (#1708), legacy US Privacy forwarding/grants (#1697), or EdgeZero.

Former-reader inventory:

  • consent/gpp.rs: decoder construction, per-section aggregation and decoder assertions now use us_opt_out.
  • consent/types.rs: public GppConsent declaration and field documentation now describe the broader signal. It remains nested in ConsentContext.gpp; there is no second flag.
  • consent/mod.rs::allows_ec_creation: both the refusal-priority check and the decoded non-refusal branch read us_opt_out; US opt-outs still take precedence over TCF grants.
  • consent/mod.rs::has_explicit_ec_withdrawal: reads us_opt_out to classify explicit withdrawals.
  • consent/mod.rs fixture constructors/assertions: renamed without changing unrelated policy.
  • Auction forwarding (auction/endpoints.rs) and publisher/page-bids paths consume the broader flag indirectly through EcContext::ec_allowed() and EC eligibility. Existing gates withhold the EC ID and body/cookie EIDs when EC consent is denied, so the new refusals now also reach those gates without adding duplicate field checks. KV partner resolution likewise requires the eligible EC. integrations/prebid.rs receives the centrally filtered auction request and needs no direct field read. gate_eids_by_consent and allows_eid_persistence retain the additional TCF/GDPR checks; auction eligibility itself can still allow an auction without identity.
  • Logs (log_consent_context and log_consent_signals) and admin have no explicit old-field reader. Derived Debug output naturally uses the new field name.
  • Active guide docs/guide/integrations/prebid.md: describe the broadened US refusals and the EC eligibility gate before the separate TCF/GDPR EID filter. The existing degraded-behavior table remains accurate once the missing refusal fields are recognized.
  • Historical docs/superpowers/plans/2026-04-15-sourcepoint-gpp-consent.md and docs/superpowers/specs/2026-04-15-sourcepoint-gpp-consent-design.md: retain the old name as historical design/implementation records, rather than presenting them as current API documentation.
  • RC-only ec/consent_update.rs:480: a test assertion still reads the old name. It is absent on main; see trial-integration note below.

Closes

Closes #1695

Spec

Not a feature; scoped consent-decoding bug fix.

Test plan

The following targeted checks ran before publication approval on the reviewed source. No gates were rerun for publication; the full CI matrix is delegated to GitHub Actions as requested.

  • Targeted core consent tests, EC finalization tests and the independently exercised forwarding regression.

  • Core clippy with all targets/features and warnings denied.

  • Changed-file Rust/Markdown formatting checks.

  • Independent local review and actual Axum runtime verification on the scratch RC integration, scoped below.

  • Full CI matrix: GitHub Actions. Current-revision hosted checks complete.

  • Baseline cargo test --locked -p trusted-server-core --lib consent::: 118 passed.

  • Fail-first generated National v2 tests observed (minting=true, withdrawal=false) for sharing, targeted advertising, all three known-child leaves and GPC; California sharing-only failed the same way. Sale-only and all-permission controls already passed.

  • Final cargo test --locked -p trusted-server-core --lib consent::: 125 passed. Generated fixtures cover National v1/v2 and every state opt-out/child/GPC field individually, and prove the selected named field appears in the dependency's decoded result. No-refusal control covers all state sections; multi-section precedence, absent/malformed sections and values 0/3 are covered. A previous Virginia "non-opt-out" fixture actually denied child consent; replace it with a generated all-permission fixture.

  • cargo test --locked -p trusted-server-core --lib ec::finalize::tests::: 41 passed.

  • cargo clippy --locked -p trusted-server-core --all-targets --all-features -- -D warnings: passed.

  • Changed-file rustfmt check, Prebid Markdown Prettier check, and git diff --check: passed.

  • Rust 1.98.1, Node 24.20.0. No full CI suite run, per requested scope. Cargo reports a preexisting future-incompatibility warning in proc-macro-error2 2.0.1.

Trial integration:

  • Scratch detached rc/identity at c3e33666604d5d3b6e043fc206931b3681c8f3bf. origin/main is its merge base and ancestor. Applied the complete main-based patch with git apply --3way, which performs the same three-way file integration without creating a commit.
  • All four changed files applied cleanly: zero textual conflicts.
  • One semantic test migration remains on RC: rename the old-field assertion in ec/consent_update.rs:480 before running RC tests. It is test-only and does not participate in the runtime binary. No RC source edits were made beyond the exact candidate patch.
  • The trial created no commits and was not pushed. Final reviewed patch SHA256: 2f6ba73c4844543052ccbe6b0b87053594df3cc15f27e6b9ee02390b9472ad0a.

Independent local review: READY TO REQUEST REVIEW for the main-based code change. One documentation finding was corrected: the guide must describe the earlier EC eligibility gate rather than imply browser EIDs bypass US refusals. The bounded recheck closed it; zero open blocking or optional findings. The reviewer independently ran the existing auction_strips_client_eids_when_ec_identity_denied core test (1 passed), confirming the common upstream gate. Final reviewed patch SHA256: 2f6ba73c4844543052ccbe6b0b87053594df3cc15f27e6b9ee02390b9472ad0a.

Runtime verification: VERIFIED on the real Axum binary from the scratch RC integration. Stock main Axum lacks the necessary geo/EC lifecycle wiring, so this is RC-integration runtime evidence, not a main-only Axum certification. No runtime or EdgeZero changes were added to main to manufacture that evidence.

  • Built the normal trusted-server-axum binary with cargo build --locked -p trusted-server-adapter-axum --features geo-cloudfront, Rust 1.98.1, Node 24.20.0, dev debug info disabled. No wrapper or test-only EC lifecycle wiring.
  • Supplied fictional publisher.example.com configuration through the supported local config-store envelope, fake secret references, protected loopback CloudFront US/CA metadata and local persistent records. Actual response headers confirmed x-geo-country: US, x-geo-region: CA; all five requests returned 200 and the local-origin sentinel.
  • California GPP strings were generated from named field order. DBABBg~BVqqqqpo: sale=2, sharing=2, all sensitive fields=2, both known-child consents=2, personal consent=2, GPC absent. DBABBg~BVmqqqpo changes only sharing to 1. MSPA covered=1, option/provider modes=2 in both.
  • All-permission positive control minted a nonempty ts-ec with Max-Age=31536000.
  • Sharing-only refusal with no existing EC emitted no Set-Cookie and did not mint an EC.
  • Existing valid EC from the positive control with all-permission GPP was retained, without a refresh or expiration.
  • The same held EC with sharing-only refusal produced Set-Cookie: ts-ec=; Domain=.publisher.example.com; Path=/; Secure; SameSite=Lax; Max-Age=0; HttpOnly.
  • Repeated sharing-only request emitted no new cookie.
  • Tested RC base c3e33666604d5d3b6e043fc206931b3681c8f3bf; exact RC-integrated patch SHA256 5797ae93260998a65168854a2dc19d75fc6d54cb1d08ea5b1193566549669b1a. Tested binary SHA256 c76fe8bf82b882ea5f51087f0085162cb78dbd799e62ee6a56297844256e625f. The tested GPP decoder exactly matches the main-based candidate.
  • Initial fixture startup correctly rejected the reserved default example.com; switching to fictional publisher.example.com resolved the setup error without changing code or relaxing validation. This failed setup is not counted as an application regression.
  • Both owned processes stopped. Preserved exact request-result headers, build log, generated-field description, source patch and tested binary outside the repository. Reversed only the owned candidate patch and removed the clean scratch worktree, verifying its registration was gone. Implementation worktree remains for review/commit approval.
  • Runtime verification used only local HTTP fixtures, with no browser, DataDome interaction, staging/production task, deployment, or external mutation. No project-board changes or reviewer requests are part of this PR creation.

Checklist

  • Bug fix; feature specification requirement does not apply.
  • Changes follow AGENTS.md conventions.
  • No unwrap() introduced in production code.
  • No println! or additional logger introduced.
  • New behavior has generated-string regression tests.
  • No secrets or credentials committed; runtime fixtures use fictional values.

@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 11:14
@prk-Jr
prk-Jr added this pull request to stack #1719 December 1, 2026 13:25

@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 83e447d05 against main (db36dc0ec).

Approving so I'm not blocking, on the understanding that you'll handle the comments before merging. The field mapping checks out against iab_gpp 0.1.2 for every supported section, including the three without GPC (VA, UT, FL).

R1 · Nonblocking: please add a CHANGELOG entry. Out of the diff, so here instead of inline. Operators will see this: US-state readers whose GPP refuses sharing, targeted ads or known-child consent, or sets GPC, stop getting a new EC, and a held EC is expired on the next request. Recent user-visible fixes (#1516, #1493, #1429) added a ### Fixed bullet under [Unreleased]. One referencing #1695 would do.

Question, not blocking: Prebid's MSPA activity controls deny more cases than this does (for example any applicable under-13 value, including 2, and PersonalDataConsents == 2). This follows #1695's narrower rule. Do we want Prebid parity later?

Reminder, as you noted: ec/consent_update.rs:480 on rc/identity still reads us_sale_opt_out, so RC tests won't compile until that's renamed.

Checks: cargo test -p trusted-server-core --lib consent:: (125 passed), native clippy on core, rustfmt.

}
// Personal consent granted; MSPA covered, option and provider modes = no.
if personal {
bits.push_str("10");

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.

R2 · Nonblocking: this repeats the bits-to-base64url packing from encode_header. Both helpers pad to 6 bits, chunk, and map through the same URL-safe alphabet (encode_header around line 555). A shared test-only bits_to_base64url keeps the two fixture encoders from drifting apart.

_ => 3,
};
let personal = matches!(section_id, 7 | 8 | 13..=17 | 19..=23);
let gpc = !matches!(section_id, 9 | 11 | 13);

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.

R3 · Nonblocking: which sections lack a GPC field is written twice. !matches!(section_id, 9 | 11 | 13) appears here and again in each_state_refusal_blocks_minting_and_withdraws_ec (line 885). A us_test_has_gpc(section_id) next to us_test_opt_out_fields would keep the fixture and the expected fields in agreement.

"should allow minting without withdrawal for section {section_id}"
);
}
}

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.

R4 · Nit: missing blank line before this #[test]. Every other test in the module has one, and rustfmt won't add it.

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.

Treat every US GPP opt-out field as an opt-out

2 participants