Skip to content

Make the Edge Cookie browser gate configurable - #1656

Open
dhruv8sh wants to merge 20 commits into
fix/1555-provider-eid-opt-outsfrom
feat/1520-configurable-browser-gate
Open

dhruv8sh wants to merge 20 commits into
fix/1555-provider-eid-opt-outsfrom
feat/1520-configurable-browser-gate

Conversation

@dhruv8sh

@dhruv8sh dhruv8sh commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Changes

File Change
crates/trusted-server-core/src/settings.rs BrowserGate enum (lenient default, strict) and Ec::browser_gate. Skipped from serialization at its default so a blob that leaves it unset still loads in older runtimes. Tests for defaults, TOML loading and an unknown value.
crates/trusted-server-core/src/ec/device.rs DeviceSignals::allows_creation(gate). Corrects the looks_like_browser doc, which said known_browser does not gate identity. Tests for both rules.
crates/trusted-server-core/src/ec/app/lifecycle.rs read_request applies settings.ec.browser_gate in place of the hardcoded rule. Test through IdentityApp::read_request.
docs/guide/configuration.md browser_gate row in the [ec] table and a description of both rules.
docs/guide/edge-cookies.md, docs/guide/native-ec-persistence.md Scope the "missing JA4 does not block" statements to the default rule.
trusted-server.example.toml Commented browser_gate example.
CHANGELOG.md Unreleased entry.

Closes

Closes #1520

Refs #1592 (the shared JA4/UA gate line; #1661 is stacked on this PR), Refs #1344 (naming)

Spec

Spec: pending. This adds a configuration key, so a spec reviewed over two rounds follows on this branch before the PR is marked ready.

