Repository navigation
Conversation
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Reviewed 9aa868a37 against #1714's head (83e447d05); only this PR's diff.
Approving so I'm not blocking, on the understanding that you'll handle the comments before merging. No behavioral problems in what it sets out to do.
Policy questions I'd like answered, even if the answer is "intended":
- GDPR still only looks at TCF. With
gdpr.applies_inincludingUS, a reader sending GPC or a GPP US opt-out alongside a TCF grant still gets an EC, while the same reader in an unlisted country is now refused. That predates this PR, but the title says "across jurisdictions". Is GDPR meant to stay TCF-only? gpc_implies_optout = falsedoesn't exempt GPC from refusing and withdrawing in non-regulated and unknown jurisdictions.UsStatealready behaved this way. Confirm publishers shouldn't get an opt-out from GPC-as-refusal outside the US?
Coordination with #1718: docs/guide/configuration.md says an unresolved US region "currently falls back to NonRegulated", and all_states_switch_controls_unlisted_us_no_signal_creation asserts creation for region None. Both become wrong once #1718 lands.
Checks: cargo test -p trusted-server-core --lib filtered to consent, consent_config, the all-states settings test and finalize non-regulated (144 passed), native clippy on core, cargo fmt --check.
| // --------------------------------------------------------------------------- | ||
|
|
||
| /// Returns whether a decoded signal explicitly refuses EC storage. | ||
| fn explicit_refusal(ctx: &ConsentContext) -> bool { |
There was a problem hiding this comment.
R1 · Nonblocking: explicit_refusal duplicates the existing US-state withdrawal rule. The UsState branch of has_explicit_ec_withdrawal (around lines 601-617) computes the same thing as four early returns: GPC, GPP opt-out, USP opt-out, then !has_storage_consent(). All four are pure, so the copies agree today. But the next change to what counts as a refusal has to land in both, and if it doesn't, UsState and non-regulated withdrawal drift apart, which is the bug this PR fixes. Collapsing the withdrawal match to UsState(_) | NonRegulated | Unknown => explicit_refusal(ctx) keeps every decision the same and drops about 17 lines.
| return Jurisdiction::UsState(region.to_uppercase()); | ||
| // The all-states policy also covers US readers with no resolved region. | ||
| if geo.country.eq_ignore_ascii_case("US") { | ||
| if config.us_states.all_states { |
There was a problem hiding this comment.
R2 · P3 (logs and docs): UsState now carries values its docs and Display don't expect. With all_states = true this produces UsState("WY") for an unlisted state and UsState("US") when the region is unresolved. The variant doc still says "a US state with an active comprehensive privacy law", and Display prints the sentinel as US-US in the EC and consent context logs. #1718 fixes both (variant doc plus a "US" arm in Display). Either carry the same edit here or let #1718 land first and rebase, so whichever merges first doesn't leave wrong logs behind.
| /// Apply US state rules to every US reader, including unresolved regions. | ||
| /// | ||
| /// Defaults to `false`, using [`Self::privacy_states`] to select regions. | ||
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
There was a problem hiding this comment.
R3 · Nit: use the repo's is_false convention. settings.rs already does "skip while false so older strict readers accept the default" with skip_serializing_if = "is_false" and a doc paragraph explaining why (around settings.rs:106-110). Here it's std::ops::Not::not and the doc only says "Defaults to false". Since that rollback reason is the point of 9aa868a37, please add the sentence ("Skipped while false: UsStatesConfig denies unknown fields, so a default blob must stay readable by older binaries."), and optionally reuse settings::is_false.
dhruv8sh
left a comment
There was a problem hiding this comment.
Summary
This PR adds a shared explicit_refusal helper. In NonRegulated requests, a decoded TCF Purpose 1 refusal, GPC, a GPP US opt-out or a US Privacy sale opt-out now blocks EC creation, and in both NonRegulated and Unknown it withdraws a held EC. The PR also adds an opt-in consent.us_states.all_states switch, and the switch is serialized only when it is true, so older strict readers can still parse the default config. The logic is correct, GDPR still takes precedence, and the tests cover every refusal signal, a real decoded TC string, finalizer cookie expiry with a tombstone write, and serialization in both directions. I found no blocking issues. The open points are a policy question about applying GPC to every reader, a docs example that conflicts with the PR's own rollout guidance, and a cosmetic log label.
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 other comments are discussion points or need no change.
Non-blocking
🤔 thinking / ⛏ nitpick
- GPC now withdraws ECs for every non-regulated reader, and
gpc_implies_optoutcannot turn this off — see inline atcrates/trusted-server-core/src/consent/mod.rs:509 - Uncommented
all_states = falsein the GDPR guide's example breaks older TOML readers — see inline atdocs/guide/gdpr-compliance.md:104 - An unresolved region shows as
US-USin logs — see inline atcrates/trusted-server-core/src/consent/jurisdiction.rs:70
👍 praise
- The default stays readable by older binaries — see inline at
crates/trusted-server-core/src/consent_config.rs:194
Cross-cutting / body-level findings
- 🏕 The configuration guide no longer lists the removed
consent_storekey — the old table still describedconsent_storeas an optional KV store, but the key is already rejected (settings_rejects_removed_consent_store_toml). This PR fixes that stale entry.
| /// Returns whether a decoded signal explicitly refuses EC storage. | ||
| fn explicit_refusal(ctx: &ConsentContext) -> bool { | ||
| effective_tcf(ctx).is_some_and(|tcf| !tcf.has_storage_consent()) | ||
| || ctx.gpc |
There was a problem hiding this comment.
🤔 thinking — Treating ctx.gpc as an explicit refusal in NonRegulated is a big change in practice. Some browsers send Sec-GPC: 1 by default (Brave, for example), so from this release on, every such reader in any unregulated country loses their held EC and never gets a new one.
That is consistent with the UsState branch, which also ignores us_privacy_defaults.gpc_implies_optout. But the change also means a publisher has no config switch to limit GPC handling to regulated regions. Two points to settle:
- Is that the intended product decision for Honor explicit refusals in every jurisdiction #1708? If so, please add a sentence to
docs/guide/configuration.mdsayinggpc_implies_optout = falsedoes not stop GPC from withdrawing ECs inNonRegulatedorUnknown. As written, that table row ("TreatSec-GPC: 1as sale opt-out") suggests it does. - Expect a visible drop in EC coverage outside the US and EU after rollout. Release notes should call this out.
|
|
||
| [consent.us_states] | ||
| # Apply US state rules to every US reader, even without a resolved region. | ||
| all_states = false |
There was a problem hiding this comment.
⛏ nitpick — This example writes all_states = false uncommented. The PR's own rollout notes in configuration.md say older tools that read TOML directly reject the key even when it is false, so a publisher who copies this example and then uses an older CLI or binary gets a parse error. Commenting it out matches trusted-server.example.toml and keeps the example valid for every reader.
| all_states = false | |
| # all_states = false |
| // The all-states policy also covers US readers with no resolved region. | ||
| if geo.country.eq_ignore_ascii_case("US") { | ||
| if config.us_states.all_states { | ||
| return Jurisdiction::UsState(geo.region.as_deref().unwrap_or("US").to_uppercase()); |
There was a problem hiding this comment.
⛏ nitpick — When the region is unresolved, this produces UsState("US"), and Display turns that into US-US in the jurisdiction= debug and info logs (consent/mod.rs:684, ec/mod.rs:346, ec/mod.rs:394). Nothing depends on the label, so it works. But a reader of the logs can't tell "region unresolved" apart from a real region code. A sentinel such as "UNRESOLVED" (US-UNRESOLVED) would be clearer if you want to change it. The all_states_applies_us_rules_with_or_without_region test would need the same change.
| /// Apply US state rules to every US reader, including unresolved regions. | ||
| /// | ||
| /// Defaults to `false`, using [`Self::privacy_states`] to select regions. | ||
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
There was a problem hiding this comment.
👍 praise — Using skip_serializing_if = "std::ops::Not::not" together with the strict LegacyUsStatesConfig test is a careful way to keep the "push config with a newer CLI before upgrading the binary" flow working with deny_unknown_fields readers. The test that an enabled payload is rejected by the legacy reader also documents the rollout ordering well.
PR #1717 stays on PR #1714's branch, which now sits on PR #1662's branch, the top of the identity chain trunk, instead of main. PR #1714's new head brings the identity integration chain as of round 12 wave A under #1714's US GPP opt-out fix. crates/trusted-server-core/src/consent/jurisdiction.rs: #1717 lets `us_states.all_states` apply US rules to every US reader and adds two tests for it. The chain reworded the module docs, imported consent_allows_server_side_auction for its tests, and added publisher list and geography tests at the same place. The resolution keeps #1717's detection change, the chain's import, and both sets of tests, the chain's first. With all_states off, #1717 leaves detection unchanged, so the chain's tests keep their expectations. crates/trusted-server-core/src/ec/finalize.rs: #1717 added a test that a non-regulated TC Purpose 1 refusal expires and tombstones a held EC. The chain made finalize async with a FinalizeRequest and made its tests tokio tests. The resolution keeps the chain's tests and ports #1717's test to the async graph and FinalizeRequest, with no navigation permit, since withdrawal tombstones on any finalized request. docs/guide/configuration.md: #1717 added the `us_states.all_states` row to the consent table and rewrote the intro about the removed consent_store key. The chain rewrote the same intro to describe the one EC record service. The resolution keeps the chain's intro and #1717's table with the new row. crates/trusted-server-core/src/consent/mod.rs (merged clean, failed to compile): #1717's unlisted_country_decodes_purpose_one_refusal test builds a GeoInfo with main's fields. The resolution builds the chain's GeoInfo with GeoInfo::country_region("JP", None).
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.
|
Round 12 identity realignment:
Merges #1714's new head, now on the identity chain. The refusal-tombstone test is ported to the async Each merge message says what it carries and how any conflict was resolved. |
PR #1714'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.
PR #1714'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, #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, #1661's grouped QUIC JA4 fixture and #1662's consent-string comment on the EC route 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.
|
Round 15 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
|
Cascade of #1533's Axum startup-test port fix ( |
…tegration chain
|
Merged #1627's runtime KV removal ( At the maintainer's request, that commit removes the generic runtime KV store Only that commit was merged, not the base branch's new head. Conflicts were resolved in Checks on this head: no reference to the removed store remains and |
|
Round 17 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
Trusted Server owns the `/_ts/` namespace: a request for a `/_ts/` path that no route handles is answered locally on every adapter and never reaches the publisher origin. The publisher forward answers such a path with a JSON 404 before any auction, template cache or origin work. The path is matched on its percent-decoded bytes, so `/%5Fts/x`, `/_ts%2Fx` and multi-encoded spellings count, even when another escape in the path is not valid UTF-8. Registered routes and integration or asset routes configured under `/_ts/` keep working, and publisher paths such as `/_tsx`, `/_ts-foo` and `/articles/_ts/x` still reach the origin. The `/_ts/admin` fallback answers are unchanged.
…ntegration chain
|
Merged #1614's Trusted Server owns the This merge takes Checks on this head: no conflict markers; |
Summary
consent.us_states.all_statesto apply US rules to every US reader, including unresolved regions. No signal still permits NonRegulated creation.Stacked on #1714. Implementation branch:
fix/1708-explicit-refusals-everywhere. PR target:fix/1695-us-gpp-opt-out-fields; base commit83e447d052483520422e9e43ef7d6303d447e6a2. Retarget tomainafter #1714 merges.Changes
crates/trusted-server-core/src/consent/mod.rscrates/trusted-server-core/src/consent/jurisdiction.rscrates/trusted-server-core/src/consent_config.rscrates/trusted-server-core/src/settings.rscrates/trusted-server-core/src/ec/finalize.rstrusted-server.example.tomldocs/guide/configuration.mddocs/guide/gdpr-compliance.mdCloses
Closes #1708
Spec
The new configuration option is specified in Explicit refusals and optional US policy for all states, with two independent review rounds recorded. The existing refusal bug fix accompanies that option.
Related changes
#1705 is separate: it maps a US request with no resolved region to
UsState("US")regardless ofall_states. With both changes, missing US region always uses strict US rules and no signal does not mint. For a resolved unlisted state,all_states=falsepreserves NonRegulated no-signal creation while honoring explicit refusals;all_states=trueapplies US rules and requires a signal. Listed states keep US rules. Publisher-configured GDPR classification retains precedence.#1613 follow-up, intentionally outside this patch: in
verify_country_only_consent_rulesin the Fastly identity conformance suite (the case linked by #1708), replace theexpired == gdpr_overrideexpectation with unconditionalassert!(expired, "should expire held EC after explicit refusal regardless of GDPR override"). Replace therecord_is_live(...) == !gdpr_overrideexpectation with unconditionalassert!(!geo_consent::record_is_live(&adapter.store, &identity), "should tombstone held identity after explicit refusal regardless of GDPR override"). Both iterations should expire and tombstone the held identity. No conformance file is imported here.Test plan
The following targeted checks ran before commit approval on the reviewed source. No CI gates were rerun for publication; full CI is delegated to GitHub Actions, with CI failures reported by the author. Signed commit
91430630979dd73507552081825e08e3a5e25329contains the exact reviewed/tested patch; its diff SHA256 matches the review record.cargo test --locked -p trusted-server-core --lib consent::: 130 passed.cargo test --locked -p trusted-server-core --lib consent_config::: 10 passed.cargo test --locked -p trusted-server-core --lib settings_parses_us_all_states: 1 passed.cargo test --locked -p trusted-server-core --lib ec::finalize::tests::: 42 passed.cargo clippy --locked -p trusted-server-core --all-targets --all-features -- -D warnings: passed.git diff --check: passed.Follow-up correction
9aa868a37omits disabledall_statesduring serialization so strict older readers accept the default configuration; enabled true remains explicit and requires a supporting binary. Actual full-source native checks pass: Settings 219, consent configuration 12, consent policy 130, EC finalization 42, and core all-target/all-feature Clippy. Restoring default-false emission fails both compatibility and actual Settings regressions. The required spec passed two independent review rounds and includes propagation-aware rollback. All 24 current-revision hosted checks pass, with workflow records confirming head9aa868a371625f884ddf2f291ad7f281fee55cb6and base83e447d052483520422e9e43ef7d6303d447e6a2; prior runtime qualification remains separate.Runtime verification: VERIFIED on the actual Axum application in the author-approved disposable RC integration. Main-based Axum lacks geo and EC lifecycle wiring; this is RC integration evidence, not a main-only Axum certification.
trusted-server-axumusingcargo build --locked -p trusted-server-adapter-axum --features geo-cloudfront, Rust 1.98.1, Node 24.20.0, with dev debug info disabled. No adapter/wrapper or EdgeZero source changes.c3e33666604d5d3b6e043fc206931b3681c8f3bfplus Honor all decoded US GPP opt-outs #1714 and this candidate; integrated patch SHA256cabf974831d9a4cf84eb1f6ad43cd3cf1f89b1bbb80a03a22960c237b535f67e. Tested binary SHA256ea50da42eea9db9eacd9aafc77993837496ffcba33c8fb5e35f7914668160aff.us_sale_opt_outassertion still needs its Honor all decoded US GPP opt-outs #1714 migration before RC test compilation; that test is excluded from the normal runtime build.publisher.example.comconfig loaded through the supported local config-store envelope, fake secret references, loopback origin and persistent records. All ten requests returned 200, the origin sentinel andx-geo-country: JPwith no region. Logs confirmed NonRegulated and decoded TCF/direct GPC reached EC eligibility.Max-Age=31536000; an existing no-signal EC was retained without refresh or expiry.ts-ec=; ... Max-Age=0. Repeated refusal did not mint.Sec-GPC: 1blocked minting and expired another separately minted live EC with the same deletion attributes. Repeated GPC did not mint.Checklist