Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix: add `client_secret` validation in session and eligibility authentication apis (#11085)
Sai Harsha Vardhan8f5f2cd5c5e3
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rsindex ec1dea2675..e391bc7e31 100644--- a/crates/router/src/core/unified_authentication_service.rs+++ b/crates/router/src/core/unified_authentication_service.rs@@ -1585,6 +1585,31 @@ pub async fn authentication_eligibility_check_core(_auth_flow: AuthFlow,) -> RouterResponse<AuthenticationEligibilityCheckResponse> {let authentication_id = req.authentication_id.clone();+ let db = &*state.store;+ let merchant_account = platform.get_processor().get_account();+ let merchant_id = merchant_account.get_id();+ let key_manager_state = (&state).into();+ let authentication = db+ .find_authentication_by_merchant_id_authentication_id(+ merchant_id,+ &authentication_id,+ platform.get_processor().get_key_store(),+ &key_manager_state,+ )+ .await+ .to_not_found_response(ApiErrorResponse::AuthenticationNotFound {+ id: authentication_id.get_string_repr().to_owned(),+ })?;++ req.client_secret+ .as_ref()+ .map(|client_secret| {+ utils::authenticate_authentication_client_secret_and_check_expiry(+ client_secret.peek(),+ &authentication,+ )+ })+ .transpose()?;let eligibility_handler = EligibilityHandler::new(state, platform, req);// Run the checks in sequence, short-circuiting on the first that returns a next actionlet sdk_next_action = eligibility_handler@@ -2218,6 +2243,15 @@ pub async fn authentication_session_core(id: authentication_id.get_string_repr().to_owned(),})?;+ req.client_secret+ .map(|client_secret| {+ utils::authenticate_authentication_client_secret_and_check_expiry(+ client_secret.peek(),+ &authentication,+ )+ })+ .transpose()?;+let mut session_tokens = Vec::new();let business_profile = state