Test plan

  • cargo test-fastly && cargo test-axum (Fastly suite 4243 passed; Axum 119 passed, rerun on Enforce provider opt-outs and legacy EID expiry on Fastly and Axum #1626)
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run (no JS changes)
  • JS format: cd crates/trusted-server-js/lib && npm run format (no JS changes)
  • Docs format: Prettier check on the changed docs and CHANGELOG.md
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: cargo test-cloudflare (70 passed), cargo test-spin (90 passed), clippy-cloudflare, clippy-cloudflare-wasm, clippy-spin-native, clippy-spin-wasm, clippy-cli. Restoring the hardcoded rule makes the new read_request test fail, so it covers the wiring.

Notes for review

  • Fastly and Axum differ when the gate blocks a request (inherited from Run Axum identity through the shared application #1646). Axum drops the identity graph from the auction (trusted-server-adapter-axum/src/app.rs, ec.graph.filter(|_| ec.creation_allowed)). Fastly still passes ec.kv_graph to handle_publisher_request, where main set it to None for clients that failed the gate. Under strict, a returning Fastly visitor without JA4 therefore still gets graph EIDs. This PR does not change that, and the docs and the BrowserGate::Strict doc say strict gates creation only and that adapters treat an existing EC that fails it differently.
  • Axum, Cloudflare and Spin supply no trusted JA4, so strict never creates an EC on them. The configuration guide, CHANGELOG and example config now say so; config validation does not warn. They also say lenient blocks no client today, since the built-in table lists no non-browser fingerprint. A blocked creation logs at debug.
  • The name browser_gate may need to align with the [device] module selection in Add device and geo module selection with the host-signal Edge Cookie module #1344.

Checklist

  • Feature PRs: spec linked above, ending in a review log of two or more agent review rounds
  • Changes follow AGENTS.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

@dhruv8sh dhruv8sh self-assigned this Nov 23, 2026
@dhruv8sh dhruv8sh linked an issue Nov 23, 2026 that may be closed by this pull request
Add `[ec].browser_gate` so operators choose the device-signal rule for
EC creation. The default, `lenient`, keeps the shared lifecycle's rule
and blocks only known non-browser fingerprints, so a missing JA4 alone
does not stop EC creation. `strict` restores the earlier rule that
requires a JA4 class and a recognized User-Agent platform, and still
blocks known non-browsers.

The key is skipped from serialization at its default, so a config blob
that leaves it unset still loads in runtimes built before it.
@dhruv8sh
dhruv8sh force-pushed the feat/1520-configurable-browser-gate branch from fa3059c to 8eb0f15 Compare November 23, 2026 13:33
@dhruv8sh
dhruv8sh changed the base branch from feat/1574-axum-shared-identity to fix/1555-provider-eid-opt-outs November 23, 2026 13:33
@aram356 aram356 linked an issue Nov 23, 2026 that may be closed by this pull request
1 task
PR #1532 now reads the native Geo profile path from
TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE instead of TS_NATIVE_GEO_PROFILE_FILE. No file in this PR
uses the old name after the merge, so the merge only takes the rename from
PR #1626. The merge had no conflicts.
@aram356

aram356 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

For #1532's rename of the native Geo profile variable to TRUSTED_SERVER__NATIVE_GEO_PROFILE_FILE, I pushed 7a4c60cca here, one merge of this PR's base:

No file in this PR uses the old name after the merge, so it only takes the rename from #1626. The merge had no conflicts.

Correction: through #1566, this merge also carries five #1540 commits that #1566 had not merged before (CloudFront forwarding authentication, AWS ingress and Terraform demo prerequisites, the example deployment gate and the deployment guide). It is not only the rename.

dhruv8sh added a commit that referenced this pull request Nov 24, 2026
The Axum redirect test now uses the shared Chrome User-Agent fixture,
since #1661's runner has no local USER_AGENT constant.
@prk-Jr
prk-Jr added this pull request to stack #1665 November 25, 2026 04:10
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, #1646 and #1626, 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.

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.

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.

Device signals: #1646's aa31559 removes DeviceSignals::looks_like_browser
and its tests as unused, and documents that only a known non-browser
refuses identity creation and record writes. This PR's allows_creation
uses looks_like_browser for the strict browser gate. The merge keeps
looks_like_browser, its tests and this PR's gate tests, and the module doc
says that the default lenient gate refuses only a known non-browser while
the strict gate also refuses a request missing the JA4 or platform class.

Identity lifecycle tests: this PR's
read_request_applies_the_configured_browser_gate and #1646's
refused_creation_gets_no_navigation_write_authority and
refused_creation_writes_only_a_consent_withdrawal sit at the same place;
the merge keeps all three and the union of their imports.

Settings: this PR's `browser_gate` and #1488's `hashed_email` both follow
`identity_providers` in Ec and in its Default; the merge keeps both.
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 1b3da24f7, a merge of #1626's new head 067531e98. It brings #1626's d07f789a4, which withholds a mirrored UID while another source owner is opted out, #1636, #1646's aa315593f, which gates identity writes for rejected clients, the chain below, and #1506's repin of EdgeZero to rc/identity at d063a8e7 with main's Fastly SDK upgrade (#1671). Resolutions:

  • Device signals (ec/device.rs): Run Axum identity through the shared application #1646's aa315593f removes DeviceSignals::looks_like_browser and its tests as unused, and documents that only a known non-browser refuses identity creation and record writes. This PR's allows_creation uses looks_like_browser for the strict browser gate. The merge keeps looks_like_browser, its tests and this PR's gate tests, and the module doc says that the default lenient gate refuses only a known non-browser, while the strict gate also refuses a request missing the JA4 or platform class.
  • Identity lifecycle tests (ec/app/lifecycle.rs): this PR's read_request_applies_the_configured_browser_gate and Run Axum identity through the shared application #1646's refused_creation_gets_no_navigation_write_authority and refused_creation_writes_only_a_consent_withdrawal sit at the same place; the merge keeps all three and the union of their imports.
  • Settings: this PR's browser_gate and Add identity providers for ID5, LiveIntent, LiveRamp, ConnectID and UID2 #1488's hashed_email both follow identity_providers in Ec and in its Default; the merge keeps both.

#1626's new head 97413ae brings #1537's b181544, "Accept any Fastly EC
store link name at startup", which #1537's owner merged up through #1539,
#1538 and #1540. The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed f0681ae7c, a merge of #1626's new head 97413ae4a. It brings #1537's b181544a0, "Accept any Fastly EC store link name at startup", which #1537's owner merged up through #1539, #1538 and #1540. The merge had no conflicts.

Takes #1626's new head 7c817db, 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 6eee4a2fb, a merge of #1626's new head 7c817db9a, 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.

#1626's new head 6816160 brings #1539's cf4e815, "Expect the failure router in the native container test", and #1646's a18abf4, "Compare undeclared Axum KV stores with assert_eq". The merge is clean.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#1608), I pushed b60755b68, a merge of #1626's new head 681616009, which brings #1539's cf4e815d4, the native container test's failure-router expectation, and #1646's a18abf428, the reworked KV check in the store metadata test. The only change to this PR's tree is that store test. The merge had no conflicts.

@dhruv8sh
dhruv8sh marked this pull request as ready for review November 27, 2026 11:16
Takes #1626's new head 8ea87b7, 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.
@aram356

aram356 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

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

Takes #1626's new head 8ea87b7, 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.

@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 against fix/1555-provider-eid-opt-outs at 8ea87b7ce558. The default preserves the base predicate, and strict adds the JA4 and User-Agent requirements without relaxing the non-browser check. The gate and settings tests passed in CI on the reviewed source tree. The inline comments cover the operator contract, rollout, and two maintenance suggestions.

Separate from the approval: the PR is marked ready but still says Spec: pending. Please link the feature spec with its two review rounds before merge, as required by CONTRIBUTING.md.

Comment on lines +805 to +807
/// This gates creation only: what an adapter does with an existing EC that
/// fails the rule differs (Axum drops its graph for the request; Fastly
/// keeps it).

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.

R1 · P2: Strict does more than block cookie creation. Axum keeps the graph, just as Fastly does. A returning client that fails the gate can still contribute stored, consented EIDs to an auction, but ordinary writes, refresh, and provider lookups are skipped. Consent withdrawal remains writable. On Axum every request fails strict today because there is no trusted JA4. Please carry this distinction into the config guide and PR description. Keep graph dispatch unchanged so stored opt-outs still inform bidder filtering.

Suggested change
/// This gates creation only: what an adapter does with an existing EC that
/// fails the rule differs (Axum drops its graph for the request; Fastly
/// keeps it).
/// Requests that fail the gate skip ordinary identity writes, refresh,
/// and provider lookups. Consent withdrawal remains writable. Fastly and
/// Axum can still use an existing consented EC to enrich an auction.

none, stays eligible for EC creation.
- `strict` also requires a JA4 class and a recognized User-Agent platform. A
client without trusted JA4 creates no EC. Only Fastly supplies trusted JA4
today, so under `strict` the Axum, Cloudflare and Spin adapters create no EC.

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 · P2: Document the rollout and rollback order for strict. The typed push omits the default but serializes strict. Older runtimes reject unknown [ec] keys, so publishing strict while an old runtime reads the same store, or rolling back only the binary, can prevent settings from loading. No schema change is needed.

Suggested change
today, so under `strict` the Axum, Cloudflare and Spin adapters create no EC.
today, so under `strict` the Axum, Cloudflare and Spin adapters create no EC.
Deploy runtimes that support `browser_gate` before publishing `strict` to a
shared config store. Before rolling back to an older runtime, remove the setting
and any environment override, then publish a compatible blob before reverting
the binary.

/// Both rules block a known non-browser fingerprint.
/// [`BrowserGate::Strict`] also requires [`Self::looks_like_browser`].
#[must_use]
pub fn allows_creation(&self, gate: BrowserGate) -> 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.

R3 · Suggestion: Keep the gate helpers internal. looks_like_browser() can return true for a known non-browser because it checks signal presence, not classification. Its only production caller is this method. Make it private and name it for what it checks, such as has_ja4_and_ua_platform. allows_creation() has no production caller outside core in this tree. Narrowing the API avoids exposing the ambiguous predicate and adding examples for internal helpers.

Suggested change
pub fn allows_creation(&self, gate: BrowserGate) -> bool {
pub(crate) fn allows_creation(&self, gate: BrowserGate) -> bool {

Comment on lines +102 to +105
# Device-signal rule for EC creation. "lenient" (default) blocks only known
# non-browser fingerprints (none are listed yet, so it blocks no client today);
# "strict" also requires trusted JA4 and a recognized User-Agent platform, so
# clients without JA4 create no EC. Only Fastly supplies trusted JA4.

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 · Suggestion: Keep current adapter support in the configuration guide. The empty non-browser table and Fastly-only JA4 support are repeated here, in the enum rustdoc, and in the guide. They can change independently of the rules. Keep the stable rules here and in the rustdoc, and let the guide carry the current support details. The changelog can stay a release snapshot.

Suggested change
# Device-signal rule for EC creation. "lenient" (default) blocks only known
# non-browser fingerprints (none are listed yet, so it blocks no client today);
# "strict" also requires trusted JA4 and a recognized User-Agent platform, so
# clients without JA4 create no EC. Only Fastly supplies trusted JA4.
# Device-signal rule for EC creation. "lenient" (default) blocks only known
# non-browser fingerprints. "strict" also requires trusted JA4 and a recognized
# User-Agent platform. See docs/guide/configuration.md for adapter support.

PR #1626's new head brings the cascaded owner review fixes from #1525, #1526, #1488, #1489, #1639, #1531, #1532, #1615, #1637, #1533, #1536, #1535, #1537, #1538 and #1646.

CHANGELOG.md: #1525 added the allow_insecure_http entry and #1656 added the ec.browser_gate entry at the top of Added. The resolution keeps both, base first.

docs/guide/edge-cookies.md: #1639 rewrote the pull-sync room sentences, and #1656 noted that the JA4 and User-Agent rule applies under the default lenient browser gate. The resolution keeps #1639's paragraph with #1656's browser-gate qualifier.
PR #1626'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 f03c64a1d to 4e801e91b:

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

PR #1626'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 #1626'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.

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

Summary

Reviewed at a118170f3 against fix/1555-provider-eid-opt-outs at fd1bcecca. Every adapter reaches the gate through IdentityApp::read_request, so one allows_creation(settings.ec.browser_gate) call covers Fastly, Axum, Cloudflare, Spin and the EC route. The default keeps the base rule. strict adds the JA4 and User-Agent platform requirements on top of the known-non-browser block, so it is never looser than lenient. Two checks showed the new tests protect the wiring. With the hardcoded known_browser != Some(false) rule restored, read_request_applies_the_configured_browser_gate fails. Without the known-non-browser check under strict, both_gates_block_a_known_non_browser fails.

Approving. Christian's open threads still need to land before merge, and I agree with them:

  • R1: BrowserGate::Strict and the PR's review notes say Axum drops the graph for a client that fails the gate. At this head Axum keeps it (trusted-server-adapter-axum/src/app.rs, "A client refused creation keeps the graph"), as Fastly does.
  • R2: rollout and rollback order for strict.
  • The spec link the PR description still marks as pending.

Non-blocking

⛏ nitpick

  • "without both" reads as "lacking both": see inline at crates/trusted-server-core/src/ec/device.rs:19.

CI Status

  • 31 checks pass at a118170f3.
  • Pending: health-startup (fastly), integration tests, integration tests (Fastly EC lifecycle).

//! browser pattern; `false` for known bots; `None` for unknown. Under the
//! default `lenient` browser gate only `false` refuses identity creation
//! and record writes; missing or unknown signals never do. The `strict`
//! gate also refuses a request without both `ja4_class` and

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.

⛏ nitpick: "without both ja4_class and platform_class" can be read as refusing only when both are absent. allows_creation refuses when either one is missing.

Suggested change
//! gate also refuses a request without both `ja4_class` and
//! gate also refuses a request missing either `ja4_class` or

The module doc read "without both ja4_class and platform_class", which can be
read as refusing only when both are absent. allows_creation refuses when either
one is missing.
PR #1626's new head brings #1626's enforcement of stored and carried provider opt-outs, 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 and #1636's stronger after-response body and drain checks. 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 removed this pull request from stack #1665 December 3, 2026 11:34
@aram356
aram356 added this pull request to stack #1731 December 3, 2026 11:35
aram356 added a commit that referenced this pull request Dec 3, 2026
PR #1675's new head brings #1675's switches that turn off POST /auction while the auction is disabled and the first-party creative endpoints while creative rewriting is off, together with the identity chain between #1646 and #1675 that #1667 did not carry yet: #1636's Axum after-response drain on SIGTERM, #1626's provider opt-outs and legacy EID expiry on Fastly and Axum, #1656's configurable Edge Cookie browser gate, #1661's refusal of EC creation when a trusted JA4 contradicts the User-Agent, and #1662's Fastly EC route acceptance and capped mirrored expiry.

docs/guide/configuration.md: #1675 reworded the enabled row of the [auction] table to say that it also turns on POST /auction, and #1667 added the mtls_slot row, which widened the table. The resolution keeps #1675's enabled text and #1667's mtls_slot row, with the table reformatted by Prettier.

Semantic break in crates/trusted-server-core/src/integrations/prebid.rs: #1675's owner commit d141923 added a test plan with no browser routes, whose ProviderConfig and AuctionPlanConfig literals predate #1667's 0985d67, which added the mtls provider field, and eaa2b3e, which added the mtls_slot plan field. The merge applies cleanly but the core tests no longer compile. The fix belongs in this link because it is where the two changes first meet. The literal gains mtls: false and mtls_slot: Default::default(), as #1667 wrote in the neighboring prebid.rs literals.

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 c4c6a1bda to 6e46b7700:

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

Carries #1533's Axum startup-test port fix (779e446) and nothing
else. Owner commits pushed to other chain PRs since round 15 come in
with the next round.
@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Cascade of #1533's Axum startup-test port fix (779e44673): 9659bd903 merges it into this PR. There were no conflicts and nothing else changed. The fix moves free_loopback_port in crates/trusted-server-adapter-axum/tests/routes.rs below the ephemeral port range, and #1533's note has the details. Owner commits pushed to other chain PRs since round 15 come in with the next round. rc/identity is now 62f8e41e2.

@aram356

aram356 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Merged #1627's runtime KV removal (7c2b84f45) into this branch as 315a9ed15, on top of 9659bd903.

At the maintainer's request, that commit removes the generic runtime KV store trusted_server_runtime_kv. Nothing reads or writes it, and the managed Fastly deploy made every service provision and pay for it. edgezero.toml and the Fastly Hooks::stores() now declare only trusted_server_kv, and RuntimeServices::kv_store() is unavailable on every adapter.

Only that commit was merged, not the base branch's new head. Conflicts were resolved in edgezero.toml, the Fastly Hooks::stores() in app.rs, fastly.toml, the Viceroy template, the integration tests' config.rs, trusted-server.example.toml, docs/guide/architecture.md and docs/guide/edgezero.md. Only trusted_server_kv stays declared, this branch's record-store comment and local seeds are kept, and the runtime-KV lines are dropped. The Axum README and docs/guide/axum-dev.md keep this branch's Axum wording.

Checks on this head: no reference to the removed store remains and cargo fmt --check passes; clippy-fastly, clippy-axum, clippy-cloudflare and clippy-spin-native pass. rc/identity (b9dc3153e) passed the full CI gate list with the removal.

PR #1626's new head brings #1487's change that strips `ts-eids` from publisher-origin requests unless the operator opts in and #1646's fix that preserves filter headers through identity finalization.

trusted-server.example.toml: #1656 documents the commented `[ec]
browser_gate` option, and #1487 (through #1626) documents the commented
`[ec] forward_eids_cookie_to_origin` option at the same spot after the
cluster-heuristic tuning. The resolution keeps both comment blocks, the
base's first.
@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 315a9ed15 to 27ecea0e8:

In trusted-server.example.toml this round's link keeps both commented [ec] blocks, #1487's forward_eids_cookie_to_origin first.

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 118ce2309, on top of 27ecea0e8.

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 #1626's new head (9d8d4aced), 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.

Make JA4 check configurable so that it does not block auction

4 participants