Skip to content

[IMP] peek into the JWT to get the channel uuid #21

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThanhDodeurOdoo
Copy link
Collaborator

Before this commit, the payload of the first websocket message (auth) would expect the channel uuid along the jwt, to know where to look to get the key used to sign it.

It was slightly redundant as the channel uuid is part of the jwt payload. With the new JWT implementation, we now have the freedom to read the JWT before verifying it.

It also reduces the business code complexity as we no longer need to check the corner case of passing a keyed channel uuid in the jwt while skipping the channelUUID of the websocket payload (see removed code in connect() of ws.js.

This is safe to do as the payload is verified with the key of the channel, which means that the signature has to match the channel uuid and tampering with it would invalidate the content.

@ThanhDodeurOdoo ThanhDodeurOdoo force-pushed the simple-channel-check-tso branch from 40e2cb6 to 2aab6d6 Compare April 23, 2025 07:54
@ThanhDodeurOdoo ThanhDodeurOdoo added the backwards-compatible: new server + old client An updated server works with an outdated client label Apr 23, 2025
@ThanhDodeurOdoo ThanhDodeurOdoo force-pushed the simple-channel-check-tso branch from 2aab6d6 to 76fb87f Compare April 23, 2025 12:52
Before this commit, the payload of the first websocket message (auth)
would expect the channel uuid along the jwt, to know where to look
to get the key used to sign it.

It was slightly redundant as the channel uuid is part of the jwt
payload. With the new JWT implementation, we now have the freedom
to read the JWT before verifying it.

It also reduces the business code complexity as we no longer need to
check the corner case of passing a keyed channel uuid in the jwt
while skipping the channelUUID of the websocket payload (see removed
code in `connect()` of `ws.js`.

This is safe to do as the payload is verified with the key of the
channel, which means that the signature has to match the channel uuid
and tampering with it would invalidate the content.
@ThanhDodeurOdoo ThanhDodeurOdoo force-pushed the simple-channel-check-tso branch from 76fb87f to 5d2b7a4 Compare April 23, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-compatible: new server + old client An updated server works with an outdated client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant