Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
61db3ef
Require EC record stores and rate limiters to be Send and Sync
dhruv8sh Nov 17, 2026
5d2824c
Add a core identity app that builds identity state once
dhruv8sh Nov 17, 2026
a09a98a
Mount the admin identity lookups from the core identity app
dhruv8sh Nov 17, 2026
b5ddf99
Build Fastly identity state once through the core identity app
dhruv8sh Nov 17, 2026
39f06c2
Mount the Axum admin identity lookups from the core identity app
dhruv8sh Nov 17, 2026
a3e1b63
Mount the Cloudflare and Spin admin identity lookups from the core id…
dhruv8sh Nov 17, 2026
28ec87b
Guard that adapters reach identity only through the core identity app
dhruv8sh Nov 17, 2026
914c9d5
Refuse an identity record store without a rate limiter
dhruv8sh Nov 17, 2026
9958540
Test that mounted identity routes share the supplied record store
dhruv8sh Nov 17, 2026
5f7d76d
Carry only whether Fastly EC finalization may write the record store
dhruv8sh Nov 17, 2026
135bee7
Answer identity app errors through the core http_error
dhruv8sh Nov 18, 2026
7add9e0
Keep the admin identity handlers private to the EC module
dhruv8sh Nov 17, 2026
0327b41
Scan adapter source with a literal- and nesting-aware guard
dhruv8sh Nov 17, 2026
d60c3b2
Prepare GPT diagnostics on the core admin identity routes
dhruv8sh Nov 17, 2026
a2e54de
Merge PR #1489 into PR #1623 for the identity integration chain
aram356 Nov 19, 2026
988d417
Merge PR #1489 into PR #1623 for the identity integration chain
aram356 Nov 19, 2026
78e1f2f
Merge PR #1612 into PR #1623 for the identity integration chain
aram356 Nov 19, 2026
a503053
Merge PR #1628 into PR #1623 for the identity integration chain
dhruv8sh Nov 19, 2026
6a86ad8
Merge PR #1628 into PR #1623 for the identity integration chain
dhruv8sh Nov 19, 2026
6fd236e
Merge PR #1628 into PR #1623 for the identity integration chain
dhruv8sh Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ jobs:
- name: Run cross-adapter parity tests
run: cargo test --manifest-path crates/trusted-server-integration-tests/Cargo.toml --test parity

- name: Guard adapter identity wiring
run: cargo test --manifest-path crates/trusted-server-integration-tests/Cargo.toml --test adapter_identity_guard

- name: Clippy (parity test crate)
run: cargo clippy --manifest-path crates/trusted-server-integration-tests/Cargo.toml --all-targets -- -D warnings

Expand Down
58 changes: 17 additions & 41 deletions crates/trusted-server-adapter-axum/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ use trusted_server_core::auction::{
};
use trusted_server_core::cache_policy::EdgeCacheHeader;
use trusted_server_core::ec::EcContext;
use trusted_server_core::ec::admin::{
admin_ec_lookup_not_supported, deny_admin_diagnostic_fallback, handle_admin_eids_lookup,
};
use trusted_server_core::ec::admin::deny_admin_diagnostic_fallback;
use trusted_server_core::ec::app::{IdentityApp, IdentityPlatform};
use trusted_server_core::ec::batch_sync::answer_batch_sync_locally;
use trusted_server_core::ec::identify::answer_identify_locally;
use trusted_server_core::ec::registry::PartnerRegistry;
use trusted_server_core::edge_app::{install_edge_policies, synthesized_response_headers};
use trusted_server_core::error::{TrustedServerError, http_error, startup_error};
use trusted_server_core::integrations::{IntegrationRegistry, ProxyDispatchInput};
Expand Down Expand Up @@ -58,6 +56,10 @@ pub struct AppState {
settings: Arc<Settings>,
orchestrator: Arc<AuctionOrchestrator>,
registry: Arc<IntegrationRegistry>,
/// Identity state built once. The dev server has no EC record store and
/// applies no rate limit: its deployer limits traffic at the load
/// balancer.
identity: Arc<IdentityApp>,
services: Option<RuntimeServices>,
}

