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

Add option to set allowed origins #431

Merged
merged 9 commits into from
Mar 25, 2021
Merged

Add option to set allowed origins #431

merged 9 commits into from
Mar 25, 2021

Conversation

FZambia
Copy link
Member

@FZambia FZambia commented Feb 27, 2021

Add allowed_origins option.

This option allows setting an array of allowed origin patterns (array of strings) for WebSocket and SockJS endpoints to prevent CSRF attack. This is especially important when using connect proxy feature.

Originally cross-origin check was not too important due to JWT auth, now with connect proxy browser automatically passes cookies and origin check becomes necessary to secure an app. While it's already possible to validate origin on backend side looking at Origin header I think it's nice to have directly in Centrifugo.

If allowed_origins option not set at all then no origin check will be performed by Centrifugo.

As soon as allowed_origins defined every connection request will be checked against each pattern in an array until a match.

Centrifugo v3 may enforce same-origin strategy by default.

@FZambia FZambia merged commit 22a5443 into master Mar 25, 2021
@FZambia FZambia deleted the allowed_origins branch March 25, 2021 08:55
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

Successfully merging this pull request may close these issues.

1 participant