-
Notifications
You must be signed in to change notification settings - Fork 14
Automated Payment Events: Stripe #5908
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
base: main
Are you sure you want to change the base?
Conversation
|
|
|
|
||
|
|
||
| def make_webhook_request(data: dict, secret: bytes = WEBHOOK_SECRET): | ||
| timestamp = int(time.time()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need a mutable value for this ? If it's only about getting different payload, would it be possible to use an incrementor instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean for the time ? it's how the Stripe API signs its webhook payloads, it's made so you can't replay an event in the future, the signed payload is only valid around the time it was signed. This is how the Stripe API behave, I just mirrored the logic, and I think we should keep it.
If you worry it will be flaky, we can always adjust the time offset tolerance config in the libraries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, that's fine. We'll consider that iif it turns out to be flaky.
Do you mind just adding a small comment explaining this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| timestamp = int(time.time()) | |
| timestamp = int(time.time()) # the stripe backend signs the payload with a timestamp for security reasons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like that ? 39a766d (#5908)
cbeauchesne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small non blocking comment, the rest is AGTM !
|
Updating the PR to fix CI issues |
Add tests for the new Automated Payment Events feature for the Stripe SDK. Added on the RASP scenario because it needs to mock the Stripe API, and i'm reusing the
internal_servercontainer as a mock. It also includes hardcoded rules copied from this PR: https://github.com/DataDog/appsec-event-rules/pull/264Also includes the Node.js weblog update.
[RFC link]