这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ecthiender
Copy link
Contributor

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?

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Requires changes from other components? If yes, please mark the components:

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System

Related Issue

#1660 , #1654

Solution and Design

Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Docs update
  • Community content

Checklist:

  • I have read the contributing guide and my code conforms to the guidelines.
  • This change requires a change in the documentation.
  • I have updated the documentation accordingly.
  • I have added required tests.

@ecthiender ecthiender requested a review from 0x777 as a code owner February 26, 2019 05:15
@ecthiender ecthiender self-assigned this Feb 26, 2019
@ecthiender ecthiender added the c/server Related to server label Feb 26, 2019
@ecthiender ecthiender requested a review from shahidhk as a code owner February 26, 2019 13:22
Copy link
Member

@0x777 0x777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending docs changes

Copy link
Member

@0x777 0x777 left a 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
rikinsk-zz
rikinsk-zz previously approved these changes Feb 28, 2019
Copy link
Member

@shahidhk shahidhk left a 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.
ecthiender and others added 4 commits February 28, 2019 12:22
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
@ecthiender
Copy link
Contributor Author

@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?

Done.

shahidhk
shahidhk previously approved these changes Mar 1, 2019
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
Copy link
Member

@shahidhk shahidhk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shahidhk shahidhk merged commit 02d80c9 into hasura:master Mar 4, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-1668.herokuapp.com is deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants