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

GraphQL WebSocket connections not working on Chromium Edge on Windows 10 #3

Closed
nefarius opened this issue Feb 14, 2024 · 8 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@nefarius
Copy link

nefarius commented Feb 14, 2024

No description provided.

@amorey amorey self-assigned this Feb 14, 2024
@amorey amorey added the bug Something isn't working label Feb 14, 2024
@kubetail-org kubetail-org deleted a comment from linear bot Feb 14, 2024
@amorey
Copy link
Member

amorey commented Feb 14, 2024

I have a PR that should fix this #5

Can you try out the kubetail/[email protected] helm chart? This should work:

helm upgrade kubetail kubetail/kubetail --namespace kubetail --version 0.1.9-rc2

@nefarius
Copy link
Author

nefarius commented Feb 14, 2024

Does this need some time to work?

Error: chart "kubetail" matching 0.1.9-rc2 not found in kubetail index. (try 'helm repo update'): no chart version found for kubetail-0.1.9-rc2

EDIT: NVM, reading the bloody output helps 🤣

@nefarius
Copy link
Author

Hey hey! 🎉

image

@amorey
Copy link
Member

amorey commented Feb 14, 2024

Nice!!! Thanks for testing it out. The PR changes the way that kubetail protects against cross-site WebSocket connection requests so I want to tread carefully and double check the code before publishing a new release. Will try to get it out asap. If you have some time, it'd be useful to get another set of eyes on this: #5. I'm using a cookie with SameSite=Strict to ensure that only same-site connections are allowed.

@nefarius
Copy link
Author

Not sure how valuable my input is here, I see what you're trying to achieve here, however I am not well versed enough in Go and front-end development to make a fair judgment.

amorey added a commit that referenced this issue Feb 15, 2024
…ens (#6)

To protect against CSWSH attacks we need a way to identify cross-site requests and prevent them from connecting to the server. The easiest way to do this is by ensuring that the request Host and Origin are the same but unfortunately, kubectl proxy modifies the request Host so we can't use this method. Another easy method is to check the Sec-Fetch-Site header but unfortunately it isn't implemented in some popular browsers (see #3) so we can't use this method either. Instead, this PR uses the old-school method of CSRF token validation to identify cross-site requests and block them. After a WebSocket connection is made, the client is required to authenticate using the CSRF token value. If the token fails validation the connection is closed, otherwise it is allowed to continue.

This PR also moves the GraphiQL playground interface to a static page accessible at /graphiql.
@amorey amorey closed this as completed Feb 15, 2024
@amorey
Copy link
Member

amorey commented Feb 15, 2024

The fix is live in kubetail:0.1.3 (chart v0.1.9):

helm repo update kubetail
helm upgrade kubetail kubetail/kubetail --namespace kubetail --version 0.1.9

I changed the strategy from using a SameSite=Strict cookie to using CSRF token validation which is more secure. Let me know if you notice any issues.

@nefarius
Copy link
Author

Just updated, everything is working 👍

@amorey
Copy link
Member

amorey commented Feb 15, 2024

Nice! Thanks again for your help debugging the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants