Repository navigation
Conversation
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Reviewed 57f2772ee against main (db36dc0ec).
Approving so I'm not blocking, on the understanding that you'll handle the comments before merging. The click gate itself looks right.
R1 · Nonblocking: docs/guide/creative-processing.md still describes the old click behavior. This one sits outside the diff, so it's here instead of inline. Lines 139-146 still say /first-party/click "appends the request's ts-ec value to the landing URL and logs the click with it" and that "both endpoints forward whatever EC ID the request carries". After this PR, click only appends ts-ec when current-request consent allows it and logs a redacted prefix, while /first-party/proxy still forwards unconditionally. Please reword that paragraph and keep "neither switch is a consent control". The dated design spec with the same wording can stay as it is.
Questions:
- When consent is denied, a
ts-ecthe creative already signed into the target still goes through (click_consent_refusal_preserves_existing_signed_querylocks that in). Stripping it wouldn't affect signature validation, because the target is rewritten after validation. Is keeping it intended? - The info log also drops
tsurl, Referer and User-Agent. The issue only asked to redact the EC and drop the EC-bearing target. Was losing the click destination in logs deliberate?
Checks: cargo test -p trusted-server-core --lib -- click proxy_disclosure allows_eid (25 passed), native clippy on core, cargo fmt --check. I relied on CI for the adapter and wasm targets.
| } | ||
|
|
||
| #[test] | ||
| fn click_consent_purpose_four_controls_ec_disclosure() { |
There was a problem hiding this comment.
R2 · P3: the expired, non-US GPC and unknown-jurisdiction denials have no tests. allows_proxy_ec_disclosure is !ctx.expired && !ctx.gpc && allows_ec_creation(ctx) && allows_eid_persistence(ctx), but none of these click tests can fail on the first two terms. In a US state, allows_ec_creation already rejects GPC. The shared helper sets check_expiration = false, so expired is never true. The EcContext::default() tests carry no EC, so the fail-closed path for missing geo isn't covered either. Dropping !ctx.expired && !ctx.gpc while resolving the RC conflicts in proxy.rs would keep every test green.
The simplest fix is to port RC's proxy_disclosure_requires_current_consent_beyond_creation table test into consent/mod.rs unchanged; TcfBuilder already exists on main. That also keeps the two branches identical. Alternatively, add click cases for GPC under DE or non-regulated, an expired TC string, and an EC with an unknown jurisdiction.
Summary
main(db36dc0e). Both branches are affected; this keeps the fix independent ofrc/identity's broader identity changes. Main lacks the disclosure helper, so this adds the same small predicate already on RC.Changes
crates/trusted-server-core/src/consent/mod.rscrates/trusted-server-core/src/proxy.rscrates/trusted-server-adapter-fastly/src/app.rscrates/trusted-server-adapter-axum/src/app.rscrates/trusted-server-adapter-cloudflare/src/app.rscrates/trusted-server-adapter-spin/src/app.rsPreviously clicks appended an available cookie/header EC regardless of consent and logged the full EC/target. Now insertion requires disclosure consent; denial leaves the validated target unchanged, including an existing signed query. Signed-target, HMAC, and expiry validation still run before disclosure. Info/debug click logs redact the EC and omit target URLs.
Closes
Closes #1693
Related jurisdiction policy
This patch applies the existing disclosure predicate; it does not change jurisdiction detection. Country-only US geography still selects
NonRegulated, including Cloudflare's country-only geolocation, so US opt-outs remain unenforced on that path until the separate #1705 fix in #1718. Purpose 4 refusal and GPC remain gated by this patch. The guide and API reference now describe current-request consent, denied-target preservation and redacted click logging.Spec
Not a feature; this fixes an existing consent-disclosure bug.
Test plan
The following evidence was collected during implementation, before publication. No gates or tests were rerun for commit/PR creation; the installed URL-host commit hook was deferred to CI with a command-scoped override. Full required gates remain for PR CI. Tools used for prior scoped checks: Rust 1.98.1, Node 24.20.0, Viceroy 0.22.0.
ts-ec; both pass with the fix. Full consent retains it.Pre-publication independent local review: READY TO REQUEST REVIEW for the scoped implementation checks, with zero blocking code findings and zero outstanding optional findings. One private-helper documentation mismatch was corrected and rechecked. The readiness decision uses source inspection and scoped test/lint evidence; it is separate from hosted CI and deployed-runtime qualification.
Local runtime verification: VERIFIED for the real Axum application router/server over TCP, using fictional settings and fixed Germany geo through the existing service-injection API. Default dev geo is unavailable and therefore fails disclosure closed; this fixture explicitly exercises both consent branches. Curl observed:
Repeated full consent also retained the EC. Invalid signatures returned 403 under both consent outcomes. The actual info log sink emitted four redacted records, with no full EC or target URL:
No browser or deployed runtime was exercised. The owned local server was stopped after verification.
RC trial: a commit-free three-way integration of the final patch into
origin/rc/identity(c3e33666), withmainconfirmed as its ancestor, found conflicts incrates/trusted-server-adapter-spin/src/app.rs(fallible request/service setup) andcrates/trusted-server-core/src/proxy.rs(production/test imports). RC's Axum patch applies textually but needsstate.identity.read_request/ec.contextin place of main's absent-on-RCbuild_ec_context. The consent helper applies cleanly and is identical. Conflicts were recorded; the disposable trial worktree was restored and removed. No merge commit was created or pushed.Checklist
unwrap()or logging viaprintln!.