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 #1940

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

jar-stripe
Copy link
Contributor

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

Why

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

  • replaced api version check in webhook/client with isCompatibleApiVersion which will test if the release identifier of the webhook event matches the pinned version or return false for any event api version that does not have a release identifier
  • updated tests to match

Changelog

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

…ion, which will test if the release train of the webhook event matches the pinned version, or return false for any event api version that does not have a release train
@jar-stripe jar-stripe merged commit 1665054 into master Oct 24, 2024
12 checks passed
@jar-stripe jar-stripe deleted the jar/fix-webhook-api-version-checks branch October 24, 2024 00:02
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