Skip to content

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

fix(auth): reject mismatched v2 client secret resource IDs (#14864)

Shankar Singh C7a334875acd4
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 5b28b290e2..669a36c56c 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -3194,7 +3194,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
(
@@ -3203,7 +3204,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
(
@@ -3212,7 +3214,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
_ => {
@@ -3933,7 +3936,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
(
common_utils::types::authentication::ResourceId::Customer(self_id),
@@ -3941,7 +3945,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
(
common_utils::types::authentication::ResourceId::PaymentMethodSession(self_id),
@@ -3949,7 +3954,8 @@ where
) => {
fp_utils::when(self_id != db_id, || {
Err::<(), errors::ApiErrorResponse>(errors::ApiErrorResponse::Unauthorized)
- });
+ })
+ .attach_printable("Client secret resource ID mismatch")?;
}
_ => {
return Err(errors::ApiErrorResponse::Unauthorized.into());