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

Update webhook API version validation #1906

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

jar-stripe
Copy link
Contributor

@jar-stripe jar-stripe commented Oct 23, 2024

What

Stripe API versions now contain two parts: a date part (as before) and an identifier. The SDKs validate that webhook events received are in the shape expected by the pinned version in the SDK but going forward, that will be true for different versions with the same identifier. For example, the September API release was 2024-09-30.acacia, and we expect that webhook events sent with version 2024-09-30.acacia will be compatible with an SDK pinned to 2025-10-28.acacia. This PR updates the version checking logic to make sure we don't reject webhook events incorrectly.

What

  • changed apiVersionMatch in EventDataObjectDeserializer to test if the release identifier of the webhook event api version matches the identifier of the pinned version. this false for any api event version that does not have an identifier, except in specific test scenarios
  • updated tests to match

Changelog

  • Update webhook event processing to accept events from any API version within the supported major release

…ng for full api version equality), or return false if the event version does not have a release train
fixed tests that hooked getIntegrationApiVersion with an older version
clarified comments
@jar-stripe jar-stripe merged commit 9238407 into master Oct 23, 2024
12 checks passed
@jar-stripe jar-stripe deleted the jar/fix-webhook-api-version-checks branch October 23, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants