Skip to content

Extract the protected CloudFront Geo baseline - #1532

Open
ChristianPavilonis wants to merge 42 commits into
baseline/native-aws-20261110from
baseline/protected-geo-20261110
Open

ChristianPavilonis wants to merge 42 commits into
baseline/native-aws-20261110from
baseline/protected-geo-20261110

Conversation

@ChristianPavilonis

@ChristianPavilonis ChristianPavilonis commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Current review follow-through

Current head: 7d6b7a1b9.

  • Restored shared jurisdiction behavior and real Geo-to-auction/publisher-credential coverage in 60617bd9a.
  • Normalized native profile/hosting errors to typed reports and derived Display, preserving safe diagnostics and excluding private inputs. Added diagnostic/redaction regression tests.
  • Clarified optional Geo-header guarantees and added 50 descriptive messages without changing existing Geo assertion predicates or expected data.
  • Local Core, native adapter, parity, Fastly, default/Geo/all-feature Axum, all eight target-matched Clippy lanes, formatting and changed-lines domain checks pass. Existing ignored cases remain explicit. A fresh independent final review found no findings.
  • The Geo-enabled hosted test step is present and passed at 60617bd; the historical artifact-upload outage is no longer current. Hosted workflows for this head are still pending or running; their results are not counted as local proof.
  • All 12 inline threads now have explanations and are resolved. Re-review is requested from aram356 and dhruv8sh; their verdicts were not dismissed.

This PR remains draft. The temporary TS Geo-profile retirement waits for TS #1573 and EdgeZero's manifest binding #482/integration tag #491. The shared header-clearing refactor and pre-existing Fastly absent-Geo behavior remain explicitly deferred. Native EC-creation proof, final main-bound integration and live cloud qualification are not claimed. Issue #1529 remains open.

Historical baseline and verification receipts follow.


Summary

  • Default-off CloudFront boot profile, one immutable request outcome and absent optional detail.
  • Reorganize the existing working demo using EdgeZero83d7a629, not current-main forwarding compatibility.

Draft baseline review unit. Not a current-main merge candidate, deployment approval or completed current-head CI claim.

Baseline and sequence

Head: affb0d0a4c0a1f3b9ac00d11c12de1f45080a8ce. Base: baseline/native-aws-20261110.

Historical main anchor: 2dd968aeebeb2cc0d5110115f64e0ad58e2e1d13. Original demo: TS2423a2ed plus separately preserved dirty inputs. Matching EdgeZero: draft431, exact revision 83d7a6296d285e135c4ea70021b19e6c8dca7e9f.

The user selected compatible-baseline cleanup. Current-main integration with EdgeZero462 and the authenticated-forwarder incompatibility are deferred. Preserve current-main PR1525/1526 ready and1527/1528 draft, with their existing bases. No excluded1499 or independent1506 implementation, relay/privacy experiment, new transport fallback, group/codec/phase design or operational deployment is included.

Changes

Area Change
This unit Default-off CloudFront boot profile, one immutable request outcome and absent optional detail.
Unchanged work Original checkouts, dirty Prebid inputs, recovery references and existing PRs remain preserved.

Closes

Refs #1530. This unit completes one part of the baseline extraction and does not close the overall tracker on its own.

Spec

Not a new feature. This is extraction of existing demo behavior and bounded build/caller corrections. Original native and EC storage design/review records remain in the baseline where applicable; they are not presented as approval of later combined source. No new forwarding, consent, timer or provider policy is designed here.

Test plan

Core3002 and native all-feature suites pass, including10 real startup cases. No production KV Geo, local Geo database, new consent authority or cloud acceptance is added.

  • Required current-head hosted checks complete before ready-state transition.
  • Final baseline combined-check results recorded with exact input revisions and limitations.
  • Focused failures and corrections retained rather than assertions relaxed.

The b67ffc6 baseline checkpoint has passing documented local gates: Fastly/default/reuse/native/Cloudflare/Spin suites, all adapter strict lint lanes, 17 cross-adapter parity cases, 1252 JS cases, CLI suites, formatting, clock/digest/proposal checks and changed-lines domain lint. Passing checks at121ebcc36 are reused only for unchanged relevant inputs; the final follow-up covers the CLI test-import and documentation-only corrections. These results are not a substitute for this PR's current-head hosted checks.

Checklist

  • Existing behavior extracted into a scoped review unit.
  • Public examples use fictional inputs and no licensed Geo data.
  • No deployment, main merge, old-RC closure or recovery deletion.
  • No new worker launched or paused experiment resumed.
  • Review readiness confirmed independently from later units.

Operational Terraform remains in trusted-server-deployer. Local checks and prototype tests do not qualify cloud access, fleet durability or a live publisher.

Hosted docs-build correction

The first hosted format-docs job caught an additional site-build gate that the original local formatter checkpoint had not run: a relative link from the native EC guide to a Terraform example outside the site. Native EC correction8b11dbad3 replaces it with the plain repository path; no dead-link check is disabled. That docs-only correction is carried through the existing upper PR identities. Native EC and final integration8985b111 both pass docs ESLint and VitePress build; the final docs formatter also passes. Runtime, dependency, image-build-context and test inputs are unchanged from b67ffc6, so their prior exact-input proofs are reused. Hosted current-head checks still control readiness.

Startup negative-probe correction

A hosted native EC case failed the no-listener probe while its child logged the expected startup validation failure. The old log has no socket endpoints, so the failure's exact subtype is not claimed confirmed. A separate controlled Linux reproduction demonstrates a successful TCP self-connection with no listening server. Native correction8490c691d distinguishes equal local/peer endpoints from a real listener; actual socket controls prove the self-connection is excluded and a real listener is still detected. Nonzero exit, expected diagnostic, secret-redaction and the original startup deadline remain required. This changes only the acceptance fixture, not production admission, transport or trust.

The earliest native unit and final9356c557 default/all-feature acceptance checks and strict lint pass, including both controls and the original failure case. Ignores remain explicit; earlier separately executed celld proof is not relabeled as a new ignored-case run. Correction is merged upward through existing PR identities without force-pushing or retargeting. Current-head hosted checks must pass; the old failure is retained rather than rerun-only waived. Runtime/API/dependency inputs remain unchanged. A fresh exact9356 producer build and real runtime smoke now pass: image sha256:65a735d38e9dbc0573d0f6068a8b261bd202c43aea05085c2b2d6bccc91ebdbd, linux/amd64 UID/GID10001, including startup rejection and in-flight SIGTERM drain. Prior b67 image receipts remain separate; no image was pushed. All local parent runners are complete.

Browser CI host compatibility

Preserved older browser failures show Playwright1.58.2 rejecting ubuntu-latest's new Ubuntu26.04 image before browser installation; later missing-executable failures are consequences, not passing browser tests. Nativeb1216763a pins only the browser job to ubuntu-24.04, leaving dependency versions, tests and assertions unchanged. Direct Actionlint1.7.12 passes at the owning native and final integration points; the first shim-only attempt could not run because no global version was configured, and is not counted as lint proof. No global tooling was changed. The only9356 ->ee7 delta is this workflow host/comment; runtime, Cargo, docs, tests and Docker-context inputs are unchanged. Actual browser execution on the supported hosted runner remains pending and must pass before readiness. No waiver or browser skip.

Reconciliation refresh above the new PR 1506 head

Merge-forward head 9075b4b391c84bc5954d7b8a92f810251d2657be retains original public 852b875fe617048ea8aae39d0b74ce9a999fb1bc, previous local candidate 8f517932294472b768928528c6d40db03806978d and updated parent bf3569dd9b9d30290b7b18e284642edf9f67b336. The original feature patch is unchanged. Aram's #1516 code/tests/spec are preserved upstream rather than duplicated as another owned production port. The existing PR identity, feature boundary and readiness remain intact.

Fresh shared-root and combined RC qualification passes on the refreshed source. Reused JS/Chrome/storage/wrapper/Terraform evidence is explicitly fingerprinted, not claimed as a new execution. Source-image proof is bound to refreshed #1539, not a new RC release. Fresh hosted/macOS, digest-backed wrapper/RC images, other external browser/framework lanes and live AWS/publisher/CMP acceptance remain unverified. Ignored/unexecuted cases and original failed receipts are not counted as passes. Historical claims above remain bound to their named old inputs. No tag, registry publication or deployment is included.

Published snapshot; newer upstream integration pending

Published deliberately for review from the qualified #1506 checkpoint 57d7c6ad8db43601ef31c1e1d1615e6dd2aa6a6a. At publication the moving author branch was at 628474ec4a8cee8361a6927ae6b79b68fdd33a55. Newer upstream bounded-response handling, per-profile RTB caps and Sourcepoint changes are not incorporated or qualified in this snapshot. Further merge-forward reconciliation and conflict resolution may be needed before merge. Local results above describe this exact qualified source, not a merge with the newer base or a release.

@prk-Jr prk-Jr 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 affb0d0a4c0a1f3b9ac00d11c12de1f45080a8ce against baseline b1216763a3c2a38df1a2909285330e818823423a. No actionable findings.

Reviewed native Geo admission and startup, request isolation, response finalization, optional-field serialization, consent handling, and affected auction consumers.

Local verification: cargo test --locked -p trusted-server-adapter-axum --all-features --test startup passed all 10 tests, including CloudFront trust rejection and error-response finalization, using Rust 1.98.1 and Node 24.12.0. Head and base were rechecked and remain unchanged.

This approval covers the historical baseline unit. Current-main compatibility and live AWS qualification remain outside scope. Main-only CodeQL did not run.

