Repository navigation
Extract existing Sourcepoint consent synchronization #1535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
82942de
a275941
e09e884
ce378aa
e267296
7e9ca97
2d27271
0ebe0eb
7140746
314aebd
8414bff
7c397a6
af6e51c
397d4ce
e85f66a
01a052d
cfaac73
5f884f9
0666a9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -172,6 +172,14 @@ where | |||||||||||
| { | ||||||||||||
| let services = state.services_for_request(&ctx)?; | ||||||||||||
| let mut req = ctx.into_request()?; | ||||||||||||
| if req.uri().path() == trusted_server_core::ec::consent_update::CONSENT_UPDATE_PATH { | ||||||||||||
| req = match trusted_server_core::ec::consent_update::prepare_consent_update(&services, req) | ||||||||||||
| .await | ||||||||||||
| { | ||||||||||||
| Ok(request) => request, | ||||||||||||
| Err(response) => return Ok(*response), | ||||||||||||
| }; | ||||||||||||
| } | ||||||||||||
| if let Err(error) = trusted_server_core::integrations::gpt_diagnostics::prepare_request( | ||||||||||||
| &state.settings, | ||||||||||||
| &mut req, | ||||||||||||
|
|
@@ -292,6 +300,7 @@ enum EcRoute { | |||||||||||
| Publisher, | ||||||||||||
| Auction, | ||||||||||||
| PageBids, | ||||||||||||
| ConsentUpdate, | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // --------------------------------------------------------------------------- | ||||||||||||
|
|
@@ -355,6 +364,9 @@ async fn dispatch_ec_route( | |||||||||||
| registry: Some(&state.partners), | ||||||||||||
| }; | ||||||||||||
| let result = match route { | ||||||||||||
| EcRoute::ConsentUpdate => Ok( | ||||||||||||
| trusted_server_core::ec::consent_update::handle_consent_update(&req, ec.graph.as_ref()), | ||||||||||||
| ), | ||||||||||||
| EcRoute::Auction => { | ||||||||||||
| handle_auction( | ||||||||||||
| &state.settings, | ||||||||||||
|
|
@@ -481,6 +493,7 @@ enum NamedRouteHandler { | |||||||||||
| LegacyAdminDenied, | ||||||||||||
| Auction, | ||||||||||||
| PageBids, | ||||||||||||
| ConsentUpdate, | ||||||||||||
| Identify, | ||||||||||||
| FirstPartyProxy, | ||||||||||||
| FirstPartyClick, | ||||||||||||
|
|
@@ -504,8 +517,23 @@ const LEGACY_ADMIN_DENY_METHODS: &[Method] = &[ | |||||||||||
| Method::DELETE, | ||||||||||||
| ]; | ||||||||||||
|
|
||||||||||||
| fn named_routes() -> [NamedRoute; 18] { | ||||||||||||
| fn named_routes() -> [NamedRoute; 19] { | ||||||||||||
| [ | ||||||||||||
| NamedRoute { | ||||||||||||
| path: trusted_server_core::ec::consent_update::CONSENT_UPDATE_PATH, | ||||||||||||
| primary_methods: &[ | ||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏ nitpick — Listing every method (including
Suggested change
|
||||||||||||
| Method::GET, | ||||||||||||
| Method::POST, | ||||||||||||
| Method::HEAD, | ||||||||||||
| Method::OPTIONS, | ||||||||||||
| Method::PUT, | ||||||||||||
| Method::PATCH, | ||||||||||||
| Method::DELETE, | ||||||||||||
| Method::TRACE, | ||||||||||||
| Method::CONNECT, | ||||||||||||
| ], | ||||||||||||
| handler: NamedRouteHandler::ConsentUpdate, | ||||||||||||
| }, | ||||||||||||
| NamedRoute { | ||||||||||||
| path: "/_ts/api/v1/identify", | ||||||||||||
| primary_methods: &[Method::GET, Method::OPTIONS], | ||||||||||||
|
|
@@ -683,6 +711,9 @@ fn named_route_handler( | |||||||||||
| handle_admin_eids_lookup(&state.partners, &req) | ||||||||||||
| } | ||||||||||||
| NamedRouteHandler::LegacyAdminDenied => Ok(legacy_admin_alias_denied()), | ||||||||||||
| NamedRouteHandler::ConsentUpdate => { | ||||||||||||
| dispatch_ec_route(&state, &services, req, EcRoute::ConsentUpdate).await | ||||||||||||
| } | ||||||||||||
| NamedRouteHandler::Identify => { | ||||||||||||
| // Read-only identity lookup never enters generation or | ||||||||||||
| // response finalization, including cookie ingestion. | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -571,6 +571,14 @@ async fn execute_named( | |
| ) -> Result<Response, EdgeError> { | ||
| let services = build_per_request_services(&state, &ctx)?; | ||
| let mut req = ctx.into_request()?; | ||
| if matches!(handler, NamedRouteHandler::ConsentUpdate) { | ||
| req = match trusted_server_core::ec::consent_update::prepare_consent_update(&services, req) | ||
| .await | ||
| { | ||
| Ok(req) => req, | ||
| Err(response) => return Ok(*response), | ||
| }; | ||
| } | ||
|
|
||
| // S2S batch sync uses Bearer auth (not EC cookies), so it skips EC | ||
| // context creation entirely — mirroring the dedicated early arm in the | ||
|
|
@@ -698,6 +706,12 @@ async fn run_named_route( | |
| .await | ||
| } | ||
| } | ||
| NamedRouteHandler::ConsentUpdate => Ok( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 Fastly and Axum disagree for bot-gated clients Fastly passes Related coverage note: |
||
| trusted_server_core::ec::consent_update::handle_consent_update( | ||
| &req, | ||
| ec.finalize_kv_graph.as_ref(), | ||
| ), | ||
| ), | ||
| NamedRouteHandler::SetTester => handle_set_tester(&state.settings), | ||
| NamedRouteHandler::ClearTester => handle_clear_tester(&state.settings), | ||
| NamedRouteHandler::Auction => { | ||
|
|
@@ -807,6 +821,14 @@ async fn dispatch_fallback( | |
| services: &RuntimeServices, | ||
| mut req: Request, | ||
| ) -> Response { | ||
| if req.uri().path() == trusted_server_core::ec::consent_update::CONSENT_UPDATE_PATH { | ||
| return match trusted_server_core::ec::consent_update::prepare_consent_update(services, req) | ||
| .await | ||
| { | ||
| Ok(req) => trusted_server_core::ec::consent_update::handle_consent_update(&req, None), | ||
| Err(response) => *response, | ||
| }; | ||
| } | ||
| if let Some(response) = deny_admin_diagnostic_fallback(&req) { | ||
| return response; | ||
| } | ||
|
|
@@ -1091,6 +1113,7 @@ enum NamedRouteHandler { | |
| LegacyAdminDenied, | ||
| BatchSync, | ||
| Identify, | ||
| ConsentUpdate, | ||
| SetTester, | ||
| ClearTester, | ||
| Auction, | ||
|
|
@@ -1123,6 +1146,21 @@ const LEGACY_ADMIN_DENY_METHODS: &[Method] = &[ | |
| ]; | ||
|
|
||
| const NAMED_ROUTES: &[NamedRoute] = &[ | ||
| NamedRoute { | ||
| path: trusted_server_core::ec::consent_update::CONSENT_UPDATE_PATH, | ||
| primary_methods: &[ | ||
| Method::GET, | ||
| Method::POST, | ||
| Method::HEAD, | ||
| Method::OPTIONS, | ||
| Method::PUT, | ||
| Method::PATCH, | ||
| Method::DELETE, | ||
| Method::TRACE, | ||
| Method::CONNECT, | ||
| ], | ||
| handler: NamedRouteHandler::ConsentUpdate, | ||
| }, | ||
| NamedRoute { | ||
| path: "/.well-known/trusted-server.json", | ||
| primary_methods: &[Method::GET], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
♻️ refactor —
ConsentUpdatepasses the unfilteredec.graph, butNativeEcRequest::finalize(line 280-283) only writes through the graph whenself.browser || ec_consent_withdrawn(..). A non-browser grant therefore gets204on Axum while Fastly, which passesfinalize_kv_graph(same filter), returns503. Apply the finalize filter so the acknowledgement matches what finalization can actually persist and the adapters agree.