-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Due to the WebSocket API in the browsers doesn't allow to add custom headers in the request, the JWT cannot be got from Authorization
and should change.
Browsers allow to send custom info from a specific header Sec-WebSocket-Protocol
that contains arbitrary data, and we can use it to send de jwt, this is not a very hacky thing because browser doesn't allow other way. ref: kubernetes
So the implementation should change to the following:
- Extract
Sec-WebSocket-Protocol
- Split (limit: 5 *[1]) parameters by
,
(comma) - Split (limit: 1) key-value parameters by
=
(equal) - Get
auth
key
*[1] If we don't use limit it can be used as exploit, we don't expect more than 5 params, but it can be change if needed
All the parameters can be collected to Vec<(String, String)>
instead of HashMap
.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers
Type
Projects
Status
Done