GitHub user elek opened a pull request:
https://github.com/apache/zeppelin/pull/2166
[ZEPPELIN-2288] Fix Cross-Site WebSocket check
Change-Id: Iad87ebe0b5dd6bd67a12e47fe83fbd0e1e71bda9
### What is this PR for?
ZEPPELIN-173 implemented an optional check for the Origin header during the
websocket connection creation. This check is no longer active since jetty is
upgraded to 9 as the checkOrigin method is no longer called automatically.
This fix, just calls the existing check from the WebsocketCreator manually.
### What type of PR is it?
Bug Fix
### Todos
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2288
### How should this be tested?
1. Set `zeppelin.server.allowed.origins` in zeppelin-site.xml other than
the default `*`. Eg. `xxxx`
2. Start zeppelin
3. Try to open the zeppelin ws conection with different origin:
```
curl 'http://localhost:8080/ws' -H 'Host: localhost:8080' -H 'User-Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101
Firefox/47.0' -H 'Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H
'Accept-Language: en-US,en;q=0.5' --compressed -H 'Sec-WebSocket-Version: 13'
-H 'origin: http://other:8080' -H 'Sec-WebSocket-Extensions:
permessage-deflate' -H 'Sec-WebSocket-Key: BpiqAMwZaQUJQ//NtEaQPw==' -H
'Connection: keep-alive, Upgrade' -H 'Pragma: no-cache' -H 'Cache-Control:
no-cache' -H 'Upgrade: websocket'
```
4. The websocket creation should be failed if the origin is not localhost
or not the string configurated at 2.
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/elek/zeppelin ZEPPELIN-2288
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/2166.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2166
----
commit 9f8f998b3b318b946422bc798e27beed178c5084
Author: Elek, Márton <[email protected]>
Date: 2017-03-20T14:23:51Z
[ZEPPELIN-2288] Fix Cross-Site WebSocket check
Change-Id: Iad87ebe0b5dd6bd67a12e47fe83fbd0e1e71bda9
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---