Repository navigation
fix(server-sdk): report a missing sha256 claim in WebhookReceiver - #743
Open
ANDROIDHASSAN wants to merge 1 commit into
Open
ANDROIDHASSAN wants to merge 1 commit into
ANDROIDHASSAN wants to merge 1 commit into
Conversation
A token without a sha256 claim was reported as "sha256 checksum of body does not match", which points at the body rather than the token. Check for the claim first, with the message the Python server SDK uses.
🦋 Changeset detectedLatest commit: 36226ad The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WebhookReceiver.receivecomparesclaims.sha256with the body hash directly, so a token that has nosha256claim at all fails with "sha256 checksum of body does not match". That points at the body, when the problem is the token (for example one signed by a different service, or by anAccessTokenthat never setsha256).It now checks for the claim first and throws "sha256 was not found in the token", the message the Python server SDK uses (livekit/python-sdks#860). A token with a claim that does not match the body still gets "sha256 checksum of body does not match".
Tests in
WebhookReceiver.test.ts:reports a token without a sha256 claim as such: fails onmain(received "sha256 checksum of body does not match"), passes now.rejects a body that does not match the token hash: the mismatch message is unchanged; passes on both.vitest run srcpasses in the node, edge-runtime and happy-dom environments (45 tests);eslint,prettier --checkandtsc --noEmitpass. Changeset included (patch).