CI status: all 17 reported checks PASS at the reviewed head:

  • integration tests
  • integration tests (Fastly EC lifecycle)
  • browser integration tests
  • docs-proposal scripts
  • cargo test (cross-adapter parity)
  • cargo test (axum native)
  • cargo fmt
  • CLAUDE.md symlink guard
  • cargo test (ts CLI, native) (macos-latest)
  • cargo check/build/test (spin native + wasm32-wasip2)
  • vitest
  • cargo test (ts CLI, native) (ubuntu-latest)
  • cargo check (cloudflare native + wasm32-unknown-unknown)
  • cargo test
  • format-docs
  • format-typescript
  • prepare integration artifacts

@ChristianPavilonis
ChristianPavilonis marked this pull request as ready for review November 11, 2026 13:47
Retain the existing Geo feature head while projecting private managed outcomes into partial request-local geography. Preserve current-main trace privacy, direct outbound APIs, startup router ownership and ingress diagnostics. Do not restore backend or HTTP compatibility bridges.

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

Reviewed 0ae96ef5f against baseline/native-aws-20261110 (merge base 65ba4f3df). The CloudFront path itself is well bounded: EdgeZero handles admission, credential stripping and assertion parsing; TS reads only the immutable RequestContext::geo(); and populated fields keep their flat wire names. Changes are needed because:

  • The jurisdiction rule change reaches every adapter, so Cloudflare US traffic loses server-side auctions and EC creation.
  • The CloudFront tests never run in CI, and no test proves geography reaches consent.
  • Native startup lost its environment diagnostic.
  • At this head, the integration, Fastly EC lifecycle and browser jobs were skipped.

2 of the inline comments below carry a one-click GitHub suggestion. Use Commit suggestion (or Add suggestion to batch for both) to apply them. The other comments describe the fix in prose because it touches several files or lines outside the diff.

Blocking

🔧 wrench

  • US without a region now fails closed on every adapter (Cloudflare US auctions and EC blocked): see inline at crates/trusted-server-core/src/consent/jurisdiction.rs:71-74
  • Geography-to-consent wiring is untested (mutation survives): see inline at crates/trusted-server-adapter-axum/src/platform.rs:166
  • Native startup drops EdgeZero's environment diagnostic (suggestion): see inline at crates/trusted-server-adapter-axum/src/main.rs:60
  • Use the full TRUSTED_SERVER__ env prefix, one name everywhere: see inline at crates/trusted-server-adapter-axum/src/native_geo.rs:14
  • CloudFront tests never run in hosted CI: see Cross-cutting below
  • Failed CI check skipped the integration and browser jobs at this head: see Cross-cutting below

Non-blocking

  • ♻️ One core helper for geo response headers (Axum duplicates the clearing, Fastly's None branch skips it): see inline at crates/trusted-server-adapter-axum/src/middleware.rs:183-193
  • 🤔 Credential-absence assertions check the response, where the request header can't appear: see inline at crates/trusted-server-adapter-axum/tests/startup.rs:350-351
  • ⛏ derive_more::Display and error-stack for the new errors: see inline at crates/trusted-server-adapter-axum/src/native_geo.rs:27
  • ⛏ Imports inside test function bodies: see inline at crates/trusted-server-core/src/consent/jurisdiction.rs:236
  • ⛏ set_response_headers doc overclaims for Fastly (suggestion): see inline at crates/trusted-server-core/src/geo.rs:24
  • ⛏ Assertions without messages: see Cross-cutting below

Cross-cutting / body-level findings

  • 🔧 CloudFront tests never run in hosted CI. cargo test-axum (.github/workflows/test.yml, test-axum job) runs with default features. From the new tests it runs only compiled_out_geo_selection_fails_before_store_preparation_and_listen and invalid_geo_profile_fails_before_store_preparation_and_listen. Three tests, and the geo-cloudfront branch of selected_implementation_is_explicitly_validated, are only compiled by clippy-axum --all-features, never run:

    • managed_geo_is_partial_immutable_per_request_and_finalized_on_auth_errors
    • admitted_body_error_keeps_managed_geo_without_losing_framework_status
    • nonmatching_real_socket_peer_cannot_supply_geo

    They pass locally with cargo test -p trusted-server-adapter-axum --features geo-cloudfront. Please add that as a step in the test-axum job.

  • 🔧 prepare integration artifacts failed, so the downstream jobs never ran at this head. The failure is in actions/upload-artifact: Failed to CreateArtifact ... Unexpected token '<', "<!DOCTYPE "... is not valid JSON after 5 attempts. The artifacts built fine, so this is GitHub-side. As a result, integration tests, integration tests (Fastly EC lifecycle) and browser integration tests were skipped. The previous approval covered affb0d0a4, before the two EdgeZero tag merges. Please re-run the workflow so those jobs execute at the current head. No required checks are configured on this base branch, so this is a gate AGENTS.md treats as required rather than one branch protection enforces.

  • ⛏ Assertions without messages. AGENTS.md asks for a descriptive message on every assertion. Examples among the new tests:

    • crates/trusted-server-adapter-axum/src/platform.rs:241-245
    • crates/trusted-server-core/src/platform/mod.rs:305, :311-312
    • crates/trusted-server-core/src/consent/jurisdiction.rs:221-227, :247-248
    • crates/trusted-server-core/src/geo.rs:243-244, :251
    • crates/trusted-server-core/src/integrations/prebid.rs:6667
    • crates/trusted-server-core/src/integrations/aps.rs:2437
    • crates/trusted-server-adapter-cloudflare/src/platform.rs:893-894, :934
    • crates/trusted-server-adapter-axum/tests/startup.rs:342-344

CI Status

  • browser integration tests: SKIPPED (upstream artifact job failed)
  • integration tests (Fastly EC lifecycle): SKIPPED (upstream artifact job failed)
  • integration tests: SKIPPED (upstream artifact job failed)
  • prepare integration artifacts: FAIL
  • cargo check (cloudflare native + wasm32-unknown-unknown): PASS
  • cargo test (cross-adapter parity): PASS
  • cargo test (axum native): PASS
  • vitest: PASS
  • cargo test: PASS
  • cargo test (ts CLI, native) (ubuntu-latest): PASS
  • cargo test (ts CLI, native) (macos-latest): PASS
  • cargo fmt: PASS
  • format-typescript: PASS
  • docs-proposal scripts: PASS
  • format-docs: PASS
  • CLAUDE.md symlink guard: PASS
  • cargo check/build/test (spin native + wasm32-wasip2): PASS

No checks are marked required on baseline/protected-geo-20261110.

Comment thread crates/trusted-server-core/src/geo.rs Resolved
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize.

The merge had no conflicts.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.
aram356 added a commit that referenced this pull request Nov 25, 2026
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624, #1641, #1642 and #1646, with #1646's move of the request
time into IdentityApp::finalize. It also brings d5276ee, which publishes
the native AWS runtime files without GNU mv -T, and Christian's merge
5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

This PR already carries #1646's head 461aa0d, so the merge adds only
#1646's new merge 166944769 of #1642 and the chain below it, including the
identity conformance check that now strips the mirrored UID's exp.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

Restacking on the Axum serving line conflicts in the Axum startup tests,
where #1617 waits for /ready, since liveness stays up after a caught
initialization failure, and this PR rewrites the wait to retry a port
collision and to require the child's own ready lifecycle event.

Axum startup tests: wait_ready keeps this PR's collision retry and
lifecycle check, then probes #1617's /ready and returns the /health
response once the child is ready.

The fixture drains each child's output through this PR's log readers, so
#1617's assert_serves_failure_router reaps the stopped child and reads
those captured logs instead of collecting the pipes, which the readers
already own.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

This PR now stacks on #1661 instead of #1646, so rc/identity can take both
as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the
merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly
and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661
(refusing EC creation when a trusted JA4 contradicts the User-Agent).

Fastly identity conformance fixture: #1661 records each scenario's runtime
TLS JA4 through a RuntimeTlsJa4 middleware in place of derived device
signals, takes the User-Agent from the scenario and drops the browser flag.
This PR adds geo consent requests with their own trusted client IP settings
and no browser device signals. The merge assembles the conformance app with
#1661's middleware and keeps this PR's geo_configured flag and
producer_settings. It sends the scenario's User-Agent unless the API request
supplies one, and inserts the scenario's JA4 only for requests without a geo
consent exchange, because this PR derived device signals only for those.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv, #1488's a610152 and
9104fd3, which add hashed-email intake for the LiveRamp and ID5
identity providers, #1646's aa31559, which gates identity writes for
rejected clients, and #1626's d07f789, which withholds a mirrored UID
while another source owner is opted out.

Fastly conformance JA4: the rebuilt #1661 merge supplies a trusted Python
JA4 behind the Chrome User-Agent for #1646's known non-browser API
requests, and this PR inserts the scenario's JA4 only without a geo
consent exchange, with its producer_settings. The merge keeps both: a
known non-browser request gets the Python JA4, any other request the
scenario's JA4 unless it is a geo consent exchange.

This PR's head moves to e8015ca, its clean merge of #1646's aa31559,
which the base already carries, so it adds no change beyond the base.

Axum lib.rs: the base now carries #1636, through #1626's merge of it, whose
after_response_drain_tests module sits where this PR adds its
geo_conformance module. The crate keeps both test modules.
aram356 added a commit that referenced this pull request Nov 25, 2026
This brings in 1f054c6 from #1488, which forwards ortb2.user.ext.eids
from the Prebid config into the auction EIDs, and a99dd66, a62601b,
d1eb75f and 394892b from #1489, which cap mirrored UID expiry at 30
days from the UTC day start and pass the request time into finalize. They
arrive through the chain's merges into #1639, #1640, #1612, #1628, #1623,
#1531, #1532, #1533, #1534, #1536, #1535, #1537, #1539, #1538, #1540,
#1566, #1624, #1641, #1642 and #1646, with #1646's move of the request
time into IdentityApp::finalize. It also brings d5276ee, which publishes
the native AWS runtime files without GNU mv -T, and Christian's merge
5597d3e of #1538 into #1540, through #1566's merge.

The base now also carries the Axum serving line (#1613, #1616, #1617, #1615,
#1635, #1637 and #1627), which #1533 merged, and #1627's b958107, which
decodes the Spin discovery document with Response::json, and #1627's merge
of #1625 (006b45e), which pins Wrangler for the Cloudflare smoke and CI.

The merge also brings the 12 #1646 commits this PR lacked, from 48a43ae
to 461aa0d: dhruv8sh's page-phase lookup and /auction EID work
(48a43ae, 82fe088, 1d0a74f, 838586e and his chain merges a061c01,
ecf16e8, e1d23a0, edcf4c5 and 9a020e1), the merge 9cad928 of
#1641 into #1642, and prk-Jr's "Merge providers-awaited into shared
identity" (4ffbaf8) and "Restore Fastly auction browser gating"
(461aa0d).

Edge cookies guide: a conflict is the request lifecycle paragraph.
The merge takes #1646's sentences on positive identity cookies, core
expiries and /auction body EIDs, and keeps this PR's closing sentences on
the default ec.sliding_refresh = false flow and sliding renewal.

Fastly adapter tests: 82fe088 from #1646 removed the navigation-lookups
thread-local and the page-lookups argument of apply_edgezero_ec_finalize,
since the handler now collects page lookups onto the EC context. This PR's
sliding_ec_renews_held_publisher_identity_before_terminal_privacy test
drops its two take_navigation_lookups calls and passes no page lookups to
finalize. Its configuration has no record store or providers, so no
lookups were collected before either, and its assertions are unchanged.

It also brings b2d4bfd from #1488, which records the known UID hashes
on lookup results with a setter, so the provider IDs the write planner
logs are not derived from them.

The base now also carries #1506's repin of EdgeZero to rc/identity at
d063a8e7 and its merge of main's Fastly SDK 0.13.3 upgrade (#1671): fastly
0.13.3, url 2.5.9 and Viceroy 0.22.0.

This PR now stacks on #1661 instead of #1646, so rc/identity can take both
as plain merges. #1661 sits on #1656 and #1626, which sit on #1646, so the
merge also brings #1626 (provider opt-outs and legacy EID expiry on Fastly
and Axum), #1656 (the configurable Edge Cookie browser gate) and #1661
(refusing EC creation when a trusted JA4 contradicts the User-Agent).

Cloudflare route tests: both PRs add a test at the end of the file. The
merge keeps both, this PR's
sliding_ec_configuration_preserves_unsupported_platform_responses and
#1661's ec_route_creates_no_record_whatever_the_bot_management_ja4.

Fastly sliding EC test: #1617, which now sits below this PR, answers GET
/health through the router's probe hook as an operational response, which
carries no EC state. This PR's
sliding_ec_renews_held_publisher_identity_before_terminal_privacy routes
/health through the router and expected EC state on every path but the
unsupported EC route, so it now also accepts the liveness probe without EC
state. Its check that /health issues no renewal cookie is unchanged.

The base now also carries #1627's 4d0c1a2, which renames the generic
runtime KV store to trusted_server_runtime_kv, #1488's a610152 and
9104fd3, which add hashed-email intake for the LiveRamp and ID5
identity providers, #1646's aa31559, which gates identity writes for
rejected clients, and #1626's d07f789, which withholds a mirrored UID
while another source owner is opted out.

Settings: this PR's MaxAgeDays and #1488's HashedEmailSource are both
added before Ec in settings.rs; the merge keeps both.

This PR's head moves to fbe5670, its merge of #1646's aa31559, which
models admitted clients in the core sliding tests, finalizes them with
the store gate and adds refused_client_gets_no_renewal_or_record_io, and
adds the proposal's review log. Taken as the change from the old head
668d501, the new head would replay #1646 commits the base already
carries in rebuilt form. The merge takes only fbe5670's own resolution,
the change from a plain merge of 668d501 and aa31559 to fbe5670:
the sliding tests and the proposal apply cleanly, and its Fastly sliding
test port is the one this merge already made.
aram356 added a commit that referenced this pull request Nov 25, 2026
…1622 into rc/identity

#1622 (244ca26) now carries the whole chain, each PR merging the one below
it:

- #1506 (c197404) repins EdgeZero to rc/identity at d063a8e7, which
  carries EdgeZero main's Fastly SDK 0.13.3 upgrade through every EdgeZero PR
  here, and merges Trusted Server main's upgrade (#1671): fastly 0.13.3, url
  2.5.9 and Viceroy 0.22.0.
- #1614, #1525, #1526, #1487 and #1488 take it in turn. #1488 also adds
  b2d4bfd, which records known UID hashes with a setter.
- #1489, the identity spine (#1639, #1640, #1612, #1628 and #1623), #1531 and
  #1532.
- The Axum serving line: #1613, #1616, #1617, #1615, #1635, #1637 and #1627,
  chained, with #1627's b958107 decoding the Spin discovery document with
  Response::json and #1627's merge of #1625, which brings #1625's Wrangler pin
  into the chain.
- The held line on #1627: #1533, #1534, #1536, #1535, #1537, #1539, #1538,
  #1540, #1566, #1624, #1641, #1642 and #1646. #1646 keeps its own shared
  after-response runner in ec::app::lookups.
- #1636 (72096cd) on #1646 (b5a5f62), draining Axum
  after-response identity tasks on SIGTERM through #1646's shared runner.
- The EC route line on #1636: #1626 (067531e), which merges #1636, the
  draft #1656, #1661, #1662 and #1622, and through #1622's merge of it,
  #1620's round-6 head.

Each conflict was resolved in the PR that sits higher. This merge is clean.

Since the last update the chain also takes #1488's hashed-email intake
(a610152 and 9104fd3) and its POST, body and header options for the
status call (f063a76), #1627's split of the generic runtime KV store into
trusted_server_runtime_kv (4d0c1a2), #1646's gate on identity writes for
rejected clients (aa31559) its native container test of the failure router
(4f4c036) and that test's header check on an ordinary route (71a573a),
#1626's withholding of a mirrored UID while another source owner is opted
out (d07f789), and #1617's description of the Axum startup failure router
(6d174a8) and of the startup failures that still exit before listening
(4c07cad). #1636 no longer sits in the Axum serving line; it arrives
through #1626, which merges it on top of #1646. Its new head adopts #1646's
after-response runner in place of the one rc/identity took with cf1102c.

Cloudflare guide: #1627's merge of #1625 now keeps both #1625's tool version
clause and #1627's TRUSTED_SERVER_RUNTIME_KV binding in the smoke paragraph,
and fixes #1625's smoke script test for #1617's Python floor and Worker
build, and #1537's merge fixes its ts stub for #1537's storage template
step, so this merge needs no resolution.
@aram356

aram356 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed 96e21b06a, a merge of #1531's new head f94f6f9e9. It brings the identity chain below, including #1488's hashed-email intake and #1489's mirrored UID expiry cap, and #1506's repin of EdgeZero to rc/identity at d063a8e7 with main's Fastly SDK upgrade (#1671). The merge had no conflicts.

Takes #1531's new head 2de7dc2, which carries #1506's repin of EdgeZero to
rc/identity at 459bd27d (42e0c46): PR 275 at 0e2a58ae, the stack's test
fixes and EdgeZero 536's bounded record update, RecordHandle::update.

The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed a509c9348, a merge of #1531's new head 2de7dc255, which brings #1506's repin of EdgeZero to rc/identity at 459bd27d (42e0c46c7): EdgeZero #275 at 0e2a58ae, the EdgeZero stack's test fixes and EdgeZero #536's bounded record update, RecordHandle::update. The merge had no conflicts.

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

This PR changes GeoInfo so that city, continent, coordinates and metro code are optional, and coordinates must come as a complete pair. That change is carried through the Fastly, Cloudflare, OpenRTB, Prebid and APS code. It also connects the protected CloudFront Geo result from EdgeZero to the Axum adapter. The geography is read once per request into a snapshot, a TS boot profile selects the provider, and Geo headers are finalized from that same snapshot.

The GeoInfo change is careful. Fields that are missing stay absent instead of becoming empty strings or 0,0, real zero coordinates are kept, a half-supplied coordinate pair is rejected when parsing, and the flat field names and order are unchanged when every field is present. The tests are thorough.

Blocking:

  • Axum now sends geography on 401 responses. The Fastly adapter deliberately withholds Geo on every 401 (resolve_geo_for_response), and Axum does not. The new startup test even requires Geo headers on the 401 from /_ts/admin/ec. This is a cross-adapter parity break that undoes a documented privacy decision (see inline).

Non-blocking:

  • Docs contradict the code on the absent-profile case. The guide says an absent profile keeps Geo Off. The code instead lets EdgeZero choose a provider from its own settings, such as EDGEZERO__ADAPTER__GEO__PROVIDER, which kv_selected() reads (see inline).
  • The new geo-kv feature is untested in CI. kv_selected() adds the geo_index store declaration, but CI only runs the geo-cloudfront feature. Either add --features geo-kv to the workflow or leave the feature out of this extraction. The guide itself says the KV prototype is not the provider being shipped.

CI status was not checked: this review only had read access.

Comment thread docs/guide/native-rc-demo.md Resolved
Takes #1531's new head 52076d8, which carries #1506's repin of EdgeZero to
rc/identity at 1619078a (8edc50e), a revert that removes EdgeZero 522
(portable Fastly record providers) and 524 (outbound mTLS client
identities).

The merge is clean.

Cargo.lock is re-resolved after the merge so it passes --locked; only
package sources change.
@aram356

aram356 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed aae1099f7.

Takes #1531's new head 52076d8, which carries #1506's repin of EdgeZero to rc/identity at 1619078a (8edc50e), a revert that removes IABTechLab/edgezero#522 (portable Fastly record providers) and IABTechLab/edgezero#524 (outbound mTLS client identities).

The merge is clean.

Cargo.lock is re-resolved after the merge so it passes --locked; only package sources change.

Axum's finalize middleware now drops the request's Geo on any 401, matching
the Fastly adapter's resolve_geo_for_response rule, so geography never reaches
an unauthenticated caller. The CloudFront startup test expects the admin 401
to report Geo unavailable while 200 and 404 keep the managed US/CA snapshot.

Unit-test kv_selected and run the geo-kv feature suite in CI. Correct the native
guide: an absent TS profile defers to EdgeZero's EDGEZERO__ADAPTER__GEO__*
settings, which default to Off.
@ChristianPavilonis

Copy link
Copy Markdown
Collaborator Author

Review follow-through at ce6135184

This responds to dhruv8sh's review on a509c9348.

  • Geo on 401 responses (blocking): fixed. Axum now withholds Geo from every 401, matching Fastly. Details are in the thread reply.
  • Absent-profile docs: reworded to match the code. Details are in the thread reply.
  • geo-kv untested in CI: tested rather than removed. The feature is used on the RC line: the RC Dockerfile allows it and it is on rc/identity. A new unit test, kv_store_is_declared_only_for_native_kv_selection_without_a_profile, covers four cases: provider kv with no profile, a supplied profile, and provider unset, off or cloudfront. The test-axum job gains a cargo test --locked -p trusted-server-adapter-axum --features geo-kv step next to the CloudFront Geo step.

Local checks at ce6135184:

  • cargo fmt --check passes.
  • cargo clippy-axum (all features, -D warnings) is clean.
  • The Axum adapter suite passes with default features, with geo-cloudfront (14 startup tests) and with geo-kv. Existing ignored cases stay ignored.
  • Prettier passes on the guide.

The Fastly, Cloudflare and Spin code is unchanged and their suites weren't rerun. The VitePress build wasn't run locally. Hosted checks for this head are pending.

PRs stacked above this one pick the fix up when merged forward. #1615 edits the same FinalizeResponseMiddleware::handle lines and will need a small conflict resolution.

@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 adds optional protected CloudFront Geo to the native Axum adapter. Geo is selected by a typed TS boot profile, or by EdgeZero's native settings when no profile is given. The core GeoInfo type changes so that missing city, continent, coordinates and metro code are left out instead of being filled with empty text or zero. The Cloudflare and Fastly adapters and the OpenRTB, APS and Prebid exporters are updated to match. Startup failures are typed and don't keep profile inputs, finalization withholds Geo from 401s, and the end-to-end tests cover consent gating, credential stripping and per-request isolation. I found nothing blocking. The comments below are small concerns and test or doc gaps.

None of the inline comments below carries a one-click suggestion. Each fix needs a new test outside the diff, a matching change in EdgeZero's parsing, or doc edits in more than one place, so they're described in prose.

Non-blocking

🤔 thinking

  • Client IP now comes from NativeIngressMetadata::effective_client() with no test — see inline at crates/trusted-server-adapter-axum/src/platform.rs:94
  • kv_selected() matches the provider string exactly and reads the environment separately from the runner — see inline at crates/trusted-server-adapter-axum/src/native_geo.rs:21

📝 note

  • The guide doesn't mention the new geo-kv feature — see inline at docs/guide/native-rc-demo.md:130

🌱 seedling

  • The geo-kv CI step only tests the store-declaration boolean — see inline at .github/workflows/test.yml:171

👍 praise

  • The GeoInfo deserializer rejects half a coordinate pair — see inline at crates/trusted-server-core/src/platform/types.rs:53

Cross-cutting / body-level findings

  • 📝 Wire-format change for GeoInfo consumers. GeoInfo now leaves city, continent, latitude/longitude and metro_code out of the JSON when they're missing. Before, it always wrote them ("" / 0.0 / 0). Deserialization is now more lenient in the same way. Anything outside this crate that reads serialized AuctionRequest/GeoInfo JSON and expects those keys to always be there will see them missing for country-only results. The Fastly path still fills every field, so its output is unchanged. Nothing needs to change here, but the PR description or changelog should mention it.

.get::<AxumRequestContext>()
.and_then(|c| c.remote_addr)
.map(|addr| addr.ip());
let client_ip = match ctx.extensions().get::<NativeIngressMetadata>() {

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.

🤔 thinking — This changes where client_ip comes from. It used to be the raw socket peer (AxumRequestContext::remote_addr); now it is NativeIngressMetadata::effective_client() whenever EdgeZero attaches ingress metadata. That IP feeds ClientInfo, and from there EC, the auction device.ip and trace. The change has nothing to do with Geo, and no test in this PR or elsewhere in the crate exercises the NativeIngressMetadata branch. A grep for effective_client finds only this line.

Can you confirm that effective_client() only returns a forwarded address after EdgeZero's trusted-forwarding admission? Otherwise a client-supplied X-Forwarded-For could set the IP the server records. Either way, please add a test that pins both branches. For example, a startup-fixture request with a forged X-Forwarded-For from a non-trusted peer should still record the socket peer:

// startup.rs sketch: untrusted peer + forged XFF must not change the client IP Core sees
let response = server.get_with_headers("/_ts/trace", "X-Forwarded-For: 203.0.113.9\r\n")?;
assert!(!response.contains("203.0.113.9"));

Apply manually: the test lives outside this hunk and probably in tests/startup.rs.

const EDGEZERO_GEO_PROVIDER_ENV: &str = "EDGEZERO__ADAPTER__GEO__PROVIDER";

/// Declare the Geo store only for deployments selecting KV Geo through native settings.
pub(crate) fn kv_selected() -> bool {

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.

🤔 thinking — Two small concerns about kv_selected():

  1. It matches the raw string exactly. std::env::var(EDGEZERO_GEO_PROVIDER_ENV).as_deref() == Ok("kv") works only if EdgeZero is just as strict. If EdgeZero's settings parser trims whitespace or ignores case (KV, kv), EdgeZero picks the KV provider but store_metadata() doesn't declare geo_index. That likely fails at startup, which is safe, but the operator would get a confusing store error rather than a Geo error. Ideally the selection would come from the same parsed value EdgeZero uses, for example from AxumRunOptions/geo_capability_for once it's resolved. Failing that, a test that pins EdgeZero's spelling rules would help.
  2. It reads the environment a second time. main.rs captures the Geo selection once in native_options(), but store_metadata() reads the environment again on its own. In practice both run on the same process environment, so the risk is small. Still, the PR describes "capture once before starting the runner", and two independent readers can drift apart as this code changes.

No suggestion: the right fix depends on what EdgeZero exposes.

middleware, which retains Geo/TS headers without replacing the framework status.
The pinned EdgeZero has no admitted-error finalizer, so an error EdgeZero
renders outside the router carries no Geo/TS headers. Pre-admission failures
have no managed outcome. The selected serving

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.

📝 note — The guide only documents geo-cloudfront and says "the selected serving provider is protected CloudFront, not the standalone EdgeZero KV Geo prototype". But this PR also adds a geo-kv Cargo feature (it turns on celld-kv) and has store_metadata() declare a geo_index KV store when EDGEZERO__ADAPTER__GEO__PROVIDER=kv. Operators reading this page won't know that path exists. They also won't know that it needs a geo_index store binding, or that a TS profile turns it off. Please either add a short paragraph on geo-kv (feature flag, env selection, required store ID) or say plainly that it's an unsupported prototype hook.

- name: Run protected CloudFront Geo tests
run: cargo test --locked -p trusted-server-adapter-axum --features geo-cloudfront

- name: Run native KV Geo selection tests

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.

🌱 seedling — With --features geo-kv, the only behaviour this step exercises is kv_selected()'s boolean, in native_geo::tests. No test starts the server with the KV provider selected, so there is no check that the geo_index declaration actually binds or that a KV-backed outcome reaches geo_from_outcome. That's acceptable for a prototype path. A follow-up startup-fixture test with EDGEZERO__ADAPTER__GEO__PROVIDER=kv would catch a store-ID mismatch between GEO_STORE_ID and what EdgeZero expects.

pub asn: Option<u32>,
}

impl<'de> serde::Deserialize<'de> for GeoInfo {

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.

👍 praise — Good call writing a manual Deserialize rather than relying on #[serde(flatten)] Option<GeoCoordinates>. With flatten alone, an incomplete latitude/longitude pair would quietly become None. The geo_info_rejects_incomplete_coordinate_pairs and geo_info_full_serialization_preserves_flat_fields tests pin both the rejection and the unchanged flat field order.

PR #1531's new head brings its native prepared startup review fixes, plus the cascaded owner review fixes from #1525, #1526, #1488, #1489 and #1639.

The merge is textually clean but did not compile, so this link carries a semantic fix.

crates/trusted-server-adapter-axum/Cargo.toml and Cargo.lock: #1531 dropped the temp-env dev-dependency as unused at its head, but #1532's native Geo and binary tests call temp_env. The resolution restores the dev-dependency so #1532's tests build, and Cargo.lock is re-resolved with cargo metadata --offline.
PR #1531'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. The merge is clean. Cargo.lock changes only the 10 EdgeZero package sources, now at 8a73c097; the codegen crate's nested Cargo.lock is unchanged.
@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 ce6135184 to c486fe2ef:

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

PR #1531'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.
PR #1531'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 and #1639's pull reserve boundary check and wording. 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

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 1722dc152 to 3507c128f:

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

PR #1531's new head brings #1487's change that strips `ts-eids` from publisher-origin requests unless the operator opts in. The merge is clean.
@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 3507c128f to 8aa4f3708:

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

@aram356

aram356 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Merged #1614's /_ts/ local answers (48930c270) into this branch as f34c85bb5, on top of 8aa4f3708.

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 #1531's new head (035ca4a71), 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. 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.

Extract the protected CloudFront native Geo integration

4 participants