Expand Down Expand Up @@ -101,10 +103,14 @@ fn build_state_with_services(
let orchestrator = build_orchestrator_with_plan(Arc::clone(&plan), &settings)?;
let registry = IntegrationRegistry::with_plan(&settings, plan)?;

let settings = Arc::new(settings);
let identity = IdentityApp::build(Arc::clone(&settings), IdentityPlatform::default())?;

Ok(Arc::new(AppState {
settings: Arc::new(settings),
settings,
orchestrator: Arc::new(orchestrator),
registry: Arc::new(registry),
identity,
services,
}))
}
Expand Down Expand Up @@ -291,8 +297,6 @@ enum NamedRouteHandler {
VerifySignature,
AdminNotSupported,
CachePurgeNotSupported,
AdminEcNotSupported,
AdminEidsLookup,
/// Legacy `/admin/keys/*` aliases — denied locally with 404 so they never
/// reach the publisher fallback (which would leak admin credentials).
LegacyAdminDenied,
Expand Down Expand Up @@ -322,7 +326,7 @@ const LEGACY_ADMIN_DENY_METHODS: &[Method] = &[
Method::DELETE,
];

fn named_routes() -> [NamedRoute; 19] {
fn named_routes() -> [NamedRoute; 16] {
[
NamedRoute {
path: "/.well-known/trusted-server.json",
Expand Down Expand Up @@ -355,26 +359,6 @@ fn named_routes() -> [NamedRoute; 19] {
primary_methods: LEGACY_ADMIN_DENY_METHODS,
handler: NamedRouteHandler::CachePurgeNotSupported,
},
// Admin EC lookup routes. Registered explicitly (like the key routes
// above) so they never fall through to the publisher fallback, and
// they match `Settings::ADMIN_ENDPOINTS` for auth coverage.
NamedRoute {
path: "/_ts/admin/ec",
primary_methods: &[Method::GET],
handler: NamedRouteHandler::AdminEcNotSupported,
},
NamedRoute {
path: "/_ts/admin/ec/{id}",
primary_methods: &[Method::GET],
handler: NamedRouteHandler::AdminEcNotSupported,
},
// Admin EIDs echo: pure request inspection (no KV), so the dev
// server serves the real handler.
NamedRoute {
path: "/_ts/admin/eids",
primary_methods: &[Method::GET],
handler: NamedRouteHandler::AdminEidsLookup,
},
// The legacy non-`/_ts` aliases (`/admin/keys/*`) are denied locally with
// a 404, matching the Fastly and Cloudflare adapters: the production
// basic-auth handler regex `^/_ts/admin` does not match them, and letting
Expand Down Expand Up @@ -501,19 +485,6 @@ fn named_route_handler(
);
Ok(resp)
}
NamedRouteHandler::AdminEcNotSupported => {
// The EC identity graph is Fastly KV backed; the Axum
// dev server has no store to read.
Ok(admin_ec_lookup_not_supported())
}
NamedRouteHandler::AdminEidsLookup => {
let partner_registry = PartnerRegistry::from_ec(&state.settings.ec)?;
handle_admin_eids_lookup(
&partner_registry,
state.settings.sharedid_storage().cookie_name(),
&req,
)
}
NamedRouteHandler::LegacyAdminDenied => Ok(legacy_admin_alias_denied()),
NamedRouteHandler::Identify => answer_identify_locally(&state.settings, &req),
NamedRouteHandler::BatchSync => Ok(answer_batch_sync_locally(&req)),
Expand Down Expand Up @@ -733,6 +704,11 @@ fn router_builder(state: &Arc<AppState>) -> RouterBuilder {
)
});

// The core identity app registers `GET` on the admin EC and EIDs lookups;
// without a record store, admin EC lookup answers 501. Their other methods
// reach the catch-all fallback, which denies admin diagnostics locally.
router = state.identity.mount(router);

for route in named_routes() {
for method in route.primary_methods {
router = router.route(
Expand Down
49 changes: 14 additions & 35 deletions crates/trusted-server-adapter-cloudflare/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ use trusted_server_core::config_payload::CONFIG_BLOB_KEY;
#[cfg(target_arch = "wasm32")]
use trusted_server_core::config_payload::{DEFAULT_SECRET_STORE_ID, settings_from_config_blob};
use trusted_server_core::ec::EcContext;
use trusted_server_core::ec::admin::{
admin_ec_lookup_not_supported as core_admin_ec_lookup_not_supported,
deny_admin_diagnostic_fallback, handle_admin_eids_lookup,
};
use trusted_server_core::ec::admin::deny_admin_diagnostic_fallback;
use trusted_server_core::ec::app::{IdentityApp, IdentityPlatform};
use trusted_server_core::ec::batch_sync::answer_batch_sync_locally;
use trusted_server_core::ec::identify::answer_identify_locally;
use trusted_server_core::ec::registry::PartnerRegistry;
use trusted_server_core::edge_app::{install_edge_policies, synthesized_response_headers};
use trusted_server_core::error::{TrustedServerError, http_error, startup_error};
use trusted_server_core::integrations::{IntegrationRegistry, ProxyDispatchInput};
Expand Down Expand Up @@ -81,6 +78,8 @@ pub struct AppState {
settings: Arc<Settings>,
orchestrator: Arc<AuctionOrchestrator>,
registry: Arc<IntegrationRegistry>,
/// Identity state built with the app. This adapter has no EC record store.
identity: Arc<IdentityApp>,
services: Option<RuntimeServices>,
}

Expand Down Expand Up @@ -215,10 +214,14 @@ fn build_state_with_services(
let orchestrator = build_orchestrator_with_plan(Arc::clone(&plan), &settings)?;
let registry = IntegrationRegistry::with_plan(&settings, plan)?;

let settings = Arc::new(settings);
let identity = IdentityApp::build(Arc::clone(&settings), IdentityPlatform::default())?;

Ok(Arc::new(AppState {
settings: Arc::new(settings),
settings,
orchestrator: Arc::new(orchestrator),
registry: Arc::new(registry),
identity,
services,
}))
}
Expand Down Expand Up @@ -333,10 +336,6 @@ fn cache_purge_not_supported() -> Response {
response
}

fn admin_ec_lookup_not_supported() -> Response {
core_admin_ec_lookup_not_supported()
}

/// Builds the local `404 Not Found` returned for legacy `/admin/keys/*`
/// aliases on the Cloudflare adapter.
///
Expand Down Expand Up @@ -587,7 +586,11 @@ fn router_builder(state: &Arc<AppState>) -> RouterBuilder {
// shared-secret authentication header.
.middleware(SanitizeRequestMiddleware::new(Arc::clone(&state.settings)))
.middleware(FinalizeResponseMiddleware::new(Arc::clone(&state.settings)))
.middleware(AuthMiddleware::new(Arc::clone(&state.settings)))
.middleware(AuthMiddleware::new(Arc::clone(&state.settings)));
// The core identity app registers `GET` on the admin EC and EIDs
// lookups; without a record store, admin EC lookup answers 501.
router = state.identity.mount(router);
router = router
.get(
"/.well-known/trusted-server.json",
make_handler(Arc::clone(&state), |s, services, req| async move {
Expand Down Expand Up @@ -616,30 +619,6 @@ fn router_builder(state: &Arc<AppState>) -> RouterBuilder {
.post("/_ts/admin/keys/deactivate", |_ctx: RequestContext| async {
Ok::<Response, EdgeError>(admin_key_management_not_supported())
})
// Admin EC lookup routes. Registered explicitly (like the key
// routes above) so they never fall through to the publisher
// fallback, and they match `Settings::ADMIN_ENDPOINTS` for auth
// coverage. The EC identity graph is Fastly KV backed, so this
// adapter has no store to read.
.get("/_ts/admin/ec", |_ctx: RequestContext| async {
Ok::<Response, EdgeError>(admin_ec_lookup_not_supported())
})
.get("/_ts/admin/ec/{id}", |_ctx: RequestContext| async {
Ok::<Response, EdgeError>(admin_ec_lookup_not_supported())
})
// Admin EIDs echo: pure request inspection (no KV), so this
// adapter serves the real handler.
.get(
"/_ts/admin/eids",
make_handler(Arc::clone(&state), |s, _services, req| async move {
let partner_registry = PartnerRegistry::from_ec(&s.settings.ec)?;
handle_admin_eids_lookup(
&partner_registry,
s.settings.sharedid_storage().cookie_name(),
&req,
)
}),
)
.post(
"/auction",
make_handler(Arc::clone(&state), |s, services, req| async move {
Expand Down
Loading
Loading