Skip to content
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

feat(core): add signature to outgoing webhooks #1249

Merged
merged 5 commits into from
May 29, 2023

Conversation

ShankarSinghC
Copy link
Contributor

@ShankarSinghC ShankarSinghC commented May 24, 2023

Type of Change

  • New feature

Description

Add signature to outgoing webhooks from hyperswitch by hashing it contents, so that the webhook can be verified on the merchants end.

Implementation details:
-> Key used here is generated from the CSPRNG (generate_cryptographically_secure_random_string())
-> Hashing algorithm used is Sha512
-> The outgoing webhook contents is hashed using this key and the signature is sent in the header

Motivation and Context

How did you test it?

I tested this change manually

Out going webhook to merchant
Screenshot 2023-05-24 at 11 57 38 AM

signature verification
Screenshot 2023-05-24 at 11 58 32 AM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@ShankarSinghC ShankarSinghC added A-core Area: Core flows C-feature Category: Feature request or enhancement R-waiting-on-L1 Review: Waiting on L1 reviewer labels May 24, 2023
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner May 24, 2023 07:00
@ShankarSinghC ShankarSinghC self-assigned this May 24, 2023
@ShankarSinghC ShankarSinghC requested a review from a team as a code owner May 24, 2023 10:45
Narayanbhat166
Narayanbhat166 previously approved these changes May 24, 2023
@SanchithHegde SanchithHegde added S-waiting-on-author Status: This PR is incomplete or needs to address review comments R-waiting-on-L1 Review: Waiting on L1 reviewer and removed R-waiting-on-L1 Review: Waiting on L1 reviewer labels May 24, 2023
SanchithHegde
SanchithHegde previously approved these changes May 24, 2023
@SanchithHegde SanchithHegde added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed R-waiting-on-L2 Review: Waiting on L2 reviewer R-L1-completed Review: L1 Review completed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels May 24, 2023
Narayanbhat166
Narayanbhat166 previously approved these changes May 24, 2023
Copy link
Member

@jarnura jarnura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more details about this commit, in the description.

@jarnura jarnura removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed R-waiting-on-L2 Review: Waiting on L2 reviewer labels May 29, 2023
@jarnura jarnura added the S-waiting-on-author Status: This PR is incomplete or needs to address review comments label May 29, 2023
crates/router/src/core/webhooks.rs Outdated Show resolved Hide resolved
@ShankarSinghC ShankarSinghC added S-waiting-on-review Status: This PR has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels May 29, 2023
@jarnura jarnura added S-ready-for-merge and removed S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels May 29, 2023
@jarnura jarnura added this to the May 2023 Release milestone May 29, 2023
@Narayanbhat166 Narayanbhat166 added this pull request to the merge queue May 29, 2023
Merged via the queue into main with commit 3534cac May 29, 2023
@SanchithHegde SanchithHegde deleted the hash_outgoing_webhook branch May 29, 2023 20:38
@SanchithHegde SanchithHegde removed S-ready-for-merge R-L1-completed Review: L1 Review completed labels May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows C-feature Category: Feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants