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(payouts): validate client secret during confirmation (#14820)
Sakil Mostakf1144ec5c7e3
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rsindex 8b8847a35b..b9271875bf 100644--- a/crates/router/src/core/payouts.rs+++ b/crates/router/src/core/payouts.rs@@ -3797,6 +3797,24 @@ pub async fn make_payout_data(todo!()}+#[cfg(feature = "v1")]+fn authenticate_payout_client_secret(+ request_client_secret: Option<&str>,+ stored_client_secret: Option<&str>,+) -> Result<(), errors::ApiErrorResponse> {+ match request_client_secret {+ Some(request_client_secret)+ if stored_client_secret.is_some_and(|secret| secret == request_client_secret) =>+ {+ Ok(())+ }+ Some(_) => Err(errors::ApiErrorResponse::ClientSecretInvalid),+ // Merchant-authenticated requests do not carry a client secret. Client-authenticated+ // requests are required to provide one before reaching this validation.+ None => Ok(()),+ }+}+#[cfg(feature = "v1")]pub async fn make_payout_data(state: &SessionState,@@ -3857,6 +3875,14 @@ pub async fn make_payout_data().await.to_not_found_response(errors::ApiErrorResponse::PayoutNotFound)?;++ if let payouts::PayoutRequest::PayoutCreateRequest(request) = req {+ authenticate_payout_client_secret(+ request.client_secret.as_deref(),+ payouts.client_secret.as_deref(),+ )?;+ }+core_utils::validate_profile_id_from_auth_layer(auth_profile_id, &payouts)?;let payout_attempt_id =