-
Notifications
You must be signed in to change notification settings - Fork 2.8k
read cookie while initialising websocket connection (fix #1660) #1668
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
Conversation
0x777
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending docs changes
0x777
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cors validation has to be applied on the host during ws initialisation
- as browsers don't enforce SOP on websockets, we enforce CORS policy on websocket handshake - if CORS is disabled, by default cookie is not read (because XSS risk!). Add special flag to force override this behaviour
shahidhk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ecthiender Can we show a server log asking to add --ws-read-cookie flag when someone sends a cookie over websocket and cors is disabled?
- add log notice when cors is disabled, and cookie is not read on websocket handshake - forward origin header to webhook in POST mode. So that when CORS is disabled, webhook can also enforce CORS independently.
Resolve Conflicts: .circleci/test-server.sh server/src-exec/Main.hs server/src-lib/Hasura/Server/Init.hs server/tests-py/conftest.py server/tests-py/context.py
Done. |
Resolve Conflicts: server/src-exec/Main.hs server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs server/src-lib/Hasura/Server/App.hs server/src-lib/Hasura/Server/Init.hs
shahidhk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Review app https://hge-ci-pull-1668.herokuapp.com is deleted |
Description
Read cookie (if exists) while initialising websocket connection. If there is auth webhook setup, now authorization over websocket should work seamlessly. (User wouldn't need to read the cookie on the client-side and send it as connection params).
What component does this PR affect?
Requires changes from other components? If yes, please mark the components:
Related Issue
#1660 , #1654
Solution and Design
Type
Checklist: