juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.67k stars 1.23k forks source link

[BUG] : The request schema needs validation over card details #701

Open SamraatBansal opened 1 year ago

SamraatBansal commented 1 year ago

Bug Description

Currently the card details are being passed as string, and it is failing at connector call.

There is no check what values are being passed in card_expiry_month, card_expiry_year or card_cvc.

Anybody can pass random string, without conveying the liability of the wrong input

Expected Behavior

While parsing the request, there should be a validation check over the fields to include what values are expected out of them so that it need not be applied at individual connectors.

Actual Behavior

Currently all strings are accepted.

Steps To Reproduce

Context For The Bug

No response

Environment

Are you using hyperswitch hosted version? Yes/No If yes, please provide the value of the x-request-id response header for helping us debug your issue.

If not (or if building/running locally), please provide the following details:

  1. Operating System or Linux distribution:
  2. Rust version (output of rustc --version): ``
  3. App version (output of cargo r -- --version): ``

Have you spent some time to check if this bug has been raised before?

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

No, but I'm happy to collaborate on a PR with someone else

SanchithHegde commented 1 year ago

Related issues: #606, #607