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

Send Authorization cookie when using socket.io client inside Iframe via WebSocket #1322

Closed
1 task done
ofirrifo opened this issue Sep 9, 2019 · 1 comment
Closed
1 task done

Comments

@ofirrifo
Copy link

ofirrifo commented Sep 9, 2019

You want to:

  • report a bug

Current behaviour

I'm trying to create a websocket connection using socket.io client. My issue starts when my app is running inside an Iframe. The browser does not send the Authorization cookie which is being set by the server.

There is no CORS issue since the iframe and the server are running on the same domain.

The cookie configurations are: HttpOnly = true, Secure = true, SameSite = Strict.

It does work when the app is running without an iframe.

Example of my code

this.socket = io(`/${namespace}`, {
      transports: ['websocket'],
      path: '/.../socket.io'
    });

Expected behaviour

The cookie should be send.

Setup

  • OS: mac
  • browser: Chrome
  • socket.io version: 2.2.0
@darrachequesne
Copy link
Member

If the iframe origin (in the src attribute) and the parent origin differ, you won't be able to access the cookies.

There is nothing we can fix in Socket.IO.

See also: https://security.stackexchange.com/questions/182518/how-to-confirm-that-an-embedded-iframe-can-read-cookies-from-parent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants