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

refactor: add fingerprint to JWT #330

Merged
merged 21 commits into from
Aug 14, 2022
Merged

refactor: add fingerprint to JWT #330

merged 21 commits into from
Aug 14, 2022

Conversation

ravenclaw900
Copy link
Owner

@ravenclaw900 ravenclaw900 commented Aug 10, 2022

Following best practices from https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/JSON_Web_Token_for_Java_Cheat_Sheet.md#token-sidejacking.
Also doesn't send the token with every message, instead storing it in the memory of the backend and only sending it with a dedicated message.

@ravenclaw900 ravenclaw900 added the security Fixes to do with authentication or tokens label Aug 13, 2022
@ravenclaw900 ravenclaw900 changed the title refactor(backend): add fingerprint to JWT refactor: add fingerprint to JWT Aug 14, 2022
@ravenclaw900 ravenclaw900 enabled auto-merge (squash) August 14, 2022 15:23
@ravenclaw900 ravenclaw900 merged commit 2a35eed into main Aug 14, 2022
@ravenclaw900 ravenclaw900 deleted the token-msg branch August 14, 2022 15:23
@ravenclaw900
Copy link
Owner Author

ravenclaw900 commented Nov 6, 2022

I'm probably going to have to revert the fingerprint part of this since it can cause problems with multiple nodes and sending/setting cookies cross-domain.

@ravenclaw900
Copy link
Owner Author

ravenclaw900 commented Nov 6, 2022

The only way I can think of to get around it would be to only use the token generated by the node with the frontend, and use asymmetric signatures (pub/priv key) to verify the token. It still involves sending the cookie to another domain, but that actually seems like it can be done. The only big problem is getting the public key from the frontend node to the backend node(s), and it also wouldn't allow raw websocket access to only the backend node.

@ravenclaw900
Copy link
Owner Author

Hmm, after doing some research (reading random Reddit comments and looking up interesting things that they talked about), a Diffie–Hellman key exchange might let all of the nodes connect and get one shared secret to verify the token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security Fixes to do with authentication or tokens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant